/**
 * Précommandes WooCommerce — front-end styles.
 * Mobile-first: base rules target narrow viewports (~360px+), larger
 * screens get progressive enhancement via min-width media queries.
 */

/* ---------------------------------------------------------------------
 * Loop badge (shop / category / search grids)
 * White text on #1d3557 = ~10.7:1 contrast, comfortably AA/AAA.
 * Uses max-width + ellipsis so it can never overflow or push other
 * card content even in a ~280px-wide grid card.
 * ------------------------------------------------------------------- */
.wcpc-loop-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	max-width: 100%;
	box-sizing: border-box;
	margin-bottom: 6px;
	padding: 3px 10px;
	background: #1d3557;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	border-radius: 20px;
	line-height: 1.6;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	vertical-align: middle;
}

.wcpc-loop-badge-icon {
	display: inline-flex;
	flex: 0 0 auto;
	line-height: 0;
}

.wcpc-loop-badge-icon svg {
	display: block;
}

/* ---------------------------------------------------------------------
 * Single-product badge — deliberately different shape/placement than
 * the loop badge (pill with a soft amber fill vs. the loop's solid
 * navy chip) so it is never mistaken for a generic sale/new ribbon.
 * #1d3557 on #fff3cd = ~9.8:1 contrast.
 * ------------------------------------------------------------------- */
.wcpc-product-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0 0 4px;
	padding: 5px 14px;
	background: #fff3cd;
	border: 1px solid #ffe69c;
	color: #1d3557;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	border-radius: 20px;
	line-height: 1.4;
}

.wcpc-product-badge-icon {
	display: inline-flex;
	line-height: 0;
}

.wcpc-product-badge-text {
	display: inline-block;
}

/* ---------------------------------------------------------------------
 * Single product marketing block
 * ------------------------------------------------------------------- */
.wcpc-single-marketing {
	margin: 16px 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
	max-width: 100%;
}

.wcpc-shipping-date {
	font-weight: 600;
	color: #1d3557;
	margin: 0;
}

/* ---------------------------------------------------------------------
 * Countdown widget — real day/hour/minute/second blocks instead of a
 * plain text string. The "ended" state swaps the blocks for a single
 * calm message of a similar overall height, so there is no layout jump.
 * ------------------------------------------------------------------- */
.wcpc-countdown {
	padding: 10px 14px;
	background: #fff3cd;
	border: 1px solid #ffe69c;
	border-radius: 6px;
	min-height: 78px;
	box-sizing: border-box;
}

.wcpc-countdown-label {
	margin: 0 0 8px;
	font-size: 12px;
	font-weight: 600;
	color: #6b5900;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.wcpc-countdown-blocks {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.wcpc-countdown-block {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-width: 52px;
	padding: 6px 4px;
	background: #fff;
	border: 1px solid #ffe69c;
	border-radius: 4px;
	box-sizing: border-box;
	flex: 1 1 52px;
}

.wcpc-countdown-number {
	font-size: 20px;
	font-weight: 700;
	line-height: 1.1;
	color: #1d3557;
	font-variant-numeric: tabular-nums;
}

.wcpc-countdown-unit {
	margin-top: 2px;
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #6b5900;
}

.wcpc-countdown-ended-message {
	margin: 0;
	padding: 12px 0;
	font-size: 14px;
	font-weight: 600;
	color: #555;
	text-align: center;
}

.wcpc-countdown.wcpc-countdown-ended {
	background: #f1f1f1;
	border-color: #ddd;
}

/* Visually hidden but available to assistive tech — self-contained so
 * it never depends on a theme providing its own .screen-reader-text. */
