/* =========================================================================
   Storefront shared styles — theme-driven components.
   All colors below inherit the central store theme primary color via
   `--primary-brand` (defined once in helpers.php::storefront_brand_css()).
   ========================================================================= */

/* =========================================================================
   Festive Luxury Gradients & Theme Utilities
   ========================================================================= */
.bg-gradient-festive-red {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 50%, #991b1b 100%);
}

.bg-gradient-royal-gold {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 50%, #d97706 100%);
}

.bg-gradient-hero-dark {
  background: radial-gradient(circle at top right, rgba(220, 38, 38, 0.25), transparent 50%),
              radial-gradient(circle at bottom left, rgba(245, 158, 11, 0.18), transparent 40%),
              #120505;
}

.bg-festive-surface {
  background: #ffffff;
  border: 1px solid rgba(245, 158, 11, 0.18);
  box-shadow: 0 4px 20px -2px rgba(220, 38, 38, 0.05);
}

/* Micro-interaction & smooth loop keyframes */
@keyframes sparkShimmer {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(250%) rotate(45deg); }
}

@keyframes gentlePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
}

@keyframes floatGentle {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}

.animate-shimmer {
  position: relative;
  overflow: hidden;
}
.animate-shimmer::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(60deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
  animation: sparkShimmer 4s infinite cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.animate-float {
  animation: floatGentle 3s ease-in-out infinite;
}

.pulse-gold {
  animation: gentlePulse 2.5s infinite;
}

/* Drawer / slide-over easing: clean cubic-bezier glide */
.drawer-anim-in {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Quantity +/- buttons (dynamic theme primary color) ---------- */
.qty-btn-inc,
.qty-btn-dec {
  background-color: var(--primary-brand) !important;
  color: #ffffff !important;
  border: none;
  transition: opacity 0.2s ease;
}
.qty-btn-inc:hover,
.qty-btn-dec:hover {
  opacity: 0.9;
}

/* Scroll-to-top stays visually ABOVE the floating summary bar at all times */
#scrollTopBtn { z-index: 100; }

/* =========================================================================
   Quantity input â€” hide native number spinners & center the value
   ========================================================================= */

/* Hide HTML5 Number Input Spinners (Chrome, Safari, Edge, Opera) */
input[type="number"].qty-input::-webkit-outer-spin-button,
input[type="number"].qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}

/* Hide Spinners in Firefox */
input[type="number"].qty-input {
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

/* Perfect Center Alignment & Padding Fix */
input[type="number"].qty-input {
  text-align: center !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  font-weight: 700;
  width: 3rem; /* 48px standard width */
  border: none;
  outline: none;
}

/* =========================================================================
   Add-to-cart micro-interactions (replaces the old stacked toast popups)
   ========================================================================= */

/* Quantity controller pops in where the Add button was */
.qty-pop {
  animation: qtyPop .35s cubic-bezier(.34, 1.56, .64, 1) both;
}
@keyframes qtyPop {
  0%   { opacity: 0; transform: scale(.6); }
  100% { opacity: 1; transform: scale(1); }
}

/* =========================================================================
   Sticky glassmorphism header (app-like UI) + sticky category chip bar.
   ========================================================================= */
.sticky-glass-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(255, 255, 255, 0.95); /* White glass carries its own contrast */
}

/* Header text must stay readable on the light glass surface in BOTH themes. */
#siteHeader.sticky-glass-header .brand-name { color: #0f172a !important; }
#siteHeader.sticky-glass-header .brand-tagline { color: #dc2626 !important; }

/* Desktop nav pills â€” inactive pills stay dark-on-light. */
#siteHeader.sticky-glass-header .nav-link:not([class*="bg-amber-"]):not([class*="bg-red-"]) {
  color: #334155 !important;
}
#siteHeader.sticky-glass-header .nav-link:hover {
  color: #dc2626 !important;
  background: rgba(254, 226, 226, .75) !important;
}

