/*
Theme Name: SuperMart
Theme URI: https://supermart.example.com
Author: SuperMart Inc.
Author URI: https://supermart.example.com
Description: A full-featured retail/grocery supermarket theme built with Tailwind CSS. Includes product listings, department navigation, mega menu, cart functionality, pharmacy, photo center, auto care, and more.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: supermart
Tags: e-commerce, retail, shopping, full-width-template, custom-menu, responsive-layout
*/

/* =====================================================
   BRAND COLOR TOKENS  (variable-driven theming)
   -----------------------------------------------------
   The theme's blue/yellow brand colours are mapped onto CSS variables below.
   Override the variables to recolour the WHOLE storefront without touching any
   template — via Appearance → Customize → "Brand Colors", `wp theme mod set`,
   a child theme, or an injected  :root{ --primary:#xxxxxx }  block.
   ===================================================== */
:root{
  --sm-primary:#2563eb;        /* main brand colour (Tailwind blue-600) */
  --sm-primary-dark:#1d4ed8;   /* hover/active shade (blue-700) */
  --sm-accent:#facc15;         /* accent: logo + search button (yellow-400) */
  /* Generic aliases so external tools that target --primary / --accent work too */
  --primary:var(--sm-primary);
  --primary-dark:var(--sm-primary-dark);
  --accent:var(--sm-accent);
}
.bg-blue-600,.hover\:bg-blue-600:hover{background-color:var(--primary)!important}
.bg-blue-700,.bg-blue-800,.hover\:bg-blue-700:hover,.active\:bg-blue-800:active,.group:hover .group-hover\:bg-blue-700{background-color:var(--primary-dark)!important}
.text-blue-600,.text-blue-700,.hover\:text-blue-600:hover,.group:hover .group-hover\:text-blue-700{color:var(--primary)!important}
.border-blue-500,.border-blue-600,.focus\:border-blue-400:focus,.hover\:border-blue-400:hover{border-color:var(--primary)!important}
.bg-yellow-400,.hover\:bg-yellow-300:hover,.active\:bg-yellow-500:active{background-color:var(--accent)!important}
.text-yellow-300,.text-yellow-400{color:var(--accent)!important}

/* ====================================================
   SuperMart Custom Styles
   Tailwind CSS handles all utility styling via CDN.
   This file holds only supplemental styles.
   ==================================================== */

/* Smooth scroll */
html { scroll-behavior: smooth; }

/* Font */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Kill horizontal overflow / side white-space on mobile. overflow-x:clip clips
   the overflow WITHOUT establishing a scroll container, so position:sticky (the
   header) keeps working — overflow-x:hidden here would break the sticky header. */
html, body {
  max-width: 100%;
  overflow-x: clip;
}

/* Remove default WP styles on nav menus that conflict */
.wp-block-navigation { display: none; }

/* Mega menu overlay */
#sm-mega-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 40;
}
#sm-mega-overlay.active { display: block; }

/* Mega menu panel */
#sm-mega-panel {
  display: none;
  position: absolute;
  left: 0; right: 0;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  z-index: 50;
  border-top: 1px solid #f3f4f6;
}
#sm-mega-panel.active { display: flex; }

/* Mobile menu */
#sm-mobile-menu {
  display: none;
  overflow-y: auto;
  max-height: 75vh;
}
#sm-mobile-menu.active { display: block; }

/* Accordion */
.sm-accordion-body {
  display: none;
}
.sm-accordion-body.open {
  display: block;
}

/* Gallery thumbnails active state */
.sm-thumb.active {
  border-color: #2563eb;
}

/* Cart badge animation */
@keyframes sm-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.sm-cart-badge.pop { animation: sm-pop 0.25s ease; }

/* Product hover shadow */
.sm-product-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.10); }

/* Product card images: always show the FULL product (contain, never crop/zoom),
   centered on white with a little breathing room — Walmart-style list images. */
