/* Custom Component Styles, Glows & Micro-Animations (2.9 - Luxury Boutique Polish) */

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

:root {
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-snap: cubic-bezier(0.2, 0.9, 0.3, 1);
}

/* Luxury Soft Diffuse Shadows */
.shadow-luxury-xs {
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04), 0 1px 1px 0 rgba(0, 0, 0, 0.02);
}

.shadow-luxury-sm {
  box-shadow: 0 2px 6px -1px rgba(0, 0, 0, 0.05), 0 1px 3px -1px rgba(0, 0, 0, 0.03);
}

.shadow-luxury-md {
  box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.08), 0 3px 8px -2px rgba(15, 23, 42, 0.04);
}

.shadow-luxury-lg {
  box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.12), 0 6px 14px -3px rgba(15, 23, 42, 0.06);
}

.dark .shadow-luxury-md {
  box-shadow: 0 10px 30px -4px rgba(0, 0, 0, 0.6), 0 4px 10px -2px rgba(0, 0, 0, 0.4);
}

.dark .shadow-luxury-lg {
  box-shadow: 0 20px 45px -8px rgba(0, 0, 0, 0.7), 0 8px 16px -4px rgba(0, 0, 0, 0.5);
}

/* Specular Glassmorphism Navigation */
.glass-header {
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  background-color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.dark .glass-header {
  background-color: rgba(15, 23, 42, 0.92);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Category Navigation Edge Fade Mask */
.category-nav-mask {
  mask-image: linear-gradient(to right, transparent, black 24px, black calc(100% - 24px), transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 24px, black calc(100% - 24px), transparent);
}

@media (max-width: 640px) {
  .category-nav-mask {
    mask-image: linear-gradient(to right, transparent, black 14px, black calc(100% - 14px), transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 14px, black calc(100% - 14px), transparent);
  }
}

/* Category Button Craft */
.dept-btn {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: all 0.18s var(--ease-spring);
}

.dark .dept-btn {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Ambient Radial & Mesh Glows */
.glow-emerald {
  background: radial-gradient(circle at 50% 50%, rgba(22, 163, 74, 0.12) 0%, rgba(22, 163, 74, 0) 70%);
}

.dark .glow-emerald {
  background: radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0) 70%);
}

.glow-mesh {
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(22, 163, 74, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 90% 80%, rgba(245, 158, 11, 0.06) 0%, transparent 50%);
}

.dark .glow-mesh {
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(16, 185, 129, 0.14) 0%, transparent 45%),
    radial-gradient(circle at 90% 80%, rgba(245, 158, 11, 0.09) 0%, transparent 50%);
}

/* Drawer & Backdrop Transitions */
.drawer-panel {
  transition: transform 0.28s var(--ease-ios);
  will-change: transform;
}

