/* === WooCommerce Theme Override — TAC Gold === */

/* Page title */
.wc-page-title {
  font-family: var(--font-d);
  font-size: 32px;
  color: var(--t1);
  margin: 0 0 24px;
}

/* Primary buttons (Proceed to checkout, Place order, etc.) */
.woocommerce .button,
.woocommerce .checkout-button,
.woocommerce #place_order,
.woocommerce .wc-proceed-to-checkout .checkout-button,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce a.button.alt,
.woocommerce button.button.alt,
.woocommerce input.button.alt,
.woocommerce #respond input#submit.alt,
.woocommerce #respond input#submit {
  background: var(--gold) !important;
  color: var(--bg0) !important;
  border: none !important;
  border-radius: var(--r) !important;
  font-family: var(--font-b) !important;
  font-weight: 600 !important;
  font-size: 15px !important;
  padding: 14px 28px !important;
  cursor: pointer;
  transition: all 0.2s !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

.woocommerce .button:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover,
.woocommerce input.button:hover,
.woocommerce input.button.alt:hover,
.woocommerce #place_order:hover,
.woocommerce #respond input#submit:hover {
  background: var(--gold-dim) !important;
  color: var(--bg0) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(184, 134, 11, 0.25);
}

/* Secondary buttons (Update cart, Apply coupon) */
.woocommerce .button:not(.alt):not(.checkout-button):not(#place_order) {
  background: var(--bg1) !important;
  color: var(--t1) !important;
  border: 1px solid var(--br) !important;
}
.woocommerce .button:not(.alt):not(.checkout-button):not(#place_order):hover {
  background: var(--bg2) !important;
  box-shadow: none;
  transform: none;
}

/* Proceed to checkout — ensure gold */
.wc-proceed-to-checkout a.checkout-button {
  display: block !important;
  text-align: center !important;
  background: var(--gold) !important;
  color: var(--bg0) !important;
  font-size: 16px !important;
  padding: 16px 32px !important;
  border-radius: var(--r) !important;
}

/* Cart table */
.woocommerce table.shop_table {
  border: 1px solid var(--br);
  border-radius: var(--r);
  overflow: hidden;
}
.woocommerce table.shop_table th {
  background: var(--bg1);
  color: var(--t2);
  font-family: var(--font-b);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
}
.woocommerce table.shop_table td {
  padding: 16px;
  border-top: 1px solid var(--br);
  color: var(--t1);
  vertical-align: middle;
}

/* Cart totals */
.woocommerce .cart_totals h2 {
  font-family: var(--font-d);
  font-size: 22px;
  color: var(--t1);
}
.woocommerce .cart_totals table {
  border: 1px solid var(--br);
  border-radius: var(--r);
}

/* Remove item (x) */
.woocommerce a.remove {
  color: var(--sold) !important;
}
.woocommerce a.remove:hover {
  background: var(--sold) !important;
  color: white !important;
}

/* Product name links */
.woocommerce table.shop_table td.product-name a {
  color: var(--t1);
  font-weight: 500;
}
.woocommerce table.shop_table td.product-name a:hover {
  color: var(--gold);
}

/* Quantity input */
.woocommerce .quantity .qty {
  background: var(--bg1);
  border: 1px solid var(--br);
  border-radius: var(--r);
  color: var(--t1);
  padding: 8px 12px;
  width: 60px;
}

/* Cart image — square to show full featured image */
.woocommerce table.shop_table img,
.woocommerce table.shop_table td.product-thumbnail img {
  width: 80px !important;
  height: 80px !important;
  min-width: 80px;
  min-height: 80px;
  max-width: 80px !important;
  max-height: 80px !important;
  object-fit: contain !important;
  border-radius: 6px;
  aspect-ratio: 1 / 1 !important;
  background: var(--bg1);
}

/* Cart item specs sub-description */
.cart-item-specs {
  display: block;
  font-size: 11.5px;
  color: var(--t3);
  margin-top: 4px;
  line-height: 1.5;
}

/* Coupon input + button consistent sizing */
.woocommerce .coupon {
  display: flex !important;
  align-items: stretch !important;
  gap: 8px;
}
.woocommerce .coupon .input-text {
  background: var(--bg1);
  border: 1px solid var(--br);
  border-radius: var(--r);
  color: var(--t1);
  padding: 12px 16px;
  min-width: 280px;
  height: 46px;
  box-sizing: border-box;
}
.woocommerce .coupon .button {
  height: 46px !important;
  padding: 0 20px !important;
  display: inline-flex !important;
  align-items: center !important;
  white-space: nowrap;
  box-sizing: border-box;
}

