/*
 * Beillova — trust blocks: checkout order-review additions, cart block sidebar, product page card.
 * Loaded on cart, checkout and product pages by ../beillova-trust-blocks.php, after the theme CSS.
 *
 *  1. variables
 *  3. shipping rows   (checkout, from cart-shipping.php)
 *  4. assurance block (trust list + payment logos, .mv-assurance, cart + checkout)
 *  5. checkout        (selectors start with .woocommerce-checkout)
 *  6. product page    (price row badge + "Achetez en toute confiance" card)
 *  7. cart block      (WooCommerce Cart block sidebar, .wc-block-cart__sidebar)
 */

/* ---- 1. Variables ---- */
:root {
	--mv-accent: #57a47e;
	--mv-accent-dark: #4a916c;
	--mv-ink: #111;
	--mv-muted: #7b7b7b;
	--mv-line: #ebe9e9;
	--mv-surface: #fff;
}


/* ---- 3. Shipping rows (cart-shipping.php) used in the checkout review table ---- */
.woocommerce-checkout-review-order-table .mv-row-name {
	display: block;
}

.woocommerce-checkout-review-order-table .mv-row-sub {
	display: block;
	margin-top: 3px;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.4;
	color: var(--mv-muted);
}

.woocommerce-checkout-review-order-table .mv-methods {
	list-style: none;
	margin: 6px 0 0;
	padding: 0;
}

.woocommerce-checkout-review-order-table .mv-methods li {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin: 0 0 4px;
	padding: 0;
	font-size: 13px;
	color: var(--mv-muted);
}

.woocommerce-checkout-review-order-table .mv-methods input {
	flex: none;
	margin: 0;
}

.woocommerce-checkout-review-order-table .mv-methods label {
	margin: 0;
	font-weight: 400;
	cursor: pointer;
}

.woocommerce-checkout-review-order-table .mv-method-cost {
	margin-left: 4px;
	color: var(--mv-ink);
	font-weight: 500;
}

.woocommerce-checkout-review-order-table .mv-method-cost .amount {
	font-size: inherit;
	color: inherit;
}

/* ---- 4. Assurance block: trust list ---- */
.mv-assurance .mv-trust {
	list-style: none;
	margin: 26px 0 0;
	padding: 0;
}

.mv-assurance .mv-trust__item {
	display: flex;
	align-items: center;
	gap: 22px;
	margin: 0;
	padding: 0 0 13px;
}

.mv-assurance .mv-trust__icon {
	flex: none;
	display: block;
	width: 32px;
	height: 32px;
	color: #1a1a1a;
}

.mv-assurance .mv-trust__icon svg {
	display: block;
	width: 32px;
	height: 32px;
}

.mv-assurance .mv-wheel {
	fill: var(--mv-surface);
}

.mv-assurance .mv-trust__text {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
	font-size: 13.5px;
	line-height: 1.35;
}

.mv-assurance .mv-trust__text strong {
	font-weight: 500;
	color: var(--mv-ink);
}

.mv-assurance .mv-trust__text span {
	color: var(--mv-muted);
}

.mv-assurance .mv-trust__logo {
	flex: none;
	display: block;
	width: 104px;
	max-width: 36%;
	height: auto;
	margin: 0 0 0 auto;
}

/* ---- Payment logos (shared: cart, checkout, product card) ----
 * --mv-s scales all four logos; they sit close together on the left like in the design. */
.mv-pay {
	--mv-s: 0.8;

	margin: 0;
	padding: 18px 0 0;
	border-top: 1px solid var(--mv-line);
}

.mv-pay .mv-pay__title {
	margin: 0 0 10px;
	font-size: 13.5px;
	font-weight: 500;
	line-height: 1.3;
	color: var(--mv-ink);
}

.mv-pay .mv-pay__logos {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-start;
	gap: 10px calc(18px * var(--mv-s));
	list-style: none;
	margin: 0;
	padding: 0;
}

.mv-pay .mv-pay__logo {
	margin: 0;
	padding: 0;
	line-height: 0;
}

.mv-pay .mv-pay__logo img {
	display: block;
	width: auto;
	max-width: 100%;
	height: calc(34px * var(--mv-s));
}

.mv-pay .mv-pay__logo--mastercard img {
	height: calc(34px * var(--mv-s));
}

.mv-pay .mv-pay__logo--visa img {
	height: calc(22px * var(--mv-s));
}

.mv-pay .mv-pay__logo--idcheck img {
	height: calc(28px * var(--mv-s));
}

.mv-pay .mv-pay__logo--vsecure img {
	height: calc(34px * var(--mv-s));
}

