/*
 * Gravipack checkout, My Account > Adresses and the Devis form: address suggestions (combobox),
 * postcode/city and « adresse introuvable » notes, and the professional checkout note.
 * Also the Pro cart quote line (loaded on the cart in the Professionnels world only, b2b.php) and the
 * terms line of the Devis form.
 * Light "paper" view tokens with fallbacks. The Devis address field itself is styled in forms.css.
 */

/* The combobox wrapper: WooCommerce's span.woocommerce-input-wrapper, or the field box of the Devis form
   (.gp-address__control). A .gp-field wrapper keeps its grid, so its label and error keep their 6 px gaps. */
.gp-combo {
	position: relative;
}

.gp-combo:not(.gp-field) {
	display: block;
}

.gp-combo__list {
	position: absolute;
	z-index: 60;
	top: calc(100% + 4px);
	right: 0;
	left: 0;
	max-height: 18rem;
	margin: 0;
	padding: 4px;
	overflow-y: auto;
	list-style: none;
	color: var(--paper-ink, #121316);
	background: var(--paper, #fff);
	border: 1px solid var(--paper-line, #c9c9c4);
	border-radius: var(--radius-s, 12px);
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
}

.gp-combo__list[hidden] {
	display: none;
}

.gp-combo__opt {
	display: block;
	min-height: 44px;
	box-sizing: border-box;
	margin: 0;
	padding: 9px 12px;
	line-height: 1.3;
	border-left: 3px solid transparent;
	border-radius: 8px;
	cursor: pointer;
}

@media (hover: hover) {
	.gp-combo__opt:hover {
		background: var(--paper-2, #ecebe5);
	}
}

/* Active option: background, side bar and outline, so it never relies on colour alone. */
.gp-combo__opt[aria-selected="true"] {
	background: var(--paper-2, #ecebe5);
	border-left-color: currentColor;
	outline: 2px solid currentColor;
	outline-offset: -2px;
}

.gp-combo__main {
	display: block;
	font-weight: 600;
}

.gp-combo__sub {
	display: block;
	font-size: 0.875em;
	color: var(--paper-muted, #55554f);
}

.gp-combo__source {
	margin: 0;
	padding: 6px 12px 2px;
	font-size: 0.75em;
	color: var(--paper-muted, #55554f);
}

@media (prefers-reduced-motion: no-preference) {
	.gp-combo__list:not([hidden]) {
		animation: gp-combo-in 0.18s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
	}
}

@keyframes gp-combo-in {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
}

.gp-address-hint {
	display: block;
}

.gp-address-hint__msg:not(:empty) {
	display: block;
	margin-top: 6px;
	padding: 8px 10px;
	font-size: 0.9em;
	line-height: 1.4;
	border-left: 3px solid currentColor;
	background: var(--paper-2, #ecebe5);
	border-radius: 4px;
}

.gp-address-hint__label {
	font-weight: 700;
}

.gp-b2b-checkout-note {
	margin: 0 0 18px;
	padding: 12px 16px;
	border: 1px solid var(--paper-line, #c9c9c4);
	border-radius: var(--radius-s, 12px);
}

/* Pro cart: « Besoin d’un devis pour ce panier ? Demander un devis », under the totals and the checkout button. */
.gp-cart-quote {
	margin: 16px 0 0;
	padding-top: 6px;
	border-top: 1px solid var(--paper-line, #c9c9c4);
	font-size: 0.9375em;
	line-height: 1.5;
	text-align: center;
	text-wrap: balance;
}

.gp-cart-quote__link {
	display: inline-block;
	padding: 11px 2px; /* 44 px tall target */
	font-weight: 600;
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

@media (hover: hover) {
	.gp-cart-quote__link:hover {
		text-decoration-thickness: 2px;
	}
}

.gp-cart-quote__link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
	border-radius: 4px;
}

/* Devis form: terms line above the privacy line (volume orders, CGV Professionnels). */
.gp-form__terms {
	margin: 0;
	font-size: 0.875em;
}

.gp-form__terms a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.gp-combo .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* WooCommerce's checkout.js hides the shipping address (and the account password box) after the page has loaded
   when their box is unticked: until then the 640 px block shows and everything under it, « Informations
   complémentaires » included, moves up (CLS 0.03 to 0.05 on desktop). Hidden from the first paint instead. Once
   checkout.js runs it sets an inline display, so its slideDown and slideUp work as before. */
.woocommerce-shipping-fields:has(#ship-to-different-address-checkbox:not(:checked)) .shipping_address,
.woocommerce-account-fields:has(#createaccount:not(:checked)) div.create-account {
	display: none;
}