/* Currency symbol — show SGD */
.woocommerce .amount {
  font-weight: 600;
  color: var(--t1);
}

/* Notices */
.woocommerce .woocommerce-message {
  border-top-color: var(--gold);
  background: var(--bg1);
  color: var(--t1);
}
.woocommerce .woocommerce-message::before {
  color: var(--gold);
}
.woocommerce .woocommerce-message a.button {
  background: var(--gold) !important;
  color: var(--bg0) !important;
}

/* Checkout form */
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select {
  background: var(--bg1);
  border: 1px solid var(--br);
  border-radius: var(--r);
  color: var(--t1);
  padding: 10px 14px;
}
.woocommerce form .form-row label {
  color: var(--t2);
  font-weight: 500;
}

/* Checkout order review — show thumbnails */
.woocommerce-checkout-review-order-table .product-thumbnail {
  width: 60px;
}
.woocommerce-checkout-review-order-table .product-thumbnail img {
  width: 60px !important;
  height: 60px !important;
  object-fit: contain !important;
  border-radius: 6px;
  background: var(--bg1);
}

/* ── MY ACCOUNT PAGE ──────────────────────────────────── */
.woocommerce-account .woocommerce-MyAccount-navigation {
  background: var(--bg1);
  border: 1px solid var(--br);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 24px;
}
.woocommerce-account .woocommerce-MyAccount-navigation ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.woocommerce-account .woocommerce-MyAccount-navigation ul li {
  border-bottom: 1px solid var(--br);
}
.woocommerce-account .woocommerce-MyAccount-navigation ul li:last-child {
  border-bottom: none;
}
.woocommerce-account .woocommerce-MyAccount-navigation ul li a {
  display: block;
  padding: 12px 18px;
  color: var(--t2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.woocommerce-account .woocommerce-MyAccount-navigation ul li a:hover {
  background: var(--bg2);
  color: var(--t1);
}
.woocommerce-account .woocommerce-MyAccount-navigation ul li.is-active a {
  background: var(--gold-l);
  color: var(--gold-dim);
  border-left: 3px solid var(--gold);
  font-weight: 600;
}

/* Login / Register form */
.woocommerce-account .woocommerce form.woocommerce-form-login,
.woocommerce-account .woocommerce form.woocommerce-form-register {
  border: 1px solid var(--br);
  border-radius: var(--r);
  padding: 28px;
  background: var(--bg0);
}
.woocommerce-account .woocommerce form h2,
.woocommerce-account .u-column1 h2,
.woocommerce-account .u-column2 h2 {
  font-family: var(--font-d);
  font-size: 22px;
  color: var(--t1);
  margin-bottom: 20px;
}
.woocommerce-account .woocommerce-form__label-for-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--t2);
}
.woocommerce-account .woocommerce-form-login__submit,
.woocommerce-account .woocommerce-form-register__submit {
  margin-top: 8px;
}
.woocommerce-account .woocommerce-LostPassword {
  margin-top: 12px;
}
.woocommerce-account .woocommerce-LostPassword a {
  color: var(--gold-dim);
  font-size: 13px;
}
.woocommerce-account .woocommerce-LostPassword a:hover {
  color: var(--gold);
}

/* Account content area */
.woocommerce-account .woocommerce-MyAccount-content {
  color: var(--t1);
}
.woocommerce-account .woocommerce-MyAccount-content p {
  font-size: 14px;
  color: var(--t2);
  line-height: 1.7;
}
.woocommerce-account .woocommerce-MyAccount-content a {
  color: var(--gold-dim);
}
.woocommerce-account .woocommerce-MyAccount-content a:hover {
  color: var(--gold);
}

/* Orders table */
.woocommerce-account .woocommerce-orders-table {
  border: 1px solid var(--br);
  border-radius: var(--r);
}
.woocommerce-account .woocommerce-orders-table th {
  background: var(--bg1);
  color: var(--t2);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
}
.woocommerce-account .woocommerce-orders-table td {
  padding: 14px 16px;
  border-top: 1px solid var(--br);
  font-size: 14px;
  color: var(--t1);
}