/* Icon buttons (hamburger / theme / cart) become glassy pills. */
#siteHeader.sticky-glass-header #mobileMenuBtn,
#siteHeader.sticky-glass-header #theme-toggle,
#siteHeader.sticky-glass-header #cartBtn {
  background: #f1f5f9 !important;
  border-color: rgba(226, 232, 240, .9) !important;
  color: #334155 !important;
}
#siteHeader.sticky-glass-header #mobileMenuBtn:hover,
#siteHeader.sticky-glass-header #theme-toggle:hover,
#siteHeader.sticky-glass-header #cartBtn:hover {
  background: #fee2e2 !important;
  border-color: rgba(254, 202, 202, .9) !important;
  color: #dc2626 !important;
}

/* Mobile dropdown menu â€” solid-ish dark sheet under the glass header. */
#siteHeader.sticky-glass-header #mobileMenu {
  background: rgba(9, 13, 22, .95) !important;
  border-color: rgba(255, 255, 255, .1) !important;
}
#siteHeader.sticky-glass-header #mobileMenu a { color: rgba(255, 255, 255, .9) !important; }
#siteHeader.sticky-glass-header #mobileMenu a:hover { background: rgba(255, 255, 255, .1) !important; }
#siteHeader.sticky-glass-header #mobileMenu .text-amber-700 { color: #fcd34d !important; }

/* Sticky category chips bar (horizontally scrollable, no scrollbar). */
.header-cat-scroll {
  -ms-overflow-style: none;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.header-cat-scroll::-webkit-scrollbar { display: none; }

#siteHeader.sticky-glass-header .cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 6px 14px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
  color: rgba(255, 255, 255, .88);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  scroll-snap-align: start;
  transition: background .2s ease, color .2s ease, border-color .2s ease, transform .15s ease;
}
#siteHeader.sticky-glass-header .cat-chip:hover {
  background: rgba(255, 255, 255, .22);
  color: #fff;
}
#siteHeader.sticky-glass-header .cat-chip:active { transform: scale(.95); }
#siteHeader.sticky-glass-header .cat-chip .cat-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #fbbf24, #dc2626);
  box-shadow: 0 0 8px rgba(251, 191, 36, .7);
}

/* =========================================================================
   Floating action stack (call + scroll-to-top): anchored bottom-right.
   ========================================================================= */
#fabStack { bottom: 1.25rem; }
@media (min-width: 768px) { #fabStack { bottom: 1.25rem; } }

/* =========================================================================
   Order Now page â€” App Pill-Style Category Slider.
   ========================================================================= */
#category-pill-container {
  scrollbar-width: none;
  -ms-overflow-style: none;
  touch-action: pan-x;
}
#category-pill-container::-webkit-scrollbar { display: none; }

