/**
 * Quick Plate — compact homepage plate-builder card styles.
 *
 * @package Plate_Wizard_Configurator
 */

.qp-card,
.qp-card *,
.qp-card *::before,
.qp-card *::after {
	box-sizing: border-box;
}

.qp-card {
	--qp-yellow: #f2c81c;
	--qp-navy: #14213d;
	--qp-muted: #6b7280;
	--qp-border: #e5e7eb;
	--qp-radius: 20px;
	--qp-error: #b3261e;

	position: relative;
	width: 100%;
	background: #ffffff;
	border-radius: var(--qp-radius);
	box-shadow: 0 20px 45px rgba(20, 33, 61, 0.12);
	padding: 24px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	color: var(--qp-navy);
	font-size: 15px;
	line-height: 1.4;
}

.qp-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.qp-header-label {
	font-weight: 700;
	font-size: 0.9rem;
}

.qp-registration-input {
	border: 1px solid var(--qp-border);
	border-radius: 8px;
	padding: 8px 12px;
	font-size: 1.1rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	width: 100%;
	color: var(--qp-navy);
}

.qp-registration-input:focus-visible {
	outline: 2px solid var(--qp-yellow);
	outline-offset: 1px;
}

.qp-field-error,
.qp-form-error {
	color: var(--qp-error);
	font-size: 0.8rem;
	min-height: 1.1em;
}

.qp-preview-wrapper {
	width: 100%;
	/* Fixed to the Standard Car plate's own proportions (520:111mm),
	   regardless of which plate size is actually selected — this is what
	   stops the whole card growing/shrinking in height when a very
	   differently-shaped plate (Motorcycle, Square Motorcycle) is chosen.
	   That plate scales down to fit inside this fixed box instead of the
	   box following its shape. */
	aspect-ratio: 520 / 111;
	overflow: hidden;
	border-radius: 12px;
}

.qp-preview-wrapper svg {
	width: 100%;
	height: 100%;
	display: block;
	/* Deliberately no CSS object-fit here — browser support for
	   object-fit on an inline <svg> element (as opposed to an <img> tag)
	   is genuinely inconsistent/ambiguous per spec. Instead, this relies
	   on the SVG's own preserveAspectRatio="xMidYMid meet" attribute
	   (set by PWC_Svg_Renderer::open_svg_tag()), which is native,
	   universally-supported SVG behaviour and achieves the identical
	   "scale to fit within the box, preserving aspect ratio, centered"
	   result without depending on that inconsistent CSS feature. */
}

.qp-rendering-disclaimer {
	font-size: 0.7rem;
	color: var(--qp-muted);
	text-align: center;
	margin: 8px 0 0;
}

/* Pill toggle: two segments, visually hidden native radios with styled
   labels acting as the visible control — keeps this a fully accessible,
   keyboard-operable radio group rather than a purely decorative div. */
.qp-pill-toggle {
	display: flex;
	gap: 8px;
}

.qp-pill-input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	pointer-events: none;
}

.qp-pill-label {
	flex: 1;
	text-align: center;
	padding: 10px 0;
	border: 1.5px solid var(--qp-border);
	border-radius: 999px;
	font-weight: 700;
	font-size: 0.8rem;
	letter-spacing: 0.04em;
	cursor: pointer;
	color: var(--qp-navy);
	background: #ffffff;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.qp-pill-input:checked + .qp-pill-label {
	background: var(--qp-yellow);
	border-color: var(--qp-yellow);
}

.qp-pill-input:focus-visible + .qp-pill-label {
	outline: 2px solid var(--qp-navy);
	outline-offset: 2px;
}

.qp-rows {
	display: flex;
	flex-direction: column;
}

.qp-row-group {
	position: relative;
	border-bottom: 1px solid var(--qp-border);
}

.qp-row-group:last-child {
	border-bottom: none;
}

.qp-row {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 4px;
	background: none;
	border: none;
	cursor: pointer;
	font: inherit;
	color: var(--qp-navy);
	text-align: left;
}

