/* =========================================================================
   TIQI WooCommerce styling — shop archive, single product, cart/checkout/
   account. Loaded only on WooCommerce pages (see functions.php enqueue).
   Deliberately styles WooCommerce's own default markup/classes rather than
   overriding every template file, so plugin updates stay safe.
   ========================================================================= */

/* ---------------------------------------------------------------------
   Star ratings — WooCommerce's own stylesheet normally provides the
   visual stars via a bundled icon font. Since that stylesheet is now
   disabled (see functions.php — avoids specificity conflicts with our
   layout CSS), this recreates the same "clipped overlay" technique
   WooCommerce itself uses (a grey 5-star base layer with a coloured
   5-star layer clipped to the rating's width %, which WC already
   outputs as an inline style on the inner <span>) using plain Unicode
   stars instead of a custom font — no extra font file needed.
   --------------------------------------------------------------------- */
.star-rating {
  position: relative;
  height: 1.1em;
  line-height: 1;
  width: 5.4em;
  font-size: 0.9rem;
  overflow: hidden;
  letter-spacing: 0.12em;
}
.star-rating::before {
  content: "★★★★★";
  position: absolute;
  top: 0;
  left: 0;
  color: #ddd;
}
.star-rating span {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
}
.star-rating span::before {
  content: "★★★★★";
  color: var(--tiqi-accent);
}

/* ---------------------------------------------------------------------
   Notices — "Product added to cart", validation errors, info messages.
   Same reason as star ratings above: recreating basic styling that
   WooCommerce's own (now-disabled) stylesheet used to provide.
   --------------------------------------------------------------------- */
.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
  list-style: none;
  padding: 1rem 1.25rem;
  margin: 0 0 1.5rem;
  border-radius: 0.35rem;
  border-left: 4px solid #999;
  background-color: #f8f8f8;
}
.woocommerce-error li {
  margin: 0;
  list-style: none;
}
.woocommerce-message {
  border-left-color: #2e7d32;
  background-color: #eaf6ec;
}
.woocommerce-error {
  border-left-color: var(--tiqi-accent);
  background-color: #fdecec;
}
.woocommerce-info {
  border-left-color: #3b6fd4;
  background-color: #eaf0fd;
}
.woocommerce-message a.button,
.woocommerce-error a.button,
.woocommerce-info a.button {
  margin-left: 0.75rem;
}

.stock.in-stock {
  color: #2e7d32;
  font-size: 0.9rem;
}
.stock.out-of-stock {
  color: var(--tiqi-accent);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---------------------------------------------------------------------
   Shop filter sidebar (sidebar-shop.php) — Category, Price, Condition.
   Shown only on the shop archive/category/tag pages (see functions.php).
   --------------------------------------------------------------------- */
.tiqi-shop-filters {
  background-color: #fafafa;
  border-radius: 0.5rem;
  padding: 1.5rem;
}

.tiqi-shop-filter-list li {
  margin-bottom: 0.5rem;
}
.tiqi-shop-filter-list a {
  color: var(--tiqi-text);
  text-decoration: none;
  font-size: 0.9rem;
}
.tiqi-shop-filter-list a:hover {
  color: var(--tiqi-primary);
}

/* Price filter — WooCommerce's native widget, built on jQuery UI Slider.
   Since WooCommerce's own bundled stylesheet is disabled (see
   functions.php), the slider handle/track need styling here — jQuery UI
   generates this exact class structure (.ui-slider, .ui-slider-handle,
   .ui-slider-range) regardless of any theme. */
.price_slider {
  position: relative;
  height: 4px;
  background-color: #ddd;
  border-radius: 2px;
  margin: 1.5rem 0 1.25rem;
}
.price_slider .ui-slider-range {
  position: absolute;
  height: 4px;
  background-color: var(--tiqi-primary);
  border-radius: 2px;
}
.price_slider .ui-slider-handle {
  position: absolute;
  top: -6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: #fff;
  border: 2px solid var(--tiqi-primary);
  cursor: pointer;
  outline: none;
  margin-left: -8px;
}
.price_slider_amount {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}
.price_slider_amount .button {
  background-color: var(--tiqi-primary);
  color: #fff;
  border: none;
  border-radius: 0.35rem;
  padding: 0.35rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.price_slider_amount .button:hover {
  background-color: var(--tiqi-accent-hover);
}

/* Condition filter is hand-built with the same markup/classes as the
   Category list above (.tiqi-shop-filter-list) — no separate styling
   needed here. */

/* ---------------------------------------------------------------------
   Shop archive — product grid
   Mimics a Bootstrap .row on WooCommerce's ul.products, so the col-6/
   col-md-4/col-lg-3 classes added via content-product.php line up
   correctly without needing to override loop-start/loop-end templates.

   Card styling below (.tiqi-shop-card) deliberately keeps the RESTING
   state minimal — no border, no visible button — with more whitespace
   between cards. Add to Cart only reveals on hover. This mirrors the
   "clean and tidy" feel of sites like Madison & Mayfair: the grid reads
   as a calm, evenly-spaced set of photos, not a wall of competing card
   chrome and buttons.
   --------------------------------------------------------------------- */
ul.products {
  display: flex !important;
  flex-wrap: wrap !important;
  list-style: none;
  margin: 0 -1rem !important;
  padding: 0 !important;
}
ul.products li.product {
  padding: 0 1rem !important;
  margin-bottom: 2.5rem !important;
  float: none !important; /* WooCommerce's own bundled CSS floats these by default — that conflicts with the flex layout above. Width is intentionally left alone here so Bootstrap's col-6/col-md-4/col-lg-3 classes (also on this element, via wc_product_class() in content-product.php) keep controlling column width. */
}

.tiqi-shop-card {
  border: none;
  background-color: transparent;
  transition: none; /* overrides the generic .tiqi-card hover lift — this card type uses a subtler treatment (see below) */
}
.tiqi-shop-card:hover {
  box-shadow: none;
  transform: none;
}

.tiqi-card-image img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  width: 100%;
  display: block;
  border-radius: 0.5rem;
  transition: opacity 0.2s ease;
}
.tiqi-shop-card:hover .tiqi-card-image img {
  opacity: 0.92; /* faint dim on hover, a common "clean" e-commerce cue that the card is interactive, without a heavy overlay */
}

.woocommerce-loop-product__title {
  font-size: 0.95rem;
  font-weight: 500;
  color: #555;
  margin: 0.75rem 0 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em; /* reserves 2 lines so cards stay uniform height across a row regardless of title length */
  line-height: 1.25;
}

.tiqi-card .price {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--tiqi-primary);
}
.tiqi-card .price ins {
  text-decoration: none;
  color: var(--tiqi-accent);
}
.tiqi-card .price del {
  opacity: 0.5;
  font-weight: 400;
  font-size: 0.9rem;
}