.mv-pay .mv-pay__logo--cb img {
	height: calc(30px * var(--mv-s));
}

/* Astra gives every image on single pages a 30px shadow (.ast-article-single img); the logos must stay flat */
.mv-assurance img,
.mv-pay img,
.mv-price-row img,
.mv-product-trust img {
	box-shadow: none !important;
	filter: none !important;
	border-radius: 0 !important;
	background: none !important;
}

/* ---- Footnote (cart) ---- */
.mv-assurance .mv-secure-note {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 18px 0 0;
	font-size: 12.5px;
	line-height: 1.4;
	color: var(--mv-muted);
}

.mv-assurance .mv-secure-note svg {
	flex: none;
	width: 16px;
	height: 16px;
}

/* ---- Small screens ---- */
@media (max-width: 575px) {
	.woocommerce-cart .cart_totals.mv-cart-summary {
		padding: 26px 20px 24px;
	}

	.mv-assurance .mv-trust__logo {
		width: 88px;
	}
}

/* ---- 5. Checkout ---- */

/* Totale: bold label, larger amount */
.woocommerce-checkout .woocommerce-checkout-review-order-table tfoot tr.order-total th {
	font-weight: 600;
	color: var(--mv-ink);
}

.woocommerce-checkout .woocommerce-checkout-review-order-table tfoot tr.order-total td,
.woocommerce-checkout .woocommerce-checkout-review-order-table tfoot tr.order-total td strong,
.woocommerce-checkout .woocommerce-checkout-review-order-table tfoot tr.order-total td .amount {
	font-size: 18px;
	font-weight: 700;
	color: var(--mv-ink);
}

.woocommerce-checkout .woocommerce-checkout-review-order-table tfoot tr.order-total td .includes_tax,
.woocommerce-checkout .woocommerce-checkout-review-order-table tfoot tr.order-total td .includes_tax .amount {
	font-size: 12px;
	font-weight: 400;
	color: var(--mv-muted);
}

/* Trust list rows are separated by thin dividers, the logos follow without extra border */
/* the review table above carries a 24px bottom margin; pull the list closer like in the design */
.mv-assurance--checkout {
	margin: -14px 0 22px;
}

.mv-assurance--checkout .mv-trust {
	margin: 0;
}

.mv-assurance--checkout .mv-trust__item {
	padding: 12px 0;
	border-bottom: 1px solid var(--mv-line);
}

.mv-assurance--checkout .mv-pay {
	--mv-s: 1;

	padding-top: 18px;
	border-top: 0;
}

/* ---- 6. Product page ---- */

/* price block + Poste Italiane badge on the right */
.mv-price-row {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 8px 16px;
}

.mv-price-row .mv-price-row__main {
	flex: 1 1 auto;
	min-width: 0;
}

.mv-price-row .mv-price-row__poste {
	flex: none;
	margin: 6px 0 0;
	line-height: 0;
}

.mv-price-row .mv-price-row__poste img {
	display: block;
	width: 112px;
	height: auto;
}

/* "Achetez en toute confiance" card */
.mv-product-trust {
	--mv-surface: #fcf6f5;

	box-sizing: border-box;
	margin: 4px 0 22px;
	padding: 20px 22px 22px;
	background: var(--mv-surface);
	border: 1px solid #f0e4e2;
	border-radius: 8px;
	color: var(--mv-ink);
	container-type: inline-size;
}

.mv-product-trust .mv-product-trust__title {
	margin: 0 0 16px;
	font-size: 18px;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0;
	text-transform: none;
	color: var(--mv-ink);
}

.mv-product-trust .mv-product-trust__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 18px 20px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.mv-product-trust .mv-product-trust__item {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0;
	padding: 0;
}

.mv-product-trust .mv-product-trust__icon {
	flex: none;
	display: block;
	width: 32px;
	height: 32px;
	color: #1a1a1a;
}

.mv-product-trust .mv-product-trust__icon svg {
	display: block;
	width: 32px;
	height: 32px;
}

.mv-product-trust .mv-wheel {
	fill: var(--mv-surface);
}

.mv-product-trust .mv-product-trust__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	font-size: 13.5px;
	line-height: 1.35;
}

.mv-product-trust .mv-product-trust__text strong {
	font-weight: 600;
	color: var(--mv-ink);
}

.mv-product-trust .mv-product-trust__text span {
	color: var(--mv-muted);
}

.mv-product-trust .mv-pay {
	--mv-s: 1;

	margin-top: 20px;
	padding-top: 16px;
	border-top: 1px dashed #e6d9d7;
}

