/**
 * Cart and checkout, repainted for the dark palette.
 *
 * WooCommerce and Astra both style the cart for a light theme: the totals
 * panel, the shop table's header row and the order-review box are given white
 * or near-white backgrounds. The site's text colour is #EDF6F3, so those
 * panels rendered near-white text on white - "Cart Totals" and the
 * Product/Price/Quantity/Subtotal header row were effectively invisible.
 *
 * Everything here repaints a surface that was assumed to be light. Tokens come
 * from the child theme's style.css.
 */

/* Astra paints WooCommerce container headings - "Cart totals", "Billing
   details", "Your order" - from its own variable, which is a near-white
   #fbfbfb regardless of the site palette. That is what put a white bar behind
   the white "Cart totals" heading. Redefining the variable fixes every heading
   that uses it at once, rather than chasing each selector. */
/* `html:root` rather than a bare `:root`: Astra prints its variable block
   inline in the head, which would otherwise win on source order. */
html:root,
html:root body {
	--ast-wc-container-head-bg-color: var(--ast-global-color-4, #1C2A3C);
	--ast-widget-bg-color: var(--ast-global-color-4, #1C2A3C);
}

/* ---------------------------------------------------------------------------
   Shop table (cart line items, order review)
   --------------------------------------------------------------------------- */

.woocommerce table.shop_table,
.woocommerce-page table.shop_table {
	border: 1px solid var(--sd-border, rgba(237, 246, 243, .14));
	border-radius: 8px;
	border-collapse: separate;
	background: var(--sd-surface, #1C2A3C);
	color: var(--ast-global-color-3, #EDF6F3);
}

/* The header row is the worst offender: Astra paints it #fff and leaves the
   inherited near-white text on top. */
.woocommerce table.shop_table thead th,
.woocommerce-page table.shop_table thead th,
.woocommerce table.shop_table th,
.woocommerce-page table.shop_table th {
	background: var(--sd-surface-hover, #223449);
	color: #fff;
	font-weight: 600;
	border-bottom: 1px solid var(--sd-border, rgba(237, 246, 243, .14));
}

.woocommerce table.shop_table td,
.woocommerce-page table.shop_table td {
	background: transparent;
	color: var(--ast-global-color-3, #EDF6F3);
	border-top: 1px solid var(--sd-border, rgba(237, 246, 243, .14));
}

.woocommerce table.shop_table tbody tr:first-child td {
	border-top: 0;
}

/* ---------------------------------------------------------------------------
   Cart totals / order review panel
   --------------------------------------------------------------------------- */

.woocommerce .cart_totals,
.woocommerce-page .cart_totals,
.woocommerce .cart-collaterals .cart_totals,
#order_review,
.woocommerce-checkout-review-order {
	background: var(--sd-surface, #1C2A3C);
	border: 1px solid var(--sd-border, rgba(237, 246, 243, .14));
	border-radius: 8px;
	color: var(--ast-global-color-3, #EDF6F3);
}

/* "Cart Totals" itself - a white heading that was sitting on a white bar. */
.woocommerce .cart_totals h2,
.woocommerce-page .cart_totals h2,
.woocommerce .cart-collaterals h2,
.woocommerce-page .cart-collaterals h2,
.woocommerce .cross-sells h2,
.woocommerce-checkout h3,
#order_review_heading {
	background: var(--sd-surface-hover, #223449);
	color: #fff;
	margin: 0;
	padding: 1.25rem 1.5rem;
	font-size: 1.25rem;
	border-bottom: 1px solid var(--sd-border, rgba(237, 246, 243, .14));
}

.woocommerce .cart_totals table.shop_table,
.woocommerce-page .cart_totals table.shop_table {
	border: 0;
	border-radius: 0;
	background: transparent;
}

.woocommerce .cart_totals table.shop_table th {
	background: transparent;
	color: var(--sd-text-muted, rgba(237, 246, 243, .72));
	font-weight: 500;
}

/* ---------------------------------------------------------------------------
   Form fields
   --------------------------------------------------------------------------- */

.woocommerce .quantity input[type="number"],
.woocommerce input[type="text"],
.woocommerce input[type="email"],
.woocommerce input[type="tel"],
.woocommerce input[type="password"],
.woocommerce textarea,
.woocommerce select,
.woocommerce .select2-container .select2-selection {
	background: var(--ast-global-color-5, #111A28);
	border: 1px solid var(--sd-border-strong, rgba(237, 246, 243, .28));
	border-radius: 4px;
	color: var(--ast-global-color-3, #EDF6F3);
}

.woocommerce input::placeholder,
.woocommerce textarea::placeholder {
	color: rgba(237, 246, 243, .45);
}

.woocommerce input:focus-visible,
.woocommerce textarea:focus-visible,
.woocommerce select:focus-visible {
	border-color: var(--ast-global-color-0, #21B4A6);
	outline: 2px solid rgba(33, 180, 166, .35);
	outline-offset: 1px;
}

/* ---------------------------------------------------------------------------
   Notices ("... has been added to your cart")
   --------------------------------------------------------------------------- */

.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
	background: var(--sd-surface, #1C2A3C);
	border-top: 3px solid var(--ast-global-color-0, #21B4A6);
	border-radius: 6px;
	color: var(--ast-global-color-3, #EDF6F3);
}

.woocommerce-error {
	border-top-color: #e2564d;
}

.woocommerce-message a,
.woocommerce-info a {
	color: var(--ast-global-color-0, #21B4A6);
}

/* ---------------------------------------------------------------------------
   Shipping row
   --------------------------------------------------------------------------- */

/* Every shipping method is disabled while Montonio verifies the store, so the
   row carries a plain sentence (see class-cart-tweaks.php) rather than a
   prompt to enter an address that cannot return a rate. */
.woocommerce-shipping-totals td,
.woocommerce-shipping-destination {
	color: var(--sd-text-muted, rgba(237, 246, 243, .72));
}

.woocommerce-shipping-calculator a,
.shipping-calculator-button {
	color: var(--ast-global-color-0, #21B4A6);
}

/* A product with no featured image falls back to Woo's placeholder, which is a
   light PNG on a light background; the surface tint keeps it from flaring. */
.woocommerce table.shop_table td.product-thumbnail img {
	border-radius: 4px;
	background: var(--sd-surface-hover, #223449);
}

/* ---------------------------------------------------------------------------
   Montonio (payment icons, pickup-point picker)
   --------------------------------------------------------------------------- */

/* The Montonio logo mark is dark artwork with a transparent background, so on
   the dark surface it vanished. A light chip behind it keeps it readable. */
img.montonio-payment-method-icon {
	background: #fff;
	border-radius: 4px;
	padding: 3px 6px;
	box-sizing: content-box;
	vertical-align: middle;
}

/* Pickup-point search: Montonio forces a white field with light-grey text.
   Match the other form fields instead. Its magnifier is drawn in dark navy,
   so it is redrawn in the site's light text colour. */
.montonio-pickup-point__search-input,
.choices .choices__input {
	background-color: var(--ast-global-color-5, #111A28) !important;
	border: 1px solid var(--sd-border-strong, rgba(237, 246, 243, .28)) !important;
	color: var(--ast-global-color-3, #EDF6F3) !important;
	background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none"><path d="M19 19L14.65 14.65M17 9C17 13.4183 13.4183 17 9 17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1C13.4183 1 17 4.58172 17 9Z" stroke="%23EDF6F3" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>') !important;
}

.montonio-pickup-point__search-input::placeholder {
	color: rgba(237, 246, 243, .55);
}

.montonio-pickup-point__search-input:focus {
	border-color: var(--ast-global-color-0, #21B4A6) !important;
}

.montonio-pickup-point__dropdown,
.choices__list--dropdown,
.choices__list[aria-expanded] {
	background: var(--sd-surface, #1C2A3C);
	border-color: var(--sd-border-strong, rgba(237, 246, 243, .28));
	color: var(--ast-global-color-3, #EDF6F3);
}

.montonio-pickup-point__option {
	border-bottom-color: var(--sd-border, rgba(237, 246, 243, .14));
}

.montonio-pickup-point__option:hover,
.choices__list--dropdown .choices__item--selectable.is-highlighted {
	background-color: rgba(33, 180, 166, .14);
}

.montonio-pickup-point__option-name {
	color: var(--ast-global-color-3, #EDF6F3);
}

.montonio-pickup-point__option-address,
.montonio-pickup-point__loading,
.montonio-pickup-point__no-results {
	color: var(--sd-text-muted, rgba(237, 246, 243, .72));
}

/* Legacy Choices.js dropdown variant. */
.choices__inner {
	background: var(--ast-global-color-5, #111A28);
	border-color: var(--sd-border-strong, rgba(237, 246, 243, .28));
	color: var(--ast-global-color-3, #EDF6F3);
}