/* Sale badge */
.tiqi-card-image span.onsale,
span.onsale {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background-color: var(--tiqi-accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 0.25rem;
  z-index: 2;
}

/* Add to cart button in the loop card — hidden until the card is hovered,
   reserving its layout space the whole time so nothing shifts/reflows on
   hover. Full-width pill under the price, understated until needed. */
.tiqi-shop-card > a.button,
.tiqi-shop-card > a.add_to_cart_button {
  display: block;
  text-align: center;
  margin: 0.65rem 0 0;
  background-color: var(--tiqi-primary);
  color: #fff;
  border: none;
  border-radius: 2rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, background-color 0.15s ease;
}
.tiqi-shop-card:hover > a.button,
.tiqi-shop-card:hover > a.add_to_cart_button {
  opacity: 1;
  visibility: visible;
}
.tiqi-shop-card > a.button:hover,
.tiqi-shop-card > a.add_to_cart_button:hover {
  background-color: var(--tiqi-accent-hover);
  color: #fff;
}
/* Touch devices have no hover — always show the button so it's still
   reachable, just without the reveal animation */
@media (hover: none) {
  .tiqi-shop-card > a.button,
  .tiqi-shop-card > a.add_to_cart_button {
    opacity: 1;
    visibility: visible;
  }
}

/* ---------------------------------------------------------------------
   Shop toolbar — result count + ordering dropdown
   --------------------------------------------------------------------- */
.woocommerce-result-count,
.woocommerce-ordering {
  margin-bottom: 1.5rem;
}
.woocommerce > .woocommerce-notices-wrapper + p.woocommerce-result-count,
.woocommerce-result-count {
  display: inline-block;
}
form.woocommerce-ordering {
  display: inline-block;
  float: right;
}
form.woocommerce-ordering select {
  border: 1px solid #ddd;
  border-radius: 0.35rem;
  padding: 0.4rem 0.75rem;
}

/* ---------------------------------------------------------------------
   Pagination
   --------------------------------------------------------------------- */
.woocommerce-pagination ul.page-numbers {
  display: flex;
  list-style: none;
  gap: 0.35rem;
  padding: 0;
  margin: 2rem 0 0;
}
.woocommerce-pagination .page-numbers li a,
.woocommerce-pagination .page-numbers li span {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  border: 1px solid #ddd;
  border-radius: 0.35rem;
  color: var(--tiqi-text);
  text-decoration: none;
}
.woocommerce-pagination .page-numbers li span.current,
.woocommerce-pagination .page-numbers li a:hover {
  background-color: var(--tiqi-primary);
  border-color: var(--tiqi-primary);
  color: #fff;
}

/* ---------------------------------------------------------------------
   Breadcrumbs
   --------------------------------------------------------------------- */
.woocommerce-breadcrumb {
  font-size: 0.85rem;
  color: #777;
  margin-bottom: 1.5rem;
}
.woocommerce-breadcrumb a {
  color: #777;
}

/* ---------------------------------------------------------------------
   Single product page — more whitespace, calmer typography hierarchy.
   Same "clean and tidy" principle as the shop grid: generous spacing,
   understated dividers, one clear visual anchor (the price).
   --------------------------------------------------------------------- */
.single-product div.product {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  padding: 1rem 0 2rem;
}
@media (min-width: 768px) {
  .single-product div.product {
    grid-template-columns: minmax(0, 5fr) minmax(0, 4fr);
  }
}

.single-product div.images img {
  border-radius: 0.5rem;
}

.single-product .summary {
  padding-top: 0.5rem;
}
.single-product .summary .product_title {
  font-weight: 600;
  font-size: 1.6rem;
  line-height: 1.3;
  margin-bottom: 0.85rem;
  color: var(--tiqi-text);
}
.single-product .summary .price {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--tiqi-primary);
  margin-bottom: 1.5rem;
  display: block;
}
.single-product .summary .price ins {
  text-decoration: none;
  color: var(--tiqi-accent);
}

