/*
 Theme Name:   Fendix Theme Child
 Description:  Child theme for Fendix Theme
 Template:     fendix-theme-woo
 Version:      1.1.0
 Text Domain:  fendix-theme-woo-child
*/

/* =============================================================================
   CSS CUSTOM PROPERTIES
   Overrides and extensions of the parent theme's :root.
   Parent defines: --accent, --accent-2, --bg, --card, --text, --muted,
                   --shadow, --border, --border-light.
   We correct --accent here (was #e63946, confirmed brand value is #d1392e)
   and add tokens the parent doesn't define.
   ============================================================================= */
:root {
  /* Correct parent's mismatched accent — confirmed brand red */
  --accent:   #d1392e;
  --accent-2: #b71c1c;   /* hover / dark variant */

  /* Tokens not defined in parent — used in child overrides below */
  --bg-white:     #ffffff;
  --bg-light:     #f8f8f8;
  --bg-lighter:   #f9f9f9;
  --bg-field:     #f1f1f1;
  --border-color: #eee;
  --border-mid:   #ddd;
  --radius-sm:    4px;
  --radius:       6px;
  --radius-md:    8px;
  --radius-lg:    12px;
}

/* =============================================================================
   HEADER
   ============================================================================= */

/* Closes the 1px subpixel seam that backdrop-filter:blur creates between the
   sticky header and the content beneath it on mobile browsers. */
header {
  margin-bottom: -1px;
}

/* =============================================================================
   WOOCOMMERCE — SELECT DROPDOWNS
   MIGRATED FROM: Appearance → Customize → Additional CSS — 2026-04-26
   !important required: WooCommerce inlines conflicting styles on select elements
   ============================================================================= */
.woocommerce form .form-row select,
.woocommerce-page form .form-row select,
.select2-container--default .select2-selection--single {
  padding-right: 35px !important;
  background-position: calc(100% - 12px) 50% !important;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding-right: 25px !important;
}

.woocommerce form .form-row select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
}

/* =============================================================================
   WOOCOMMERCE — CART MESSAGES & NOTICES
   !important required: WooCommerce applies high-specificity default notice styles
   ============================================================================= */
.woocommerce-message {
  padding: 15px 20px !important;
  margin-bottom: 20px !important;
  border: 1px solid var(--border-mid) !important;
  border-radius: var(--radius) !important;
  background: var(--bg-light) !important;
  position: relative;
}

.woocommerce-message::before,
.woocommerce-info::before,
.woocommerce-error::before {
  content: none !important;
  display: none !important;
}

.woocommerce .cart .woocommerce-message {
  border-top: none !important;
}

/* =============================================================================
   WOOCOMMERCE — EMPTY CART
   ============================================================================= */
.woocommerce .cart-empty {
  font-size: 1.1rem;
  text-align: center;
  padding: 40px 20px !important;
  background: var(--bg-lighter);
  border-radius: var(--radius-md);
  margin: 20px 0;
  border: 1px solid var(--border-color);
}

.woocommerce .return-to-shop a.button {
  padding: 14px 35px !important;
  font-size: 1rem;
  border-radius: var(--radius) !important;
  margin-top: 15px;
  display: inline-block;
}

/* =============================================================================
   WOOCOMMERCE — CART PAGE WRAPPER
   ============================================================================= */