/* ── Checkout thumbnail inline with product name ──────── */
.checkout-item-thumb {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--bg1);
  flex-shrink: 0;
}
.checkout-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.checkout-item-row .product-name-col {
  flex: 1;
  min-width: 0;
}

/* ── MOBILE RESPONSIVE ─────────────────────────────────── */
/* Override WC's woocommerce-smallscreen.css which uses
   .woocommerce table.shop_table_responsive tr td selectors.
   We use body prefix + matching selector depth to win specificity. */
@media (max-width: 768px) {

  /* ── Cart table → card layout ── */
  body .woocommerce table.shop_table_responsive thead,
  body .woocommerce table.shop_table thead {
    display: none !important;
  }
  body .woocommerce table.shop_table_responsive,
  body .woocommerce table.shop_table_responsive tbody,
  body .woocommerce table.shop_table,
  body .woocommerce table.shop_table tbody {
    display: block !important;
    border: none !important;
  }
  body .woocommerce table.shop_table_responsive tr,
  body .woocommerce table.shop_table tr {
    display: block !important;
    position: relative;
    border: 1px solid var(--br) !important;
    border-radius: var(--r) !important;
    margin-bottom: 12px;
    padding: 16px !important;
    background: var(--bg0);
  }
  body .woocommerce table.shop_table_responsive tr.cart_item,
  body .woocommerce table.shop_table tr.cart_item {
    padding-right: 40px !important;
  }

  /* Each td = block, left-aligned */
  body .woocommerce table.shop_table_responsive tr td,
  body .woocommerce-page table.shop_table_responsive tr td,
  body .woocommerce table.shop_table tr td {
    display: block !important;
    border: none !important;
    padding: 6px 0 !important;
    text-align: left !important;
    float: none !important;
    width: 100% !important;
    clear: both !important;
  }

  /* Override WC's float-left label → block label above value */
  body .woocommerce table.shop_table_responsive tr td::before,
  body .woocommerce-page table.shop_table_responsive tr td::before,
  body .woocommerce table.shop_table tr td::before {
    content: attr(data-title) !important;
    display: block !important;
    float: none !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: var(--t3) !important;
    margin-bottom: 2px !important;
    text-align: left !important;
  }

  /* Hide label for cells without data-title or empty */
  body .woocommerce table.shop_table_responsive tr td:not([data-title])::before,
  body .woocommerce table.shop_table_responsive tr td[data-title=""]::before,
  body .woocommerce table.shop_table tr td:not([data-title])::before,
  body .woocommerce table.shop_table tr td[data-title=""]::before {
    display: none !important;
  }

  /* Cart card — horizontal layout: thumbnail | name+specs+price */
  body .woocommerce table.shop_table_responsive tr.cart_item,
  body .woocommerce table.shop_table tr.cart_item {
    display: grid !important;
    grid-template-columns: 90px 1fr !important;
    grid-template-rows: auto !important;
    gap: 0 14px !important;
    align-items: center !important;
  }

  /* Thumbnail — left column, spans all rows */
  body .woocommerce table.shop_table_responsive tr td.product-thumbnail,
  body .woocommerce table.cart tr td.product-thumbnail {
    display: block !important;
    grid-column: 1 !important;
    grid-row: 1 / 20 !important;
    padding: 0 !important;
    width: auto !important;
  }
  body .woocommerce table.shop_table_responsive tr td.product-thumbnail::before,
  body .woocommerce table.cart tr td.product-thumbnail::before {
    display: none !important;
  }
  body .woocommerce table.shop_table_responsive tr td.product-thumbnail img,
  body .woocommerce table.cart tr td.product-thumbnail img {
    width: 90px !important;
    height: 90px !important;
    min-width: 90px !important;
    min-height: 90px !important;
    max-width: 90px !important;
    max-height: 90px !important;
    object-fit: contain !important;
    border-radius: 8px !important;
    background: var(--bg1) !important;
  }

  /* All other cells — right column */
  body .woocommerce table.shop_table_responsive tr.cart_item td:not(.product-thumbnail),
  body .woocommerce table.shop_table tr.cart_item td:not(.product-thumbnail) {
    grid-column: 2 !important;
  }

  /* Product name — prominent, no label, compact */
  body .woocommerce table.shop_table_responsive tr td.product-name,
  body .woocommerce table.shop_table tr td.product-name {
    font-size: 14px !important;
    font-weight: 500 !important;
    padding: 0 0 2px !important;
    text-align: left !important;
    line-height: 1.35 !important;
  }
  body .woocommerce table.shop_table_responsive tr td.product-name::before,
  body .woocommerce table.shop_table tr td.product-name::before {
    display: none !important;
  }
  body .woocommerce table.shop_table_responsive tr td.product-name .cart-item-specs,
  body .woocommerce table.shop_table tr td.product-name .cart-item-specs {
    font-size: 11px !important;
    line-height: 1.4 !important;
  }

  /* Price — compact, no label */
  body .woocommerce table.shop_table_responsive tr td.product-price,
  body .woocommerce table.shop_table tr td.product-price {
    padding: 2px 0 0 !important;
    text-align: left !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: var(--t1) !important;
  }
  body .woocommerce table.shop_table_responsive tr td.product-price::before,
  body .woocommerce table.shop_table tr td.product-price::before {
    display: none !important;
  }

  /* Subtotal — hide on mobile (redundant, shown in cart totals) */
  body .woocommerce table.shop_table_responsive tr td.product-subtotal,
  body .woocommerce table.shop_table tr td.product-subtotal {
    display: none !important;
  }

  /* Quantity — hide when input is hidden (unique amulets, qty=1) */
  body .woocommerce table.shop_table_responsive tr td.product-quantity,
  body .woocommerce table.shop_table tr td.product-quantity {
    padding: 4px 0 !important;
    text-align: left !important;
  }
  /* When qty input is visible (non-unique items), style it */
  body .woocommerce table.shop_table td.product-quantity .qty[type="number"] {
    width: 70px;
    padding: 6px 10px;
  }
  /* When qty input is hidden (unique amulets), hide the entire cell */
  body .woocommerce table.shop_table td.product-quantity:has(input[type="hidden"]) {
    display: none !important;
  }

  /* Remove (x) button — top right of card (absolute over grid) */
  body .woocommerce table.shop_table_responsive tr td.product-remove,
  body .woocommerce table.shop_table tr td.product-remove {
    position: absolute !important;
    top: 14px !important;
    right: 14px !important;
    padding: 0 !important;
    width: auto !important;
    text-align: right !important;
    grid-column: 2 !important;
  }
  body .woocommerce table.shop_table_responsive tr td.product-remove::before,
  body .woocommerce table.shop_table tr td.product-remove::before {
    display: none !important;
  }

  /* Actions row */
  body .woocommerce table.shop_table_responsive tr td.actions,
  body .woocommerce table.shop_table tr td.actions {
    padding: 16px 0 !important;
    text-align: left !important;
  }

  /* Alternate row background — remove WC's zebra stripe */
  body .woocommerce table.shop_table_responsive tr:nth-child(2n) td,
  body .woocommerce-page table.shop_table_responsive tr:nth-child(2n) td {
    background-color: transparent !important;
  }

  /* ── Coupon — stack on mobile ── */
  .woocommerce .coupon {
    flex-direction: column !important;
  }
  .woocommerce .coupon .input-text {
    min-width: 0 !important;
    width: 100% !important;
  }
  .woocommerce .coupon .button {
    width: 100% !important;
    justify-content: center !important;
  }

  /* ── Cart totals ── */
  .woocommerce .cart_totals {
    width: 100% !important;
    float: none !important;
  }

  /* ── Checkout form ── */
  .woocommerce form .form-row {
    width: 100% !important;
    float: none !important;
  }
  .woocommerce .col2-set .col-1,
  .woocommerce .col2-set .col-2 {
    width: 100% !important;
    float: none !important;
  }

  /* ── Checkout order review thumbnails ── */
  .checkout-item-row {
    gap: 10px;
  }
  .checkout-item-thumb {
    width: 44px;
    height: 44px;
  }

  /* ── Page title ── */
  .wc-page-title {
    font-size: 24px;
  }

  /* ── Buttons — full width on mobile ── */
  .wc-proceed-to-checkout a.checkout-button {
    font-size: 15px !important;
    padding: 14px 24px !important;
  }
  .woocommerce #place_order {
    width: 100%;
    font-size: 16px !important;
    padding: 16px !important;
  }
}