.sm-product-card img { object-fit: contain; background: #ffffff; }

/* Line clamp for product names */
.sm-line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Ensure images fill their containers properly */
.sm-hero-img { object-fit: cover; object-position: center; }

/* Tab underline transition */
.sm-tab { transition: border-color 0.15s, color 0.15s; }

/* Prevent WP admin bar from clipping sticky header */
.admin-bar header.sm-header { top: 32px; }
@media (max-width: 782px) {
  .admin-bar header.sm-header { top: 46px; }
}

/* ==========================================================================
   MINI-CART DRAWER  (fixes: cart popup was never rendered)
   Design notes addressing the 3 reported front-end concerns:
   1) Z-INDEX: overlay 9998 / drawer 9999 → always above the sticky header
      (z-50), the department nav, the mega-menu and any announcement bar.
   2) OVERFLOW CLIPPING: the drawer uses position:fixed, so it is anchored to
      the viewport and can NEVER be clipped by an ancestor's overflow:hidden.
      A defensive rule below also forces the header wrapper to overflow:visible.
   3) HEIGHT & POSITION: the drawer is full viewport height; the items region
      flex-grows and scrolls INTERNALLY (overflow-y:auto), so a cart with many
      lines shows a scrollbar instead of stretching off-screen. The footer
      (subtotal + checkout) stays pinned. dvh + admin-bar offsets keep it fully
      rendered at every resolution.
   ========================================================================== */

/* Defensive: never let the header wrapper clip floating panels */
header.sm-header,
.sm-header { overflow: visible; }

/* Dimmed backdrop */
#sm-cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.2s ease;
}
#sm-cart-overlay.open { opacity: 1; }

/* The drawer itself */
#sm-cart-popup {
  display: none;                 /* toggled to flex by JS */
  position: fixed;               /* immune to ancestor overflow:hidden */
  z-index: 9999;                 /* above everything, incl. sticky header */
  top: 0;
  right: 0;
  height: 100vh;
  height: 100dvh;                /* correct height on mobile browser chrome */
  width: 380px;
  max-width: 92vw;
  background: #fff;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.18);
  flex-direction: column;        /* header · scrollable items · footer */
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
#sm-cart-popup.open { transform: translateX(0); }

