/* Shipping-cost calculator (Octolize "Shipping Cost on Product Page")
 *
 * Surfaced on the custom PDP via woocommerce_after_add_to_cart_form (see
 * patterns/single-product.php) and restyled to the Bollaert blue/white theme.
 * Octolize ships the container with an inline display:none meant for the
 * standard WooCommerce product template and relies on form.cart for the product
 * id; the PDP fires the hook itself, injects the product id, and we force the
 * calculator visible + on-brand here. Everything is scoped to
 * .bollaert-pdp__shipping so the plugin's own markup is never touched. */

.bollaert-pdp__shipping {
	margin-top: 1.25rem;
}

/* The card. `display:block !important` overrides Octolize's inline display:none
 * (an inline rule with no !important, so a stylesheet !important wins). */
.bollaert-pdp__shipping .scpp-shipping-calculator-container {
	display: block !important;
	margin: 0 !important;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 14px;
	background: var(--wp--preset--color--white);
	padding: 1rem 1.15rem;
}

/* Toggle: "Calculer les frais d'expédition" — a clear brand link with a truck */
.bollaert-pdp__shipping .scpp-calculator-open-button {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	margin: 0 !important;
	padding: 0 !important;
	color: var(--wp--preset--color--brand-dark) !important;
	font-size: 1rem !important;
	font-weight: 700;
	line-height: 1.3 !important;
	text-decoration: none !important;
	cursor: pointer;
}
.bollaert-pdp__shipping .scpp-calculator-open-button:hover {
	color: var(--wp--preset--color--brand) !important;
}
.bollaert-pdp__shipping .scpp-calculator-open-button::before {
	content: "";
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	background: no-repeat center / contain
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23287a9e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 3h15v13H1zM16 8h4l3 3v5h-7'/%3E%3Ccircle cx='5.5' cy='18.5' r='2.5'/%3E%3Ccircle cx='18.5' cy='18.5' r='2.5'/%3E%3C/svg%3E");
}

/* The form (revealed when the toggle adds .active) */
.bollaert-pdp__shipping .scpp-calculator-container {
	margin-top: 0.85rem !important;
	max-width: none !important;
	gap: 0.6rem;
}
.bollaert-pdp__shipping .scpp-calculator-container > p {
	margin: 0 0 0.4rem !important;
	color: var(--wp--preset--color--muted) !important;
	font-style: normal !important;
	font-size: 0.9rem !important;
}

/* Postcode field + fr-fix commune <select> */
.bollaert-pdp__shipping input[name="calc_shipping_postcode"],
.bollaert-pdp__shipping .bollaert-city-choice {
	width: 100% !important;
	max-width: 320px !important;
	box-sizing: border-box !important;
	border: 1px solid var(--wp--preset--color--border) !important;
	border-radius: 10px !important;
	padding: 0.6em 0.85em !important;
	font-size: 0.95rem !important;
	line-height: 1.4 !important;
	color: var(--wp--preset--color--text) !important;
	background: var(--wp--preset--color--white) !important;
}
.bollaert-pdp__shipping input[name="calc_shipping_postcode"]:focus,
.bollaert-pdp__shipping .bollaert-city-choice:focus {
	border-color: var(--wp--preset--color--brand) !important;
	box-shadow: 0 0 0 3px var(--wp--preset--color--brand-tint) !important;
	outline: none !important;
}

/* fr-fix feedback line (✓ commune — département / errors) */
.bollaert-pdp__shipping .bollaert-postcode-feedback {
	font-size: 0.88rem;
	margin-top: 0.35rem;
}
.bollaert-pdp__shipping .bollaert-postcode-feedback.is-info {
	color: var(--wp--preset--color--brand-dark);
}
.bollaert-pdp__shipping .bollaert-postcode-feedback.is-error {
	color: var(--wp--preset--color--danger);
}
.bollaert-pdp__shipping .bollaert-city-choice-wrap label {
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--wp--preset--color--text);
}

/* "Calculer" button — filled brand pill */
.bollaert-pdp__shipping .scpp-calculate-button {
	display: inline-block;
	margin: 0.5rem 0 0 !important;
	padding: 0.6em 1.5em !important;
	border-radius: 999px !important;
	background: var(--wp--preset--color--brand);
	color: var(--wp--preset--color--white) !important;
	font-weight: 700;
	font-size: 0.95rem !important;
	line-height: 1.2 !important;
	text-decoration: none !important;
	transition: background-color 0.15s ease;
}
.bollaert-pdp__shipping .scpp-calculate-button:hover {
	background: var(--wp--preset--color--brand-dark);
}

/* Results panel: the computed shipping cost */
.bollaert-pdp__shipping .scpp-results-container {
	margin-top: 0.85rem;
	padding: 0.8rem 1rem !important;
	border-radius: 12px;
	background: var(--wp--preset--color--brand-tint) !important;
	border: 1px solid var(--wp--preset--color--border);
	font-size: 0.95rem !important;
	color: var(--wp--preset--color--text);
}
.bollaert-pdp__shipping .scpp-results-container p { margin: 0 !important; }
.bollaert-pdp__shipping .scpp-results-container ul {
	margin: 0.4rem 0 0 !important;
	padding-left: 1.1rem;
}
.bollaert-pdp__shipping .scpp-results-container li {
	color: var(--wp--preset--color--brand-dark) !important;
	font-weight: 700;
}
.bollaert-pdp__shipping .scpp-calculator-errors-container p {
	color: var(--wp--preset--color--danger) !important;
}

/* "Saisir une autre adresse" link under the result */
.bollaert-pdp__shipping .js--scpp-different-address-container {
	margin-top: 0.5rem;
}
.bollaert-pdp__shipping .js--scpp-different-address-container a {
	color: var(--wp--preset--color--brand-dark) !important;
	font-size: 0.88rem;
	font-weight: 600;
	text-decoration: underline !important;
}
