/**
 * REQUEST-CARD-SYSTEM-1A — shared AskPerTask Request Card.
 * Markup: inc/apt-request-card.php (apt_request_card_render()).
 * Scoped to .apt-rqc; no global/theme selectors.
 */

.apt-rqc {
	--apt-rqc-text: var( --aptv2-text, #1A1A1A );
	--apt-rqc-muted: var( --aptv2-text-muted, #6B7280 );
	--apt-rqc-border: var( --aptv2-border, #E5E7EB );
	--apt-rqc-surface: var( --aptv2-bg, #FFFFFF );
	--apt-rqc-soft: var( --aptv2-bg-soft, #F7F8F7 );
	--apt-rqc-green: var( --aptv2-green, #1FA34A );
	--apt-rqc-green-dark: var( --aptv2-green-dark, #168238 );
	--apt-rqc-green-tint: var( --aptv2-green-light, #EAF7EE );
	--apt-rqc-radius: 16px;
	--apt-rqc-media-h: 240px;

	display: flex;
	flex-direction: column;
	min-width: 0;
	background: var( --apt-rqc-surface );
	border: 1px solid var( --apt-rqc-border );
	border-radius: var( --apt-rqc-radius );
	overflow: hidden;
	color: var( --apt-rqc-text );
	box-shadow: 0 1px 2px rgba( 16, 24, 40, 0.05 ), 0 6px 16px -10px rgba( 16, 24, 40, 0.12 );
	transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.apt-rqc:hover {
	border-color: #CFD8D2;
	box-shadow: 0 4px 12px rgba( 16, 24, 40, 0.06 ), 0 1px 2px rgba( 16, 24, 40, 0.04 );
}

/* ---------- Media (240px) ---------- */

.apt-rqc__media {
	position: relative;
	flex: 0 0 auto;
	height: var( --apt-rqc-media-h );
	background: var( --apt-rqc-soft );
	overflow: hidden;
}

.apt-rqc__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.apt-rqc__fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

.apt-rqc__fallback svg {
	width: 56px;
	height: 56px;
	opacity: 0.85;
}

.apt-rqc__badges {
	position: absolute;
	top: 12px;
	left: 12px;
	right: 12px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	pointer-events: none;
}

.apt-rqc__pill {
	display: inline-flex;
	align-items: center;
	height: 24px;
	padding: 0 10px;
	border-radius: 999px;
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1;
	text-transform: uppercase;
	white-space: nowrap;
	background: rgba( 255, 255, 255, 0.95 );
	color: var( --apt-rqc-text );
	box-shadow: 0 1px 3px rgba( 16, 24, 40, 0.18 );
}

.apt-rqc__pill--urgent {
	background: #D92D20;
	color: #FFFFFF;
}

.apt-rqc__pill--today {
	background: #F79009;
	color: #FFFFFF;
}

.apt-rqc__pill--this-week {
	background: #2C64C9;
	color: #FFFFFF;
}

.apt-rqc__pill--flexible {
	background: rgba( 255, 255, 255, 0.95 );
	color: #344054;
}

.apt-rqc__pill--service-request {
	background: #062F54;
	color: #FFFFFF;
}

.apt-rqc__pill--quick-task {
	background: var( --apt-rqc-green );
	color: #FFFFFF;
}

/* ---------- Requester reviews overlay (bottom-left of image) ----------
   Rendered only when apt_request_card_requester_reviews() returns real,
   authoritative data — none exists today, so this is never output. */

.apt-rqc__reviews {
	position: absolute;
	left: 12px;
	bottom: 12px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	max-width: calc( 100% - 24px );
	padding: 5px 10px;
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	background: rgba( 16, 24, 40, 0.72 );
	color: #FFFFFF;
	-webkit-backdrop-filter: blur( 4px );
	backdrop-filter: blur( 4px );
}

.apt-rqc__stars {
	position: relative;
	display: inline-block;
	font-size: 0.82rem;
	letter-spacing: 1px;
	color: rgba( 255, 255, 255, 0.35 );
}

.apt-rqc__stars-fill {
	position: absolute;
	top: 0;
	left: 0;
	overflow: hidden;
	white-space: nowrap;
	color: #FDB022;
}

.apt-rqc__reviews-count {
	font-weight: 500;
	opacity: 0.9;
}

/* ---------- Body ---------- */

.apt-rqc__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 10px;
	padding: 16px 16px 18px;
	min-width: 0;
}

.apt-rqc__category {
	margin: 0;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.07em;
	line-height: 1.35;
	text-transform: uppercase;
	overflow-wrap: anywhere;
	color: var( --apt-rqc-green-dark );
}

.apt-rqc__title {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.35;
	color: var( --apt-rqc-text );
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow-wrap: anywhere;
}

.apt-rqc__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 12px;
	margin: 0;
	font-size: 0.8rem;
	line-height: 1.4;
	color: var( --apt-rqc-muted );
}

.apt-rqc__meta-item {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	min-width: 0;
}

.apt-rqc__meta-item[hidden] {
	display: none;
}

.apt-rqc__meta-item i {
	font-size: 0.72rem;
	opacity: 0.8;
}

.apt-rqc__distance {
	font-weight: 600;
	color: var( --apt-rqc-text );
}

.apt-rqc__stats {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px;
	padding-top: 2px;
}

.apt-rqc__budget {
	font-size: 1.15rem;
	font-weight: 800;
	line-height: 1.2;
	color: var( --apt-rqc-text );
}

.apt-rqc__offers {
	flex: 0 0 auto;
	padding: 3px 9px;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 600;
	background: var( --apt-rqc-green-tint );
	color: var( --apt-rqc-green-dark );
}

/* ---------- Requester ---------- */

.apt-rqc__requester {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: auto;
	padding-top: 12px;
	border-top: 1px solid var( --apt-rqc-border );
}

.apt-rqc__requester-id {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	color: inherit;
	text-decoration: none;
	border-radius: 10px;
}

a.apt-rqc__requester-id:hover .apt-rqc__requester-name,
a.apt-rqc__requester-id:focus-visible .apt-rqc__requester-name {
	color: var( --apt-rqc-green-dark );
	text-decoration: underline;
}

a.apt-rqc__requester-id:focus-visible {
	outline: 2px solid var( --apt-rqc-green );
	outline-offset: 2px;
}

.apt-rqc__avatar {
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	overflow: hidden;
	background: var( --apt-rqc-soft );
}

.apt-rqc__avatar img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
}

.apt-rqc__requester-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.apt-rqc__requester-name {
	font-size: 0.9rem;
	font-weight: 700;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.apt-rqc__requester-facts {
	font-size: 0.76rem;
	line-height: 1.35;
	color: var( --apt-rqc-muted );
}

.apt-rqc__requester-badge .apt-trust-badge {
	margin: 0;
}

/* ---------- CTA ---------- */

.apt-rqc__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 16px;
	border-radius: 12px;
	font-size: 0.92rem;
	font-weight: 700;
	text-decoration: none;
	background: var( --apt-rqc-green );
	color: #FFFFFF;
	transition: background-color 0.15s ease;
}

.apt-rqc__cta:hover,
.apt-rqc__cta:focus-visible {
	background: var( --apt-rqc-green-dark );
	color: #FFFFFF;
	text-decoration: none;
}

.apt-rqc__cta:focus-visible {
	outline: 2px solid var( --apt-rqc-green-dark );
	outline-offset: 2px;
}

/* No requester row: CTA takes the bottom slot itself. */
.apt-rqc__body > .apt-rqc__cta:only-child,
.apt-rqc__stats + .apt-rqc__cta,
.apt-rqc__meta + .apt-rqc__cta {
	margin-top: auto;
}

/* Narrow phones: keep the image from dominating a single-column card.
   Desktop/tablet cards keep the approved 240px. */
@media ( max-width: 600px ) {
	.apt-rqc {
		--apt-rqc-media-h: clamp( 190px, 58vw, 240px );
	}
}