.woocommerce-cart .woocommerce {
  background: var(--bg-white);
  padding: 25px;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* =============================================================================
   GLOBAL — BUTTONS
   !important required: WooCommerce and parent theme both register conflicting styles
   ============================================================================= */
.button {
  border-radius: var(--radius) !important;
  padding: 14px 28px !important;
  font-weight: 500;
}

/* =============================================================================
   WOOCOMMERCE — CART TOTALS
   ============================================================================= */
.woocommerce .cart_totals .form-row {
  margin-bottom: 18px !important;
}

.woocommerce .cart_totals select,
.woocommerce .cart_totals input {
  padding: 12px 15px !important;
  height: auto !important;
  border-radius: var(--radius) !important;
}

.woocommerce .cart_totals label {
  margin-bottom: 6px !important;
  display: block;
  font-weight: 500;
}

/* =============================================================================
   WOOCOMMERCE — CART ENHANCEMENTS
   ============================================================================= */

/* 1. Cart totals fills full width when shipping calculator is absent */
.woocommerce .cart_totals:only-child {
  max-width: 100% !important;
}

/* 2. Coupon input expands to fill available row space */
.woocommerce .coupon {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  align-items: center !important;
  flex: 1 !important;
}

.woocommerce .coupon input.input-text {
  flex: 1 !important;
  min-width: 150px !important;
}

/* Coupon error/success notices — break to their own line under the input row */
.woocommerce .coupon .woocommerce-error,
.woocommerce .coupon .woocommerce-message,
.woocommerce td.actions > .woocommerce-error,
.woocommerce td.actions > .woocommerce-message {
  flex-basis: 100% !important;
  width: 100% !important;
  margin: 4px 0 0 !important;
  font-size: 0.85rem !important;
}

/* Cart actions row — stacks coupon block + update button vertically on mobile */
@media (max-width: 600px) {
  .woocommerce table.cart td.actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    align-items: stretch !important;
  }

  .woocommerce table.cart td.actions .coupon {
    width: 100% !important;
    flex: none !important;
  }

  button[name="update_cart"] {
    width: 100% !important;
  }
}

/* 3. Update cart disabled state — visually communicates it's inactive until qty changes */
button[name="update_cart"][disabled] {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

/* 4. Cart totals table — reset global table styles, render as clean summary */
.woocommerce .cart_totals table {
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  border: none !important;
  width: 100% !important;
}

.woocommerce .cart_totals table tr,
.woocommerce .cart_totals table tbody tr:nth-child(odd),
.woocommerce .cart_totals table tbody tr:nth-child(even) {
  background: transparent !important;
}

.woocommerce .cart_totals table th {
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.6px !important;
  color: var(--muted) !important;
  border: none !important;
  padding: 10px 0 !important;
}

.woocommerce .cart_totals table td {
  font-size: 0.95rem !important;
  color: var(--text) !important;
  border: none !important;
  padding: 10px 0 !important;
  text-align: right !important;
}

.woocommerce .cart_totals .order-total th {
  font-size: 0.9rem !important;
  color: var(--text) !important;
  padding-top: 18px !important;
  border-top: 2px solid var(--border-color) !important;
}

.woocommerce .cart_totals .order-total td {
  font-size: 1.2rem !important;
  font-weight: 700 !important;
  color: var(--accent) !important;
  padding-top: 18px !important;
  border-top: 2px solid var(--border-color) !important;
}

/* 5. Proceed to checkout — full-width primary CTA */
.woocommerce .wc-proceed-to-checkout {
  padding: 0 !important;
  margin-top: 16px !important;
}

.woocommerce a.checkout-button.button {
  display: block !important;
  width: 100% !important;
  text-align: center !important;
  padding: 16px !important;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  box-sizing: border-box !important;
  letter-spacing: 0.3px !important;
}

/* =============================================================================
   WOOCOMMERCE — MINI CART
   ============================================================================= */
.woocommerce-mini-cart {
  padding: 20px !important;
  font-size: 15px;
}

.woocommerce-mini-cart__buttons {
  display: flex;
  gap: 10px;
  flex-direction: column;
}

.woocommerce-mini-cart__buttons a.button {
  padding: 14px 20px !important;
  border-radius: var(--radius) !important;
  font-weight: 500;
  text-transform: none;
  width: 100%;
}

/* !important required: both buttons share .button — nth-child needed to differentiate */
.woocommerce-mini-cart__buttons a.button:nth-child(1) {
  background: var(--bg-field) !important;
  color: var(--text) !important;
}

.woocommerce-mini-cart__buttons a.button:nth-child(2) {
  background: var(--accent) !important;
  color: #fff !important;
}

.mini_cart_item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.mini_cart_item img {
  border-radius: var(--radius-sm);
}

.woocommerce-mini-cart .woocommerce-mini-cart__total {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 15px 0;
  border-top: 2px solid var(--border-color);
  margin-top: 10px;
}

.woocommerce-mini-cart .woocommerce-mini-cart__empty-message {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

/* Matches parent's .woocommerce ul.products li.product .button margin/width so both buttons align */
a.added_to_cart {
  display: block !important;
  width: calc(100% - 32px) !important;
  box-sizing: border-box !important;
  margin: 0 16px 8px !important;
  padding: 11px 20px !important;
  text-align: center !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  color: var(--accent) !important;
  background: transparent !important;
  border: 1.5px solid var(--accent) !important;
  border-radius: 8px !important;
  text-decoration: none !important;
  transition: background 0.15s ease, color 0.15s ease;
}

a.added_to_cart:hover {
  background: var(--accent) !important;
  color: #fff !important;
}

/* =============================================================================
   WOOCOMMERCE — SIDE CART DRAWER
   ============================================================================= */
.cart-drawer,
.woocommerce-cart-drawer,
.offcanvas-cart {
  background: var(--bg-white) !important;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.15);
}

.cart-drawer .drawer-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-mid);
}