.single-product .woocommerce-product-rating {
  margin-bottom: 1.25rem;
}

.tiqi-product-info-block {
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
  padding: 0.5rem 0;
  font-size: 0.95rem;
}

.single-product form.cart {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.single-product form.cart .quantity input.qty {
  width: 4.5rem;
  padding: 0.55rem;
  border: 1px solid #ddd;
  border-radius: 0.35rem;
  text-align: center;
}
.single-product .single_add_to_cart_button {
  background-color: var(--tiqi-primary);
  color: #fff;
  border: none;
  border-radius: 2rem;
  padding: 0.85rem 2.5rem;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.01em;
  transition: background-color 0.15s ease;
}
.single-product .single_add_to_cart_button:hover {
  background-color: var(--tiqi-accent-hover);
  color: #fff;
}

.single-product .product_meta {
  font-size: 0.85rem;
  color: #777;
  border-top: 1px solid #eee;
  padding-top: 1rem;
}
.single-product .product_meta a {
  color: #777;
}

/* Tabs (description / reviews / additional info) */
.woocommerce-tabs ul.tabs {
  display: flex;
  list-style: none;
  gap: 0.25rem;
  padding: 0;
  margin: 2.5rem 0 0;
  border-bottom: 2px solid #eee;
}
.woocommerce-tabs ul.tabs li {
  margin: 0;
}
.woocommerce-tabs ul.tabs li a {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  text-decoration: none;
  color: #777;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.woocommerce-tabs ul.tabs li.active a {
  color: var(--tiqi-primary);
  border-bottom-color: var(--tiqi-primary);
}
.woocommerce-tabs .panel {
  padding: 1.5rem 0;
}

/* Related / upsell products heading */
.related.products > h2,
.upsells.products > h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 3rem 0 1.5rem;
}

/* ---------------------------------------------------------------------
   Cart / Checkout / My Account — light tidy-up
   --------------------------------------------------------------------- */
table.shop_table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}
table.shop_table th,
table.shop_table td {
  padding: 0.85rem;
  border-bottom: 1px solid #eee;
  text-align: left;
}
table.shop_table thead th {
  background-color: #f8f8f8;
  font-weight: 700;
}

.woocommerce #respond input#submit,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button {
  background-color: var(--tiqi-primary);
  color: #fff;
  border: none;
  border-radius: 0.35rem;
  padding: 0.65rem 1.5rem;
  font-weight: 600;
}
.woocommerce #respond input#submit:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover {
  background-color: var(--tiqi-accent-hover);
  color: #fff;
}

.woocommerce-checkout #payment {
  background: #f8f8f8;
  border-radius: 0.5rem;
  padding: 1.5rem;
}

.woocommerce-MyAccount-navigation ul {
  list-style: none;
  padding: 0;
}
.woocommerce-MyAccount-navigation ul li {
  margin-bottom: 0.5rem;
}
.woocommerce-MyAccount-navigation ul li a {
  display: block;
  padding: 0.6rem 1rem;
  border-radius: 0.35rem;
  color: var(--tiqi-text);
  text-decoration: none;
}
.woocommerce-MyAccount-navigation ul li.is-active a {
  background-color: var(--tiqi-primary);
  color: #fff;
}

/* ---------------------------------------------------------------------
   Form fields — catches inputs that don't go through the
   woocommerce_form_field_args filter (e.g. coupon code field, login form)
   --------------------------------------------------------------------- */