.wcpc-countdown-sr-status {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* ---------------------------------------------------------------------
 * Quota progress bar — filled/unfilled track with a legible "X%" chip
 * anchored to the fill. The chip always uses a fixed dark navy
 * background (#1d3557/white = ~10.7:1) regardless of the fill's own
 * tone, so legibility never depends on which tone is active.
 * Tone shifts (teal → amber → warm orange) are informative only — the
 * numbers themselves never change, no fake urgency.
 * ------------------------------------------------------------------- */
.wcpc-quota-bar-wrap {
	width: 100%;
}

.wcpc-quota-bar {
	position: relative;
	width: 100%;
	height: 20px;
	background: #e9ecef;
	border-radius: 10px;
	overflow: hidden;
}

.wcpc-quota-bar-fill {
	position: relative;
	height: 100%;
	min-width: 20px;
	background: #2a9d8f;
	transition: width 0.4s ease;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	box-sizing: border-box;
}

.wcpc-quota-bar-fill--normal {
	background: #2a9d8f;
}

.wcpc-quota-bar-fill--mid {
	background: #d98c2b;
}

.wcpc-quota-bar-fill--high {
	background: #c65a3b;
}

.wcpc-quota-bar-fill-label {
	position: absolute;
	right: 2px;
	top: 50%;
	transform: translateY(-50%);
	background: #1d3557;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 1;
	padding: 3px 6px;
	border-radius: 8px;
	white-space: nowrap;
}

.wcpc-quota-label {
	margin: 6px 0 0;
	font-size: 12px;
	color: #555;
}

/* Social proof */
.wcpc-social-proof {
	font-size: 13px;
	color: #6c757d;
	font-style: italic;
	margin: 0;
}

/* Incentive bonus */
.wcpc-incentive-bonus {
	padding: 8px 12px;
	background: #eaf7ee;
	border-left: 3px solid #2a9d8f;
	font-size: 13px;
	margin: 0;
}

/* ---------------------------------------------------------------------
 * Reassurance strip — real inline SVG icons (checkmark/lock/shield),
 * no icon-font dependency.
 * ------------------------------------------------------------------- */
.wcpc-reassurance-strip {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.wcpc-reassurance-strip li {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	color: #444;
}

.wcpc-reassurance-icon {
	flex: 0 0 auto;
	display: inline-flex;
	color: #2a9d8f;
	line-height: 0;
}

.wcpc-reassurance-icon svg {
	display: block;
}

.wcpc-reassurance-text {
	display: inline-block;
}

/* ---------------------------------------------------------------------
 * FAQ accordion — smooth max-height transition, rotating chevron,
 * proper focus state for keyboard users.
 * ------------------------------------------------------------------- */
.wcpc-faq-accordion {
	border-top: 1px solid #e5e5e5;
}

.wcpc-faq-item {
	border-bottom: 1px solid #e5e5e5;
}

.wcpc-faq-heading {
	margin: 0;
	font-size: inherit;
	font-weight: inherit;
}

.wcpc-faq-question {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	text-align: left;
	background: none;
	border: none;
	padding: 12px 4px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	color: #1d3557;
}

.wcpc-faq-chevron {
	flex: 0 0 auto;
	display: inline-flex;
	line-height: 0;
	transition: transform 0.2s ease;
}

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

.wcpc-faq-answer {
	overflow: hidden;
	max-height: 0;
	transition: max-height 0.25s ease;
	font-size: 13px;
	color: #444;
	line-height: 1.5;
}

.wcpc-faq-answer:not([hidden]) {
	padding: 0 4px 12px;
}

.wcpc-faq-question:focus-visible,
.wcpc-notify-me-submit:focus-visible,
.wcpc-notify-me-email:focus-visible {
	outline: 3px solid #1d3557;
	outline-offset: 2px;
}

/* ---------------------------------------------------------------------
 * "Me prévenir de la disponibilité"
 * ------------------------------------------------------------------- */
.wcpc-notify-me {
	margin: 16px 0;
	padding: 12px;
	background: #f8f9fa;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
}

.wcpc-notify-me-intro {
	margin: 0 0 8px;
	font-size: 13px;
}

.wcpc-notify-me-form {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.wcpc-notify-me-email {
	width: 100%;
	box-sizing: border-box;
	padding: 8px 10px;
}

.wcpc-notify-me-submit {
	width: 100%;
	position: relative;
}

.wcpc-notify-me-submit.wcpc-is-loading {
	color: transparent;
	pointer-events: none;
}

.wcpc-notify-me-submit.wcpc-is-loading::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 14px;
	height: 14px;
	margin: -7px 0 0 -7px;
	border: 2px solid rgba(255, 255, 255, 0.5);
	border-top-color: #fff;
	border-radius: 50%;
	animation: wcpc-spin 0.6s linear infinite;
}

@keyframes wcpc-spin {
	to {
		transform: rotate(360deg);
	}
}

.wcpc-notify-me-message {
	margin: 8px 0 0;
	font-size: 13px;
	font-weight: 600;
}

/* #146c5e / #c1121f on white = ~6.3:1 / ~5.9:1 contrast (AA for normal text). */
.wcpc-notify-me-message.wcpc-success {
	color: #146c5e;
}

.wcpc-notify-me-message.wcpc-error {
	color: #c1121f;
}

/* ---------------------------------------------------------------------
 * Cart deposit hint
 * ------------------------------------------------------------------- */
.wcpc-deposit-hint {
	display: block;
	color: #6c757d;
	font-weight: 400;
}

/* ---------------------------------------------------------------------
 * Cart/checkout pre-order row — left border accent + small tag so the
 * grouping of pre-order vs. in-stock lines is genuinely visible, not
 * just true in DOM order.
 * ------------------------------------------------------------------- */
.wcpc-cart-item-row {
	border-left: 3px solid #1d3557;
	background: #f8f9fc;
}

.wcpc-cart-tag {
	display: inline-block;
	padding: 2px 8px;
	background: #1d3557;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	border-radius: 10px;
	line-height: 1.6;
}

.wcpc-cart-ship-date {
	display: inline-block;
	margin-top: 4px;
	color: #555;
}

/* Deposit/balance breakdown — legible, not cramped, on any width. */
.wcpc-payment-breakdown {
	display: block;
	margin-top: 6px;
	padding: 8px 10px;
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 4px;
}

.wcpc-pb-row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	font-size: 12px;
	line-height: 1.6;
}

.wcpc-pb-label {
	color: #555;
}

.wcpc-pb-value {
	font-weight: 700;
	color: #1d3557;
	white-space: nowrap;
}

.wcpc-pb-date {
	display: block;
	margin-top: 4px;
	font-size: 11px;
	color: #6c757d;
}

/* ---------------------------------------------------------------------
 * Mandatory pre-checkout legal block
 * ------------------------------------------------------------------- */
.wcpc-legal-block {
	margin: 15px 0;
	padding: 16px;
	border: 1px solid #ddd;
	border-radius: 6px;
	background: #fafafa;
}

.wcpc-legal-heading {
	margin: 0 0 10px;
	font-size: 16px;
}

.wcpc-legal-summary {
	margin: 0 0 8px;
	font-size: 14px;
	color: #222;
}

.wcpc-legal-fineprint {
	margin: 0 0 10px;
	font-size: 12px;
	line-height: 1.6;
	color: #666;
}

.wcpc-cgv-text {
	max-height: 150px;
	overflow: auto;
	padding: 10px;
	border: 1px solid #eee;
	border-radius: 4px;
	background: #fff;
	margin: 10px 0;
	font-size: 12px;
	color: #555;
	line-height: 1.6;
}

/* Generous touch target (WCAG 2.5.5 / 2.5.8) around the checkbox + its
 * full label text — the whole row is clickable, not just the 16px box. */
.wcpc-legal-checkbox-row {
	margin: 12px 0 0;
}

.wcpc-legal-checkbox-row label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	min-height: 44px;
	padding: 8px;
	margin: 0 -8px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 13px;
	line-height: 1.5;
}

.wcpc-legal-checkbox-row label:hover {
	background: rgba(29, 53, 87, 0.05);
}

.wcpc-legal-checkbox-row input[type="checkbox"] {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	margin-top: 1px;
}

.wcpc-legal-checkbox-text {
	flex: 1 1 auto;
}

.wcpc-legal-checkbox-row input:focus-visible {
	outline: 3px solid #1d3557;
	outline-offset: 2px;
}

/* RGPD opt-in — visually distinct from the mandatory legal ack above it
 * (never bundled together, per the "separate consent" requirement). */
.wcpc-rgpd-optin {
	border-top: 1px dashed #ddd;
	padding-top: 10px;
}

/* ---------------------------------------------------------------------
 * "Mes précommandes" (My Account) — order-status timeline table.
 * ------------------------------------------------------------------- */
.wcpc-orders-table {
	border-collapse: collapse;
}

.wcpc-orders-table th,
.wcpc-orders-table td {
	padding: 10px 8px;
	vertical-align: middle;
}

.wcpc-order-row + .wcpc-order-row {
	border-top: 1px solid #eee;
}

.wcpc-order-actions {
	white-space: nowrap;
}

.wcpc-order-actions .button {
	margin: 2px 4px 2px 0;
}

.wcpc-order-email-history td {
	padding: 4px 8px 14px;
	background: #fafafa;
}

.wcpc-order-email-history summary {
	cursor: pointer;
	color: #1d3557;
	font-size: 12px;
}

.wcpc-order-email-history ul {
	margin: 8px 0 0;
	padding-left: 18px;
	font-size: 12px;
	color: #555;
}

/* Retractation table (shortcode [wcpc_retractation_form]) — same
 * timeline-table look as "Mes précommandes". */
.wcpc-retractation-table {
	border-collapse: collapse;
	width: 100%;
}

.wcpc-retractation-table th,
.wcpc-retractation-table td {
	padding: 10px 8px;
	text-align: left;
	border-bottom: 1px solid #eee;
}

/* ---------------------------------------------------------------------
 * Mixed-cart shipping choice — clear selected state.
 * ------------------------------------------------------------------- */
.wcpc-mixed-cart-shipping-choice {
	margin: 15px 0;
	padding: 14px;
	border: 1px solid #ddd;
	border-radius: 6px;
}

.wcpc-mixed-cart-shipping-choice-intro {
	margin: 0 0 10px;
}

.wcpc-shipping-option {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 10px;
	margin-bottom: 8px;
	border: 2px solid #e0e0e0;
	border-radius: 6px;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.wcpc-shipping-option:hover {
	border-color: #adb5bd;
}

.wcpc-shipping-option input[type="radio"] {
	margin-top: 3px;
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
}

.wcpc-shipping-option input:focus-visible {
	outline: 3px solid #1d3557;
	outline-offset: 2px;
}

.wcpc-shipping-option-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.wcpc-shipping-option-title {
	font-weight: 700;
	color: #1d3557;
}

.wcpc-shipping-option-desc {
	font-size: 12px;
	color: #666;
}

/* CSS-only fallback selected state (progressive enhancement over the JS
 * toggle in wcpc-frontend.js, for the rare case JS fails to load). */
.wcpc-shipping-option:has(input:checked),
.wcpc-shipping-option-selected {
	border-color: #1d3557;
	background: rgba(29, 53, 87, 0.06);
}

/* ---------------------------------------------------------------------
 * Danger/secondary buttons for consequential actions (cancel/retract),
 * layered on top of WooCommerce's own `.button` base class rather than
 * a fully custom skin.
 * ------------------------------------------------------------------- */
.wcpc-btn-danger {
	color: #a12622 !important;
	border-color: #a12622 !important;
	background: #fff !important;
}

.wcpc-btn-danger:hover,
.wcpc-btn-danger:focus {
	color: #fff !important;
	background: #a12622 !important;
	border-color: #a12622 !important;
}

.wcpc-btn-danger:focus-visible {
	outline: 3px solid #a12622;
	outline-offset: 2px;
}

.wcpc-inline-form {
	display: inline-block;
}

/* ---------------------------------------------------------------------
 * "Mes précommandes" — status pills and paid/due amount emphasis.
 * Colour pairs below are the well-tested Bootstrap alert combinations
 * (all ≥ 4.5:1 contrast for small text).
 * ------------------------------------------------------------------- */
.wcpc-status-pill {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 12px;
	font-size: 12px;
	font-weight: 700;
	white-space: nowrap;
}

.wcpc-status-pending,
.wcpc-status-pre-balancedue {
	background: #fff3cd;
	color: #856404;
}

.wcpc-status-processing,
.wcpc-status-pre-shipped {
	background: #cce5ff;
	color: #004085;
}

.wcpc-status-on-hold,
.wcpc-status-refunded {
	background: #e2e3e5;
	color: #383d41;
}

.wcpc-status-completed,
.wcpc-status-pre-delivered {
	background: #d4edda;
	color: #155724;
}

.wcpc-status-cancelled,
.wcpc-status-failed {
	background: #f8d7da;
	color: #721c24;
}

.wcpc-status-pre-confirmed {
	background: #d1ecf1;
	color: #0c5460;
}

.wcpc-status-pre-preparing {
	background: #e6dbf8;
	color: #4b2e83;
}

.wcpc-amount {
	font-weight: 700;
}

.wcpc-amount-paid {
	color: #146c5e;
}

.wcpc-amount-due {
	color: #a15c00;
}

.wcpc-amount-none {
	font-weight: 400;
	color: #999;
}

/* ---------------------------------------------------------------------
 * Responsive breakpoints. WooCommerce/WP-admin convention: 782px and
 * 480px. Below 480px the countdown blocks shrink instead of wrapping
 * awkwardly, and the payment breakdown row stacks label/value instead
 * of forcing them onto one cramped line.
 * ------------------------------------------------------------------- */
@media (max-width: 480px) {
	.wcpc-countdown-block {
		min-width: 44px;
		padding: 5px 2px;
	}

	.wcpc-countdown-number {
		font-size: 16px;
	}

	.wcpc-countdown-unit {
		font-size: 9px;
	}

	.wcpc-pb-row {
		flex-direction: column;
		gap: 0;
	}

	.wcpc-shipping-option {
		flex-direction: row;
	}

	.wcpc-shipping-option-desc {
		font-size: 11px;
	}
}

/* ---------------------------------------------------------------------
 * Responsive: from tablet width up, allow a little more breathing room
 * ------------------------------------------------------------------- */
@media (min-width: 600px) {
	.wcpc-notify-me-form {
		flex-direction: row;
	}

	.wcpc-notify-me-email {
		flex: 1;
	}

	.wcpc-notify-me-submit {
		width: auto;
		white-space: nowrap;
	}
}