/* =============================================================================
   WOOCOMMERCE — CHECKOUT PAGE
   !important required: WooCommerce and parent theme both register conflicting styles
   ============================================================================= */

/* Heading consistency — parent omits .woocommerce-additional-fields h3, leaving it red */
.woocommerce-additional-fields h3 {
  font-size: 1.3rem !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  margin-bottom: 20px !important;
  padding-bottom: 10px !important;
  border-bottom: 2px solid var(--accent) !important;
}

/* Coupon toggle bar — remove WooCommerce's blue info border, replace with neutral card */
.woocommerce-form-coupon-toggle .woocommerce-info {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  font-weight: 500 !important;
  min-height: 52px !important;
  padding: 14px 20px !important;
  background: var(--bg-light) !important;
  border: 1px solid var(--border-mid) !important;
  border-radius: var(--radius) !important;
  box-shadow: none !important;
  margin-bottom: 16px !important;
}

.woocommerce-form-coupon-toggle .woocommerce-info::before {
  content: none !important;
  display: none !important;
}

.woocommerce-form-coupon-toggle .woocommerce-info a {
  background: var(--accent) !important;
  color: #fff !important;
  padding: 6px 14px !important;
  border-radius: var(--radius) !important;
  text-decoration: none !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
}

/* Coupon form panel — card consistent with rest of checkout */
.woocommerce-form-coupon {
  background: var(--bg-white) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius) !important;
  padding: 20px !important;
  margin-bottom: 20px !important;
}

/* Checkout order review table — same clean treatment as cart totals.
   Selectors use .woocommerce table.woocommerce-checkout-review-order-table (specificity 0,3,1)
   to beat parent's .woocommerce table.shop_table th (0,2,1) which uses !important. */
.woocommerce table.woocommerce-checkout-review-order-table {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
}

.woocommerce table.woocommerce-checkout-review-order-table tr,
.woocommerce table.woocommerce-checkout-review-order-table tbody tr:nth-child(odd),
.woocommerce table.woocommerce-checkout-review-order-table tbody tr:nth-child(even) {
  background: transparent !important;
}

.woocommerce table.woocommerce-checkout-review-order-table thead th {
  background: transparent !important;
  color: var(--muted) !important;
  font-size: 0.78rem !important;
  letter-spacing: 0.6px !important;
  border-bottom: 1px solid var(--border-color) !important;
  padding: 10px 0 !important;
}