input.input-text,
textarea.input-text,
.select2-container .select2-selection--single {
  border: 1px solid #ddd !important;
  border-radius: 0.35rem !important;
  padding: 0.55rem 0.75rem !important;
  height: auto !important;
}
.form-check-input {
  margin-top: 0.3rem;
}

/* ---------------------------------------------------------------------
   Cart page
   --------------------------------------------------------------------- */
table.shop_table.cart img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 0.35rem;
}
.cart .quantity input.qty {
  width: 4rem;
}
a.remove {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  color: #fff !important;
  background-color: #999 !important;
  text-decoration: none !important;
  font-weight: 700;
}
a.remove:hover {
  background-color: var(--tiqi-accent) !important;
}

/* Coupon form + update cart button row */
.cart .coupon {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.cart .coupon .input-text {
  width: auto;
  min-width: 200px;
}

/* Cart totals — sticky sidebar card, mirrors the checkout order summary */
.cart-collaterals {
  display: block;
  margin-top: 2rem;
}
.cart_totals {
  background-color: #f8f8f8;
  border-radius: 0.5rem;
  padding: 1.5rem;
  max-width: 420px;
  margin-left: auto;
}
.cart_totals h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.cart_totals table.shop_table {
  margin-bottom: 1rem;
}
.cart_totals table.shop_table th,
.cart_totals table.shop_table td {
  border-bottom-color: #e5e5e5;
}
.wc-proceed-to-checkout a.checkout-button {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 1.05rem;
  padding: 0.85rem;
}

/* Responsive cart table — stacks on small screens using WooCommerce's own
   data-title attribute on each <td>, no template override needed */
@media (max-width: 767px) {
  table.shop_table.cart thead {
    display: none;
  }
  table.shop_table.cart,
  table.shop_table.cart tbody,
  table.shop_table.cart tr,
  table.shop_table.cart td {
    display: block;
    width: 100%;
  }
  table.shop_table.cart tr {
    border-bottom: 2px solid #eee;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
  }
  table.shop_table.cart td {
    border-bottom: none;
    padding: 0.35rem 0;
    text-align: right;
  }
  table.shop_table.cart td::before {
    content: attr(data-title) ": ";
    float: left;
    font-weight: 700;
    color: #777;
  }
  table.shop_table.cart td.product-remove::before,
  table.shop_table.cart td.product-thumbnail::before {
    content: "";
  }
  .cart_totals {
    max-width: 100%;
    margin-left: 0;
  }
}

/* ---------------------------------------------------------------------
   Checkout — two-column layout with a sticky order summary sidebar.
   Uses CSS Grid explicit placement so it works regardless of WooCommerce's
   default source order (customer details, then heading, then order review
   all render as siblings of form.checkout) — no template override needed.
   --------------------------------------------------------------------- */
@media (min-width: 992px) {
  form.checkout.woocommerce-checkout {
    display: grid;
    grid-template-columns: 1fr 400px;
    column-gap: 2.5rem;
    align-items: start;
  }
  #customer_details {
    grid-column: 1;
    grid-row: 1 / 3;
  }
  #order_review_heading {
    grid-column: 2;
    grid-row: 1;
  }
  #order_review {
    grid-column: 2;
    grid-row: 2;
    position: sticky;
    top: 1.5rem;
  }
}

#customer_details.col2-set {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.5rem;
}
@media (max-width: 575px) {
  #customer_details.col2-set {
    grid-template-columns: 1fr;
  }
}
#customer_details .col-1,
#customer_details .col-2 {
  width: auto;
  float: none;
}

#order_review_heading {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 2.5rem;
}
@media (min-width: 992px) {
  #order_review_heading {
    margin-top: 0;
  }
}

#order_review {
  background-color: #f8f8f8;
  border-radius: 0.5rem;
  padding: 1.5rem;
}
#order_review table.shop_table th,
#order_review table.shop_table td {
  border-bottom-color: #e5e5e5;
}

/* Payment methods — styled as selectable cards rather than a plain radio list */
ul.wc_payment_methods {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}
ul.wc_payment_methods li.wc_payment_method {
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  background-color: #fff;
}
ul.wc_payment_methods li.wc_payment_method label {
  font-weight: 600;
  cursor: pointer;
}
ul.wc_payment_methods .payment_box {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background-color: #f8f8f8;
  border-radius: 0.35rem;
  font-size: 0.9rem;
}

#place_order {
  width: 100%;
  padding: 1rem;
  font-size: 1.05rem;
}

/* ---------------------------------------------------------------------
   Empty cart state
   --------------------------------------------------------------------- */
.woocommerce-cart .cart-empty {
  text-align: center;
  font-size: 1.1rem;
  padding: 2rem 0;
}
.woocommerce-cart .return-to-shop {
  text-align: center;
}