/* Desktop/Laptop arrow buttons (hidden on Mobile â€” strictly desktop only). */
.cat-slide-btn,
#cat-slide-left,
#cat-slide-right {
  display: none !important;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: rgba(15, 23, 42, .82);
  color: #fff;
  box-shadow: 0 4px 14px -4px rgba(0, 0, 0, .35);
  flex: none;
  transition: background .2s ease, color .2s ease, transform .15s ease, opacity .2s ease;
}
.cat-slide-btn:hover { background: #f59e0b; color: #0f172a; }
.cat-slide-btn:active { transform: scale(.9); }
.cat-slide-btn:disabled { opacity: .35; pointer-events: none; }
@media (min-width: 768px) {
  .cat-slide-btn,
  #cat-slide-left,
  #cat-slide-right { display: inline-flex !important; }
}

/* Rounded capsule pills â€” light surface in light mode, slate glass in dark. */
/* Single-line layout is mandatory: pills never break text into multiple lines. */
.category-pill,
.category-item,
.cat-chip {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}
.category-pill {
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  background: rgba(255, 255, 255, .9);
  color: #334155;
  border: 1px solid rgba(203, 213, 225, .9);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  scroll-snap-align: start;
  transition: background .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .15s ease;
}
.category-pill:hover { background: var(--primary-light); border-color: var(--primary-border); }
.category-pill:active { transform: scale(.94); }
.category-pill.active {
  background: var(--primary-brand);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 6px 18px -6px rgba(var(--primary-brand-rgb), .55);
}
.dark .category-pill {
  background: rgba(30, 41, 59, .6);
  color: #e2e8f0;
  border-color: rgba(51, 65, 85, .55);
}
.dark .category-pill:hover { background: rgba(var(--primary-brand-rgb), .15); border-color: rgba(var(--primary-border-rgb), .4); }
.dark .category-pill.active {
  background: var(--primary-brand);
  color: #ffffff;
}
.dark .cat-slide-btn { background: rgba(226, 232, 240, .1); color: #e2e8f0; }
.dark .cat-slide-btn:hover { background: #f59e0b; color: #0f172a; }

/* Hide scrollbars on scrollable rows, strictly no wrapping children. */
.no-scrollbar::-webkit-scrollbar { display: none !important; }
.no-scrollbar { -ms-overflow-style: none !important; scrollbar-width: none !important; }

/* =========================================================================
   Mobile List View product titles â€” 2-line wrapping (no single-line cut).
   ========================================================================= */
.product-title,
.product-card-title,
.product-card-list h3 {
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: normal !important; /* Allow multi-line text wrapping */
  line-height: 1.25 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  word-break: break-word !important;
}

/* Tamil subtitle (1 Line Max) */
.product-subtitle,
.product-card-subtitle,
.product-card-list p {
  display: -webkit-box !important;
  -webkit-line-clamp: 1 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: normal !important;
  line-height: 1.2 !important;
  font-size: 11px !important;
  color: #64748b;
}


@media (prefers-reduced-motion: reduce) {
  .animate-pulse-subtle { animation: none !important; transform: none !important; }
}

/* =========================================================================
   Mobile full-screen navigation drawer â€” subtle fade/slide-in.
   ========================================================================= */
#mobile-menu-drawer { animation: drawerIn .22s ease-out both; }
@keyframes drawerIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Highlighted thumbnail play button â€” subtle glowing pulse (transform/opacity only). */
@keyframes pulseSubtle {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 8px 1px rgba(139, 92, 246, .55); }
  50%      { opacity: .85; transform: scale(1.07); box-shadow: 0 0 14px 3px rgba(139, 92, 246, .75); }
}
.animate-pulse-subtle { animation: pulseSubtle 2.2s ease-in-out infinite; will-change: transform, opacity; }

/* =========================================================================
   Firecracker sparkle burst on "Add to Cart" â€” pure CSS particle explode.
   ========================================================================= */
.sparkle-global-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  pointer-events: none !important;
  z-index: 99999 !important;
}

.sparkle-particle {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  pointer-events: none !important;
  box-shadow: 0 0 6px currentColor;
  animation: sparkle-explode .65s cubic-bezier(.1, .8, .3, 1) forwards;
}

@keyframes sparkle-explode {
  0%   { transform: translate(0, 0) scale(1.2); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.1); opacity: 0; }
}

/* =========================================================================
   Responsive Tweaks for Small Mobile Screens (320px to 375px).
   Grants max width to the middle text column so product titles wrap on
   2 lines without getting cut off.
   ========================================================================= */