.drawer-backdrop {
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

/* Card Zoom & Tactile Hover States */
.card-zoom {
  transition: transform 0.22s var(--ease-spring), box-shadow 0.22s ease, border-color 0.18s ease;
  will-change: transform, box-shadow;
  box-shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.dark .card-zoom {
  box-shadow: 0 6px 18px -3px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.card-zoom img {
  transition: transform 0.35s var(--ease-spring);
}

.card-zoom:hover img {
  transform: scale(1.045);
}

.card-zoom:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -8px rgba(22, 101, 52, 0.12), 0 0 0 1px rgba(134, 239, 172, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  border-color: #86efac;
}

.dark .card-zoom:hover {
  box-shadow: 0 14px 28px -8px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(21, 128, 61, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border-color: #15803d;
}

.card-zoom:active {
  transform: scale(0.975);
}

/* Department Folder Cards (2-Column Aesthetic) */
.dept-folder-card {
  transition: transform 0.24s var(--ease-spring), box-shadow 0.24s ease, border-color 0.2s ease;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform, box-shadow;
  box-shadow: 0 4px 14px -2px rgba(15, 23, 42, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.dark .dept-folder-card {
  box-shadow: 0 10px 24px -4px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.dept-folder-card img {
  transition: transform 0.38s var(--ease-spring);
}

.dept-folder-card:hover img {
  transform: scale(1.055);
}

.dept-folder-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 38px -8px rgba(22, 101, 52, 0.16), 0 0 0 1px rgba(134, 239, 172, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.dark .dept-folder-card:hover {
  box-shadow: 0 20px 38px -8px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(52, 211, 153, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.dept-folder-card:active {
  transform: scale(0.97);
}

/* Micro-interaction for folder arrow */
.browse-arrow {
  display: inline-block;
  transition: transform 0.22s var(--ease-spring);
  will-change: transform;
}

.dept-folder-card:hover .browse-arrow {
  transform: translateX(4px);
}

/* Folder Tab Cutout / Silhouette */
.folder-tab-ear {
  position: relative;
  border-top-left-radius: 1rem;
  border-top-right-radius: 1.25rem;
}

.folder-promo-amber {
  border-color: #f59e0b;
  box-shadow: 0 8px 24px -6px rgba(245, 158, 11, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.dark .folder-promo-amber {
  border-color: #d97706;
  box-shadow: 0 8px 24px -6px rgba(245, 158, 11, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.folder-promo-emerald {
  border-color: #10b981;
  box-shadow: 0 8px 24px -6px rgba(16, 185, 129, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.dark .folder-promo-emerald {
  border-color: #059669;
  box-shadow: 0 8px 24px -6px rgba(16, 185, 129, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Line Clamp Utilities for 2-Column Grid */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Springy Micro-Interaction for Buttons & Steppers */
.btn-spring {
  transition: transform 0.14s var(--ease-pop), background-color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  will-change: transform;
}

.btn-spring:active {
  transform: scale(0.92);
}

/* Glassmorphism Search Dropdown */
#search-dropdown {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* Dual-Phase Jelly Badge Pop Animation */
.badge-pop,
.animate-badge-jelly {
  animation: badgeJelly 0.3s var(--ease-pop) both;
}

@keyframes badgeJelly {
  0% {
    transform: scale(0.85);
  }
  35% {
    transform: scale(1.35);
  }
  65% {
    transform: scale(0.92);
  }
  85% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

/* Snappy View / Department Entrance */
/* Snappy Instant View Reveal (Zero vertical scroll/displacement) */
@keyframes viewInstantReveal {
  0% {
    opacity: 0.2;
  }
  100% {
    opacity: 1;
  }
}

.animate-view-in {
  animation: viewInstantReveal 0.12s ease-out both;
  will-change: opacity;
}

.animate-view-back-in {
  animation: viewInstantReveal 0.12s ease-out both;
  will-change: opacity;
}

/* Product Grid Batch Card Reveal (Pure scale/opacity, zero vertical shift) */
@keyframes cardPopIn {
  0% {
    opacity: 0.6;
    transform: scale(0.99);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-cards-enter {
  animation: cardPopIn 0.14s ease-out both;
}

/* Stepper Number Pop */
@keyframes numBounce {
  0% {
    transform: scale(0.7);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.25);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.animate-num-pop {
  animation: numBounce 0.18s var(--ease-pop) both;
  display: inline-block;
}

/* Modal Spring Dialog Entrance & Exit */
@keyframes modalDialogIn {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(0.94);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes modalDialogOut {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
}

.modal-anim-enter {
  animation: modalDialogIn 0.24s var(--ease-spring) both;
  will-change: transform, opacity;
}

.modal-anim-exit {
  animation: modalDialogOut 0.16s ease-in both;
  will-change: transform, opacity;
}

/* Filter Chip Tap Feedback */
.dietary-chip {
  transition: transform 0.14s var(--ease-pop), background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.dietary-chip:active {
  transform: scale(0.92);
}

/* Dropdown Entrance */
@keyframes dropdownSlideFade {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-dropdown-in {
  animation: dropdownSlideFade 0.18s var(--ease-spring) both;
}

/* Smooth Toast Pop-in */
.toast-anim {
  animation: slideUpFade 0.26s var(--ease-spring);
}

@keyframes slideUpFade {
  from {
    transform: translateY(14px) scale(0.94);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Checkout Progress Step Track */
.checkout-step.active-step {
  color: #15803d;
  font-weight: 800;
}

.dark .checkout-step.active-step {
  color: #34d399;
}

.checkout-step.active-step .step-dot {
  background-color: #15803d;
  color: white;
  border-color: #15803d;
}

.dark .checkout-step.active-step .step-dot {
  background-color: #10b981;
  color: #0f172a;
  border-color: #10b981;
}

/* Hide native scrollbar but allow scrolling */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Custom Sleek Scrollbar Across All Modern Browsers */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
}

.dark html {
  scrollbar-color: rgba(71, 85, 105, 0.5) transparent;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.6);
}

.dark ::-webkit-scrollbar-thumb {
  background: rgba(71, 85, 105, 0.4);
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(71, 85, 105, 0.7);
}

/* Independent Cart Drawer Scroll Containment */
#cart-scroll-area {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Item Tile In-Cart Active Glow & Visual Elevation */
.tile-in-cart {
  box-shadow: 0 10px 28px -4px rgba(16, 185, 129, 0.22), inset 0 0 0 1px rgba(16, 185, 129, 0.5), 0 0 0 1.5px rgba(16, 185, 129, 0.4);
}

.dark .tile-in-cart {
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(52, 211, 153, 0.5), 0 0 0 1.5px rgba(52, 211, 153, 0.4);
}

/* Micro pulse once when item added */
@keyframes pulseOnce {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.animate-pulse-once {
  animation: pulseOnce 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Touch Scrolling & Zoom Ergonomics: Allow Pan-X, Pan-Y, and Pinch-Zoom Everywhere */
html,
body {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.dept-folder-card,
.card-zoom,
.btn-spring,
button,
[data-action] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* Horizontal Scroll Containers & Elements: Explicitly enable pan-x, pan-y, and pinch-zoom with momentum */
#dept-nav-list,
#dietary-chips-bar,
.category-nav-mask,
.dept-btn,
.dietary-chip {
  touch-action: pan-x pan-y pinch-zoom !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

/* Neutralize :active scale & elevation when scrolling or pinch-zooming */
body.is-scrolling .btn-spring:active,
body.is-scrolling .dept-folder-card:active,
body.is-scrolling .card-zoom:active,
body.is-scrolling [data-action]:active,
body.is-scrolling button:active,
body.is-zooming .btn-spring,
body.is-zooming .btn-spring:active,
body.is-zooming .dept-folder-card,
body.is-zooming .dept-folder-card:active,
body.is-zooming .card-zoom,
body.is-zooming .card-zoom:active,
body.is-zooming [data-action],
body.is-zooming [data-action]:active,
body.is-zooming button,
body.is-zooming button:active {
  transform: none !important;
  box-shadow: none !important;
  transition: none !important;
}

/* Reduced Motion Override for Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Prevent iOS Safari Viewport Auto-Zoom on Form Focus */
@media screen and (max-width: 768px) {
  #global-search-input,
  input[type="text"],
  input[type="search"],
  input[type="date"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Mobile Screen-Width Breakout Search Dropdown */
@media screen and (max-width: 639px) {
  #search-dropdown {
    position: absolute !important;
    left: 10px !important;
    right: 10px !important;
    top: calc(100% + 6px) !important;
    width: auto !important;
    max-height: min(60vh, calc(100dvh - 160px)) !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    z-index: 50;
    box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(15, 23, 42, 0.08);
  }

  .dark #search-dropdown {
    box-shadow: 0 20px 45px -8px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.1);
  }
}

/* Suppress Native Browser Search Cancel & Decoration Buttons (Prevents Duplicate 'X's) */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: none !important;
}

input[type="search"]::-ms-clear,
input[type="search"]::-ms-reveal {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Accessibility: Sleek High-Visibility Focus Rings for Keyboard Navigation */
:focus-visible {
  outline: 2px solid #10b981 !important;
  outline-offset: 2px !important;
}

/* Search Autocomplete Match Substring Highlight */
.search-highlight {
  background-color: rgba(16, 185, 129, 0.22);
  color: #065f46;
  border-radius: 3px;
  padding: 0.5px 2px;
  font-weight: 800;
}

.dark .search-highlight {
  background-color: rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}

/* Search Dropdown Keyboard Navigation Selected State */
.search-item-selected {
  background-color: rgba(240, 253, 244, 0.95) !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
  box-shadow: 0 4px 12px -2px rgba(16, 185, 129, 0.15);
}

.dark .search-item-selected {
  background-color: rgba(30, 41, 59, 0.95) !important;
  border-color: rgba(52, 211, 153, 0.6) !important;
  box-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.5);
}

/* Empty Cart Launchpad Pills */
.empty-cart-pill {
  transition: transform 0.16s var(--ease-spring), background-color 0.16s ease, border-color 0.16s ease;
}

.empty-cart-pill:hover {
  transform: translateY(-1.5px);
}

.empty-cart-pill:active {
  transform: scale(0.95);
}