/* Header row */
.sm-cart-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #f1f5f9;
}
.sm-cart-title { margin: 0; font-weight: 800; font-size: 16px; color: #111827; }
.sm-cart-count { margin: 2px 0 0; font-size: 12px; color: #6b7280; }
.sm-cart-close {
  background: #f8fafc; border: none; border-radius: 8px;
  padding: 6px; color: #475569; cursor: pointer; line-height: 0;
}
.sm-cart-close:hover { background: #eef2f7; color: #111827; }

/* Scrollable items region — the key to never overflowing the screen */
.sm-cart-items {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
}

/* One product row */
.sm-cart-row {
  display: flex; gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid #f6f7f9;
}
.sm-cart-thumb {
  flex: 0 0 auto; width: 60px; height: 60px;
  border-radius: 10px; overflow: hidden; background: #f3f4f6; display: block;
}
.sm-cart-thumb img { width: 100%; height: 100%; object-fit: contain; background: #ffffff; }
.sm-cart-info { flex: 1 1 auto; min-width: 0; }
.sm-cart-name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 13px; font-weight: 600; color: #1f2937; text-decoration: none; line-height: 1.3;
}
.sm-cart-name:hover { color: #2563eb; }
.sm-cart-price { font-size: 12px; color: #6b7280; margin: 2px 0 6px; }
.sm-cart-qty { display: flex; align-items: center; gap: 6px; }
.sm-cart-qty button {
  border: 1px solid #e5e7eb; background: #fff;
  width: 24px; height: 24px; border-radius: 6px;
  font-size: 15px; line-height: 1; color: #374151; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.sm-cart-qty button:hover { background: #f9fafb; border-color: #d1d5db; }
.sm-cart-qnum { min-width: 22px; text-align: center; font-size: 13px; font-weight: 600; color: #111827; }
.sm-cart-remove {
  width: auto !important; padding: 0 6px; margin-left: 4px;
  font-size: 11px !important; color: #ef4444 !important;
  border: none !important; background: none !important;
}
.sm-cart-remove:hover { text-decoration: underline; background: none !important; }
.sm-cart-line { flex: 0 0 auto; font-size: 13px; font-weight: 700; color: #111827; }

/* Pinned footer */
.sm-cart-foot {
  flex: 0 0 auto;
  border-top: 1px solid #f1f5f9;
  padding: 14px 18px 16px;
  background: #fff;
}
.sm-cart-ship {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: #16a34a; margin-bottom: 10px;
}
.sm-cart-subtotal {
  display: flex; justify-content: space-between;
  font-size: 15px; font-weight: 800; color: #111827;
}
.sm-cart-note { font-size: 11px; color: #9ca3af; margin: 2px 0 12px; }
.sm-cart-checkout {
  display: block; text-align: center;
  background: #2563eb; color: #fff; font-weight: 700; font-size: 14px;
  padding: 12px; border-radius: 999px; text-decoration: none;
}
.sm-cart-checkout:hover { background: #1d4ed8; }
.sm-cart-continue {
  display: block; width: 100%; text-align: center;
  background: none; border: none; color: #6b7280;
  font-size: 13px; font-weight: 600; padding: 10px 0 0; cursor: pointer;
}
.sm-cart-continue:hover { color: #111827; }

/* Empty state */
.sm-cart-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 48px 24px;
}
.sm-cart-empty-title { margin: 14px 0 4px; font-weight: 700; font-size: 15px; color: #111827; }
.sm-cart-empty-sub { margin: 0 0 16px; font-size: 13px; color: #6b7280; }
.sm-cart-shop-btn {
  background: #2563eb; color: #fff; font-weight: 700; font-size: 13px;
  padding: 10px 20px; border-radius: 999px; text-decoration: none;
}
.sm-cart-shop-btn:hover { background: #1d4ed8; }

/* Sit below the WordPress admin bar when present */
.admin-bar #sm-cart-popup { height: calc(100vh - 32px); top: 32px; }
@media (max-width: 782px) {
  .admin-bar #sm-cart-popup { height: calc(100vh - 46px); top: 46px; }
}

/* ==========================================================================
   PRODUCT DETAIL PAGE  —  Walmart-aligned pixel tuning
   Scoped to .sm-pdp (added on the product page wrapper). Selectors are kept
   at >= 2-class specificity (or use the #id) so they reliably override the
   Tailwind CDN utility classes regardless of stylesheet source order.
   Reference target: walmart.com product pages (Bogle/Arial, tight spacing).
   ========================================================================== */

/* Walmart-style sans stack (Bogle falls back to Helvetica/Arial) */
.sm-pdp { font-family: "Bogle", "Helvetica Neue", Helvetica, Arial, sans-serif; }

/* Content is already capped at 1280px via .max-w-7xl (80rem); enforce + center */
.sm-pdp .max-w-7xl { max-width: 1280px; margin-left: auto; margin-right: auto; }

/* ---- Typography ---------------------------------------------------------- */
/* Breadcrumbs + secondary meta → 12px, mid-gray #46474a */
.sm-pdp .sm-pdp-crumbs { font-size: 12px; }
.sm-pdp .sm-pdp-crumbs a,
.sm-pdp .sm-pdp-crumbs span { color: #46474a; }
.sm-pdp .sm-pdp-meta { font-size: 12px; }
.sm-pdp .sm-pdp-sku  { color: #46474a; font-size: 12px; }

/* Product title → 24–28px, bold 700, near-black #2e2f32 */
.sm-pdp .sm-pdp-title {
  font-size: 26px;
  line-height: 1.25;
  font-weight: 700;
  color: #2e2f32;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}
@media (min-width: 1024px) { .sm-pdp .sm-pdp-title { font-size: 28px; } }

/* Price → ~32px bold, near-black; dollar sign as small superscript */
.sm-pdp .sm-pdp-price {
  font-size: 32px;
  font-weight: 700;
  color: #2e2f32;
  line-height: 1;
  letter-spacing: -0.02em;
}
.sm-pdp .sm-pdp-cur {
  font-size: 18px;
  font-weight: 700;
  vertical-align: 7px;
  margin-right: 1px;
}

/* ---- Layout: 55 : 45 columns on large screens (image slightly wider) ----- */
@media (min-width: 1024px) {
  .sm-pdp .sm-pdp-grid {
    grid-template-columns: minmax(0, 55fr) minmax(0, 45fr);
  }
}

/* ---- Add to Cart → Walmart blue, 48px tall, full 24px-radius pill -------- */
#sm-pdp-atc {
  background: #0071dc !important;
  color: #fff;
  height: 48px;
  min-height: 48px;
  border-radius: 24px !important;
  font-weight: 700;
  font-size: 16px;
  box-shadow: none;
}
#sm-pdp-atc:hover  { background: #004f9a !important; }
#sm-pdp-atc:active { background: #003d78 !important; }

/* ---- Trust badges → refined hairline card, 16px bottom gap --------------- */
.sm-pdp .sm-pdp-trust {
  background: #fff;
  border: 1px solid #e6e7e8;
  border-radius: 8px;
  margin-top: 8px;
  margin-bottom: 16px;
}
.sm-pdp .sm-pdp-trust > div { padding: 14px 16px; border-color: #f0f0f1; }
.sm-pdp .sm-pdp-trust p:first-child { color: #2e2f32; font-size: 13px; }
.sm-pdp .sm-pdp-trust p:last-child  { color: #46474a; font-size: 12px; }

/* =====================================================
   WooCommerce archive product grid  (Shop + /product-category/ pages)
   The theme card is rendered inside ul.products; force a real responsive CSS
   grid so the container never collapses on mobile (fixes WC's fragile
   float-based default, which left the grid at height:0 on phones).
   ===================================================== */
.woocommerce ul.products,
ul.products {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr);   /* mobile ≤767px → 2 columns */
  gap: 14px;
  width: 100% !important;                   /* full width — never shrink beside a float */
  clear: both !important;                   /* clear the floated result-count / ordering above */
  box-sizing: border-box;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}
/* WC result count + ordering dropdown were floating and squeezing the grid into a
   thin column on phones — stack them full-width instead. */
@media (max-width: 767px) {
  .woocommerce-result-count,
  .woocommerce-ordering,
  .woocommerce-ordering select {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 10px !important;
    display: block;
  }
}
.woocommerce ul.products li.product,
ul.products li.product,
ul.products > * {                          /* neutralise WC float widths */
  width: auto !important;
  margin: 0 !important;
  float: none !important;
  clear: none !important;
  max-width: none !important;
}
@media (min-width: 768px) {
  .woocommerce ul.products,
  ul.products { grid-template-columns: repeat(3, 1fr); gap: 18px; }
}
@media (min-width: 1024px) {
  .woocommerce ul.products,
  ul.products { grid-template-columns: repeat(4, 1fr); }
}

/* Uploaded custom logo (Appearance → Site Identity → Logo) — keep it a sensible size */
.sm-logo-img img.custom-logo{ height:40px; width:auto; max-width:210px; display:block; }
.sm-logo-img-footer img.custom-logo{ height:38px; width:auto; max-width:210px; display:block; }

/* =====================================================
   WooCommerce checkout / cart skin — match the SuperMart look
   (the bridge sends buyers to WC's native checkout for real payments; this
   styles it so it feels like the rest of the store). Uses --primary so the
   5 colour skins match automatically. Targets the classic [woocommerce_checkout].
   ===================================================== */
.woocommerce-checkout h3, .woocommerce-checkout h2,
.woocommerce-cart h2, #order_review_heading { font-weight:800 !important; color:#111827 !important; }

/* form fields */
.woocommerce form .form-row label { font-size:13px; font-weight:600; color:#374151; margin-bottom:4px; }
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select,
.woocommerce .select2-container .select2-selection--single {
  border:1px solid #d7dbe0 !important; border-radius:10px !important;
  padding:11px 12px !important; height:auto !important; min-height:44px; font-size:14px !important;
  box-shadow:none !important; background:#fff !important;
}
.woocommerce .select2-container .select2-selection--single { display:flex; align-items:center; }
.woocommerce form .form-row input.input-text:focus,
.woocommerce form .form-row textarea:focus,
.woocommerce form .form-row select:focus {
  border-color:var(--primary,#2563eb) !important; outline:none !important;
  box-shadow:0 0 0 3px rgba(37,99,235,.14) !important;
}

/* order review + cart totals as clean cards */
#order_review, .cart_totals, .woocommerce-cart-form {
  background:#fff !important; border:1px solid #edf0f2 !important; border-radius:16px !important;
  padding:18px !important; box-shadow:0 4px 18px rgba(0,0,0,.04) !important;
}
.woocommerce-checkout-review-order-table { border:0 !important; }
.woocommerce-checkout-review-order-table th,
.woocommerce-checkout-review-order-table td { border-color:#f0f2f4 !important; padding:10px 4px !important; }
.woocommerce-checkout-review-order-table .order-total .amount { color:var(--primary,#2563eb) !important; font-weight:900; }

/* payment methods block */
#payment { background:transparent !important; border:0 !important; padding:0 !important; }
#payment ul.payment_methods { border:0 !important; padding:0 !important; margin:0 0 12px !important; }
#payment ul.payment_methods li { padding:10px 0 !important; border-bottom:1px solid #f0f2f4; }
#payment div.payment_box { background:#f7f9fc !important; border-radius:10px !important; margin-top:8px; }
#payment div.payment_box::before { display:none !important; }

/* buttons: Place Order + all WC buttons → theme brand pill */
.woocommerce #payment #place_order,
.woocommerce a.button, .woocommerce button.button, .woocommerce input.button,
.woocommerce a.button.alt, .woocommerce button.button.alt,
.woocommerce .cart .button, .woocommerce .cart input.button {
  background:var(--primary,#2563eb) !important; color:#fff !important; border:0 !important;
  border-radius:9999px !important; font-weight:800 !important; padding:13px 26px !important;
  font-size:15px !important; box-shadow:0 6px 16px rgba(37,99,235,.22) !important; text-shadow:none !important;
  transition:filter .15s ease;
}
.woocommerce #payment #place_order { width:100% !important; }
.woocommerce a.button:hover, .woocommerce button.button:hover,
.woocommerce input.button:hover, .woocommerce #payment #place_order:hover { filter:brightness(.92); }

/* notices in theme colours */
.woocommerce-info, .woocommerce-message, .woocommerce-error {
  border-radius:10px !important; border-top:0 !important; padding:14px 16px 14px 44px !important;
}
.woocommerce-info::before, .woocommerce-message::before, .woocommerce-error::before { top:14px !important; }
.woocommerce-info  { border-left:4px solid var(--primary,#2563eb) !important; background:#f3f7ff !important; }
.woocommerce-message{ border-left:4px solid #16a34a !important; background:#f1fbf4 !important; }
.woocommerce-error { border-left:4px solid #dc2626 !important; background:#fef3f3 !important; }

/* coupon toggle */
.checkout_coupon.woocommerce-form-coupon { border-radius:12px !important; border-color:#e5e7eb !important; }

/* =====================================================
   Shopify-style two-column checkout  (classic [woocommerce_checkout])
   Form on the left, sticky order summary on the right with product thumbnails.
   ===================================================== */
@media (min-width: 981px) {
  .woocommerce-checkout form.checkout.woocommerce-checkout {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) 400px;
    gap: 48px;
    max-width: 1060px;
    margin: 12px auto 48px;
    align-items: start;
  }
  .woocommerce-checkout #customer_details { grid-column: 1; }
  .woocommerce-checkout #order_review_heading { grid-column: 2; margin: 0 0 12px !important; }
  .woocommerce-checkout #order_review { grid-column: 2; position: sticky; top: 20px; }
  /* stack billing + shipping vertically in the left column */
  .woocommerce-checkout #customer_details .col2-set { display: block; width: 100%; }
  .woocommerce-checkout #customer_details .col2-set .col-1,
  .woocommerce-checkout #customer_details .col2-set .col-2 { width: 100%; float: none; padding: 0; margin-bottom: 8px; }
}
/* order-summary panel — clean light look */
.woocommerce-checkout #order_review {
  background: #fafbfc !important; border: 1px solid #e8ebef !important;
}
/* product thumbnails inside the summary */
.sm-co-item { display: flex; align-items: center; gap: 12px; }
.sm-co-thumb { flex: none; width: 46px; height: 46px; }
.sm-co-thumb img, .sm-co-thumb img.sm-co-thumb-img {
  width: 46px !important; height: 46px !important; object-fit: contain;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; margin: 0 !important; padding: 3px;
}
.sm-co-name { font-weight: 500; line-height: 1.35; }
.woocommerce-checkout-review-order-table td.product-total,
.woocommerce-checkout-review-order-table td.product-name { vertical-align: middle; }
.woocommerce-checkout-review-order-table .cart_item td { padding-top: 12px !important; padding-bottom: 12px !important; }