@media (max-width: 380px) {
  /* 1. Reduce outer product card padding */
  .product-card-list {
    padding: .5rem !important; /* 8px padding */
    gap: .5rem !important;     /* 8px gap */
  }

  /* 2. Compact Left Image Thumbnail */
  .product-card-list .product-thumb-container {
    width: 60px !important;
    height: 60px !important;
    min-width: 60px !important;
    max-width: 60px !important;
  }

  /* 3. Compact Stepper Control Width */
  .product-card-list .qty-stepper-box {
    min-width: 65px !important;
  }
  .product-card-list .qty-stepper-box button {
    width: 22px !important;
    height: 22px !important;
    font-size: 11px !important;
  }
  .product-card-list .qty-stepper-box span,
  .product-card-list .qty-stepper-box input {
    width: 20px !important;
    font-size: 10px !important;
  }

  /* 4. Font Size & Title Line Clamp Guard */
  .product-card-list .product-title {
    font-size: 11px !important;
    line-height: 1.2 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    white-space: normal !important;
  }
  .product-card-list .product-subtitle {
    font-size: 9.5px !important;
  }
}

/* =========================================================================
   STRICT FIX ONLY FOR SMALL MOBILE SCREENS (360px AND BELOW).
   Removes the white-space gap between the '-' and '+' quantity stepper
   buttons. This does NOT affect larger mobile screens (>360px).
   ========================================================================= */
@media screen and (max-width: 360px) {
  /* 1. Wrapper: seaml bullet single solid-purple pill, zero gaps */
  .qty-stepper-box,
  div[class*="qty-stepper"],
  .product-card-list .flex.items-center.border {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    border-radius: 12px !important;
    background-color: var(--primary-brand) !important; /* purple-600 */
    border: 1px solid var(--primary-brand) !important;
  }

  /* 2. Minus and Plus Buttons â€” same solid purple, no margins */
  .qty-stepper-box button,
  .product-card-list button[data-dec],
  .product-card-list button[data-inc] {
    width: 24px !important;
    height: 28px !important;
    min-width: 24px !important;
    padding: 0 !important;
    margin: 0 !important;
    background-color: var(--primary-brand) !important;
    color: #ffffff !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    font-weight: 800 !important;
  }

  /* 3. Middle Number (input/span) â€” SAME purple, NO white gap */
  .qty-stepper-box span,
  .qty-stepper-box input,
  .qty-stepper-box input.qty-input,
  .product-card-list .qty-count {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    background-color: var(--primary-brand) !important; /* seamless purple */
    color: #ffffff !important;
    font-weight: 800 !important;
    font-size: 11px !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
  }

  /* 4. Compact + ADD button for 360px */
  .product-card-list button[data-add] {
    padding: 6px 10px !important;
    font-size: 10.5px !important;
    letter-spacing: 0 !important;
  }
}

/* =========================================================================
   GLASSMORPHISM UI STYLES
   ========================================================================= */
.glass-header-top {
  background: rgba(28, 10, 10, 0.92) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border-bottom: 1px solid rgba(245, 158, 11, 0.22) !important;
}

.glass-bar-sub {
  background: rgba(255, 255, 255, 0.75) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border-bottom: 1px solid rgba(226, 232, 240, 0.6) !important;
}

/* Dark mode adjustment for sub-bar */
.dark .glass-bar-sub {
  background: rgba(15, 23, 42, 0.8) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Glass Pills / Buttons Styling */
.glass-pill {
  background: rgba(255, 255, 255, 0.6) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
}

.dark .glass-pill {
  background: rgba(30, 41, 59, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Keep the brand active highlight on category pills even with .glass-pill applied. */
.category-pill.glass-pill.active {
  background: var(--primary-brand) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 6px 18px -6px rgba(var(--primary-brand-rgb), 0.55) !important;
}
.dark .category-pill.glass-pill.active {
  background: var(--primary-brand) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}

/* =========================================================================
   SMOOTH LAG-FREE RENDERING & HARDWARE ACCELERATION
   ========================================================================= */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* GPU acceleration for the interactive/card surfaces (avoids layer churn
   by targeting only the animated elements â€” a global `will-change` on every
   button would create too many compositor layers and *hurt* performance). */
.card-hover,
.modal-container,
.glass-pill {
  will-change: transform, opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}