.qp-row:focus-visible {
	outline: 2px solid var(--qp-yellow);
	outline-offset: -2px;
	border-radius: 6px;
}

.qp-row-icon {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	color: var(--qp-muted);
}

.qp-row-icon svg {
	width: 100%;
	height: 100%;
}

.qp-row-label {
	font-weight: 600;
	font-size: 0.875rem;
}

.qp-row-value {
	margin-left: auto;
	color: var(--qp-muted);
	font-size: 0.875rem;
}

.qp-row-chevron {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	color: var(--qp-muted);
	transition: transform 0.15s ease;
}

.qp-row[aria-expanded="true"] .qp-row-chevron {
	transform: rotate(180deg);
}

/* Popover: absolutely positioned below its trigger row, full card width.
   Kept simple (no floating-ui-style viewport flipping) since the card
   itself is a fixed, modest max-width — there's no realistic case here
   where the popover would overflow the viewport differently than the
   card already does. */
.qp-popover {
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	z-index: 20;
	background: #ffffff;
	border: 1px solid var(--qp-border);
	border-radius: 12px;
	box-shadow: 0 12px 28px rgba(20, 33, 61, 0.18);
	margin-top: 6px;
	padding: 6px;
	max-height: 260px;
	overflow-y: auto;
}

.qp-popover[hidden] {
	display: none;
}

.qp-popover ul[role="listbox"] {
	list-style: none;
	margin: 0;
	padding: 0;
}

.qp-popover li[role="option"] {
	padding: 10px 12px;
	border-radius: 8px;
	font-size: 0.875rem;
	cursor: pointer;
}

.qp-popover li[role="option"].qp-option-active {
	background: #fdf6e3;
}

.qp-popover li[role="option"][aria-selected="true"] {
	font-weight: 700;
}

.qp-popover li[role="option"][aria-selected="true"]::after {
	content: '✓';
	float: right;
	color: var(--qp-yellow-dark, #b8860b);
}

/* Border's second-step panel (colour + thickness), and the Dealer Text
   form panel — both share the same "form" popover layout. */
.qp-popover--form,
.qp-border-custom-panel {
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.qp-popover--form label,
.qp-border-custom-panel label {
	font-size: 0.8rem;
	font-weight: 600;
	margin-top: 4px;
}

.qp-popover--form input[type="text"],
.qp-popover--form input[type="tel"],
.qp-popover--form input[type="url"] {
	border: 1px solid var(--qp-border);
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 0.875rem;
	width: 100%;
}

.qp-thickness-row {
	display: flex;
	align-items: center;
	gap: 8px;
}

.qp-thickness-row input[type="range"] {
	flex: 1;
}

.qp-range-value {
	font-weight: 700;
	min-width: 1.5em;
	text-align: right;
	font-size: 0.875rem;
}

.qp-back-btn,
.qp-done-btn {
	align-self: flex-start;
	background: none;
	border: none;
	font: inherit;
	font-weight: 700;
	font-size: 0.8rem;
	color: var(--qp-navy);
	cursor: pointer;
	padding: 6px 4px;
}

.qp-done-btn {
	align-self: stretch;
	text-align: center;
	background: var(--qp-navy);
	color: #ffffff;
	border-radius: 8px;
	padding: 8px 0;
	margin-top: 4px;
}

.qp-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 4px;
}

.qp-price-amount {
	font-weight: 800;
	font-size: 1.5rem;
}

.qp-add-to-basket-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--qp-yellow);
	color: var(--qp-navy);
	border: none;
	border-radius: 999px;
	padding: 12px 20px;
	font-weight: 700;
	font-size: 0.875rem;
	cursor: pointer;
	transition: filter 0.15s ease;
}

.qp-add-to-basket-btn:hover {
	filter: brightness(0.95);
}

.qp-add-to-basket-btn:focus-visible {
	outline: 2px solid var(--qp-navy);
	outline-offset: 2px;
}

.qp-add-to-basket-btn:disabled {
	opacity: 0.6;
	cursor: default;
}

.qp-cart-icon {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
	.qp-card * {
		transition: none !important;
	}
}