.mv-product-trust .mv-pay .mv-pay__logos {
	gap: 10px 28px;
}

/* Narrow card (phones, tablets, narrow columns): one column of facts, tighter logos */
@container (max-width: 380px) {
	.mv-product-trust .mv-product-trust__grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.mv-product-trust .mv-pay .mv-pay__logos {
		gap: 10px 16px;
	}
}

@media (max-width: 420px) {
	.mv-product-trust {
		padding: 18px 16px 18px;
	}

	.mv-product-trust .mv-product-trust__grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Narrow phones: scale the logos down so all four stay on one row */
@media (max-width: 480px) {
	.mv-pay,
	.mv-assurance--checkout .mv-pay,
	.mv-product-trust .mv-pay {
		--mv-s: 0.7;
	}
}


/* ---- 7. Cart block (WooCommerce Cart block sidebar) ----
 * The block is React-rendered: the markup is WooCommerce's, only its look is changed here.
 * The checkout button keeps the theme's own colors. */
.wp-block-woocommerce-cart .wc-block-cart__sidebar.wc-block-components-sidebar {
	--mv-surface: #fcfaf9;

	box-sizing: border-box;
	align-self: flex-start;
	background: var(--mv-surface);
	border: 1px solid #e8e6e5;
	border-radius: 8px;
	padding: 28px 30px 26px;
	color: var(--mv-ink);
}

/* "Totale carrello" -> "Récapitulatif de la commande" */
.wc-block-cart__sidebar .wc-block-cart__totals-title {
	display: block;
	margin: 0 0 6px;
	padding: 0;
	border: 0;
	font-size: 0 !important;
	line-height: 0 !important;
	text-align: left;
	text-transform: none;
}

.wc-block-cart__sidebar .wc-block-cart__totals-title::before {
	content: "Récapitulatif de la commande";
	display: block;
	font-size: 18px !important;
	font-weight: 500;
	line-height: 1.3 !important;
	letter-spacing: 0;
	text-transform: none !important;
	color: var(--mv-ink);
}

/* rows */
.wc-block-cart__sidebar .wc-block-components-totals-wrapper {
	padding: 12px 0;
	border-color: var(--mv-line);
}

.wc-block-cart__sidebar .wc-block-components-totals-item__label {
	font-size: 14px;
	font-weight: 400;
	color: var(--mv-ink);
}

.wc-block-cart__sidebar .wc-block-components-totals-item__value {
	font-size: 15px;
	font-weight: 600;
	color: var(--mv-ink);
}

/* Totale */
.wc-block-cart__sidebar .wc-block-components-totals-footer-item .wc-block-components-totals-item__label {
	font-size: 16px;
	font-weight: 600;
}

.wc-block-cart__sidebar .wc-block-components-totals-footer-item .wc-block-components-totals-item__value,
.wc-block-cart__sidebar .wc-block-components-totals-footer-item .wc-block-components-totals-footer-item-tax-value {
	font-size: 19px;
	font-weight: 700;
}

/* checkout button: full width, arrow after the label (colors come from the theme) */
.wc-block-cart__sidebar .wc-block-cart__submit-container {
	margin-top: 8px;
}

.wc-block-cart__sidebar .wc-block-cart__submit-button .wc-block-components-button__text::after {
	content: "";
	display: inline-block;
	width: 20px;
	height: 20px;
	margin-left: 10px;
	vertical-align: -4px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 12h17M14 5.5l6.5 6.5-6.5 6.5'/%3E%3C/svg%3E") no-repeat center / contain;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 12h17M14 5.5l6.5 6.5-6.5 6.5'/%3E%3C/svg%3E") no-repeat center / contain;
}

@media (max-width: 575px) {
	.wp-block-woocommerce-cart .wc-block-cart__sidebar.wc-block-components-sidebar {
		padding: 22px 18px 20px;
	}
}

/* ---- CheckoutChamp gateway: empty payment box ----
 * The gateway redirects on submit and prints only a <style> and a <script> inside its payment box, which
 * leaves an empty grey bar with an arrow under the order table. Hide the box (and the list around it when it
 * is the only method) only while it holds nothing but style/script; its script keeps running, and the hidden
 * radio is still submitted. If the gateway ever shows a description or fields the box stays visible. */
.woocommerce-checkout #payment ul.payment_methods:has(> li.payment_method_ccpro-gateway:only-child > .payment_box:not(:has(> :not(style):not(script)))) {
	display: none !important;
}

.woocommerce-checkout #payment li.payment_method_ccpro-gateway > .payment_box:not(:has(> :not(style):not(script))) {
	display: none !important;
}
