/**
 * Shared frontend tokens for WooCommerce VAT Display Toggle.
 */

:root {
	--hz-vat-color-text: #1a1a1a;
	--hz-vat-color-muted: #5c5c5c;
	--hz-vat-color-border: #cfcfcf;
	--hz-vat-color-surface: #ffffff;
	--hz-vat-color-active-bg: #1a1a1a;
	--hz-vat-color-active-text: #ffffff;
	--hz-vat-color-focus: #0b57d0;
	--hz-vat-radius: 4px;
	--hz-vat-gap: 0.25rem;
	--hz-vat-font-size: 0.875rem;
	--hz-vat-transition: 150ms ease;
}

.hz-vat-mode-meta {
	display: none !important;
}

/* Full-page loader while VAT mode + prices refresh */
.hz-vat-page-loader {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	background: rgba(255, 255, 255, 0.55);
	backdrop-filter: blur(1px);
	-webkit-backdrop-filter: blur(1px);
}

.hz-vat-page-loader[hidden] {
	display: none !important;
}

.hz-vat-page-loader__panel {
	display: inline-flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.85rem 1.15rem;
	border: 1px solid #e2e2e2;
	border-radius: 8px;
	background: #ffffff;
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
	color: #1a1a1a;
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1.2;
}

.hz-vat-page-loader__spinner {
	flex: 0 0 auto;
	width: 1.15rem;
	height: 1.15rem;
	border: 2px solid #d4d4d4;
	border-top-color: #1a1a1a;
	border-radius: 50%;
	animation: hz-vat-spin 0.7s linear infinite;
}

.hz-vat-page-loader__text {
	white-space: nowrap;
}

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

@media (prefers-reduced-motion: reduce) {
	.hz-vat-page-loader__spinner {
		animation: none;
		border-top-color: #d4d4d4;
		border-right-color: #1a1a1a;
	}
}

body.hz-vat-price-updating {
	cursor: wait;
}

/* Keep the switch readable above the overlay so the state change is visible */
body.hz-vat-price-updating .hz-vat-toggle {
	position: relative;
	z-index: 100001;
	pointer-events: none;
}

/* Incl./Excl. BTW marker next to classic cart line amounts */
.hz-vat-cart-mode-label {
	display: inline-block;
	margin-left: 0.35em;
	font-size: 0.8em;
	font-weight: 400;
	line-height: 1;
	white-space: nowrap;
	opacity: 0.7;
}

/* Cart / checkout totals: emphasize grand total (reference layout). */
:root {
	--hz-vat-total-color: #3a9d3f;
}

.woocommerce-cart .cart_totals .order-total .amount,
.woocommerce-cart .cart_totals .order-total .woocommerce-Price-amount,
.woocommerce-cart .cart_totals .order-total .hz-vat-includes-tax,
.woocommerce-checkout .order-total .amount,
.woocommerce-checkout .order-total .woocommerce-Price-amount,
.woocommerce-checkout .order-total .hz-vat-includes-tax {
	color: var(--hz-vat-total-color);
}

.woocommerce-cart .cart_totals .order-total .hz-vat-includes-tax,
.woocommerce-checkout .order-total .hz-vat-includes-tax {
	font-size: 0.85em;
	font-weight: 400;
}

.woocommerce-cart .cart_totals .tax-rate th,
.woocommerce-checkout .tax-rate th {
	font-weight: 700;
}

/* Blocks cart totals breakdown injected by blocks-totals.js (cart only) */
.hz-vat-blocks-totals {
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
	margin: 0 0 1rem;
	padding: 0.75rem 0 1rem;
	border: 0;
	border-bottom: 1px solid hsla(0, 0%, 7%, 0.11);
}

/* Never show our injected breakdown inside checkout order summary */
.wp-block-woocommerce-checkout-order-summary-block .hz-vat-blocks-totals,
.wc-block-checkout .hz-vat-blocks-totals,
.woocommerce-checkout .hz-vat-blocks-totals {
	display: none !important;
}

/* Cart: hide native tax/subtotal blocks we mark as duplicates */
.wp-block-woocommerce-cart-order-summary-block [data-hz-vat-hidden="1"],
.wp-block-woocommerce-cart-totals-block [data-hz-vat-hidden="1"] {
	display: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	min-height: 0 !important;
}

/*
 * Double line above Subtotal = coupon panel bottom border
 * + .cart-order-summary-totals-block border-top. Keep one separator only.
 */
.wp-block-woocommerce-cart-order-summary-block
	.wp-block-woocommerce-cart-order-summary-totals-block {
	border-top: none !important;
}

.wp-block-woocommerce-cart-order-summary-block
	.wp-block-woocommerce-cart-order-summary-taxes-block,
.wp-block-woocommerce-cart-order-summary-block
	.wp-block-woocommerce-cart-order-summary-subtotal-block,
.wp-block-woocommerce-cart-order-summary-block
	.wc-block-components-totals-taxes {
	display: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	min-height: 0 !important;
}

.hz-vat-blocks-totals__row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	font-size: 1em;
}

.hz-vat-blocks-totals__tax .hz-vat-blocks-totals__label {
	font-weight: 700;
}

.hz-vat-blocks-totals__value {
	text-align: right;
	white-space: nowrap;
}