.woocommerce table.woocommerce-checkout-review-order-table tbody td {
  background: transparent !important;
  border-bottom: 1px solid var(--border-color) !important;
  padding: 10px 0 !important;
  color: var(--text) !important;
}

.woocommerce table.woocommerce-checkout-review-order-table tbody td:last-child {
  text-align: right !important;
}

.woocommerce table.woocommerce-checkout-review-order-table tfoot th,
.woocommerce table.woocommerce-checkout-review-order-table tfoot td {
  background: transparent !important;
  border: none !important;
  padding: 10px 0 !important;
}

.woocommerce table.woocommerce-checkout-review-order-table tfoot th {
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.6px !important;
  color: var(--muted) !important;
}

.woocommerce table.woocommerce-checkout-review-order-table tfoot td {
  font-size: 0.95rem !important;
  color: var(--text) !important;
  text-align: right !important;
}

.woocommerce table.woocommerce-checkout-review-order-table tfoot .order-total th,
.woocommerce table.woocommerce-checkout-review-order-table tfoot .order-total td {
  padding-top: 18px !important;
  border-top: 2px solid var(--border-color) !important;
}

.woocommerce table.woocommerce-checkout-review-order-table tfoot .order-total th {
  color: var(--text) !important;
  font-size: 0.9rem !important;
}

.woocommerce table.woocommerce-checkout-review-order-table tfoot .order-total td {
  font-size: 1.2rem !important;
  font-weight: 700 !important;
  color: var(--accent) !important;
}

/* =============================================================================
   HEADER — NAVIGATION LAYOUT
   !important required: parent theme sets #primary-menu to grid-template-columns: repeat(4, 1fr)
   Overriding to flex allows dynamic item count and mobile toggling.
   ============================================================================= */
header .container.nav nav ul#primary-menu.menu {
  display: flex !important;
  flex-wrap: nowrap !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

header .container.nav nav ul#primary-menu.menu > li {
  display: block !important;
  flex: 0 0 auto !important;
  margin: 0 !important;
}

header .container.nav nav ul#primary-menu.menu > li > a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  white-space: nowrap;
  text-align: center;
  background: var(--accent);
  border-color: var(--accent);
}

header .container.nav nav ul#primary-menu.menu > li > a:hover,
header .container.nav nav ul#primary-menu.menu > li.current-menu-item > a {
  background: var(--accent);
  border-color: var(--accent-2);
}

/* =============================================================================
   WOOCOMMERCE — PAYMENT REQUEST BUTTONS (Google Pay / Apple Pay)
   !important required: WooCommerce Stripe plugin inlines these styles directly
   ============================================================================= */
.wc-block-components-payment-request-button-container,
.woocommerce .wc-stripe-payment-request-wrapper,
.woocommerce #payment .payment_method_stripe_payment_request_button {
  margin-bottom: 16px !important;
  padding-bottom: 16px !important;
  border-bottom: 1px solid var(--border-color) !important;
}

.wc-block-components-payment-request-button-container::after,
.woocommerce .wc-stripe-payment-request-wrapper::after {
  content: 'or';
  display: block;
  text-align: center;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =============================================================================
   RESPONSIVE — MOBILE / TABLET (max-width: 1024px)
   Hide all menu items; show only .mobile-shop-only
   ============================================================================= */
@media (max-width: 1024px) {
  header .container.nav nav ul#primary-menu.menu {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 0 !important;
  }

  header .container.nav nav ul#primary-menu.menu > li {
    display: none !important;
  }

  /* FIX 2026-04-26: original Additional CSS had `display: hidden` (invalid) — item never showed on mobile */
  header .container.nav nav ul#primary-menu.menu > li.mobile-shop-only {
    display: block !important;
  }

  header .container.nav nav ul#primary-menu.menu > li.mobile-shop-only > a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 42px !important;
    padding: 0 18px !important;
    white-space: nowrap !important;
    min-width: 230px !important;
  }
}
