/* ============================================================
   EraVenda Market — global styles
   Light/dark theme variables, reduced border radii, nav icons,
   wishlist badge, flash-sale cards, settings page, responsive.
   ============================================================ */

html {
  scroll-behavior: smooth;
}

/* Hide scrollbars on horizontally-scrolling strips */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Product preview gallery */
.product-gallery-stage { touch-action: none; }
.product-main-image { overflow: hidden; cursor: zoom-in; }
.product-main-image img {
  transform: translate3d(var(--gallery-x, 0px), var(--gallery-y, 0px), 0) scale(1.16);
  transition: transform 850ms cubic-bezier(.22, .61, .36, 1);
  will-change: transform;
}
.product-gallery-stage:hover .product-main-image img,
.product-gallery-stage.is-dragging .product-main-image img {
  transform: translate3d(var(--gallery-x, 0px), var(--gallery-y, 0px), 0) scale(1.04);
}
.product-gallery-stage.is-dragging .product-main-image { cursor: grabbing; }
.product-gallery-stage.is-dragging .product-main-image img { transition-duration: 0ms; }
@media (prefers-reduced-motion: reduce) {
  .product-main-image img { transition: none; transform: none; }
}

/* ============================================================
   Theme variables — light (default) and dark
   ============================================================ */
:root {
  --ev-green: #1c6b4f;
  --ev-green-dark: #12503a;
  --ev-green-soft: #e7f2ec;
  --ev-gold: #f2a93b;
  --ev-gold-dark: #c98a22;
  --ev-ink: #14201b;
  --ev-muted: #4b564f;
  --ev-border: #e3e1d8;

  --bg-primary: #ffffff;
  --bg-secondary: #f8f7f4;
  --bg-warm: #faf9f6;
  --card-bg: #ffffff;
  --text-primary: #14201b;
  --text-secondary: #4b564f;
  --text-muted: #8a8f8c;
  --accent-color: #f2a93b;
  --accent-hover: #c98a22;
  --border-color: #e3e1d8;
  --border-radius: 6px;
  --border-radius-lg: 8px;
  --border-radius-xl: 10px;
  --shadow-sm: 0 1px 2px rgba(20, 32, 27, .05);
  --shadow-md: 0 4px 12px rgba(20, 32, 27, .08);
  --shadow-lg: 0 8px 24px rgba(20, 32, 27, .1);
  --header-bg: #ffffff;
  --footer-bg: #0b2d20;
  --input-bg: #ffffff;
  --badge-bg: #c1443a;
  --badge-text: #ffffff;
  --overlay-bg: rgba(0, 0, 0, .5);
}

html[data-theme="dark"] {
  --ev-green: #2dd4a0;
  --ev-green-dark: #1c6b4f;
  --ev-green-soft: #1a2e26;
  --ev-gold: #f59e0b;
  --ev-gold-dark: #f2a93b;
  --ev-ink: #e8e6e1;
  --ev-muted: #a3a8a5;
  --ev-border: #2d3330;

  --bg-primary: #121714;
  --bg-secondary: #1a1f1c;
  --bg-warm: #161b18;
  --card-bg: #1e2420;
  --text-primary: #e8e6e1;
  --text-secondary: #a3a8a5;
  --text-muted: #6b7270;
  --accent-color: #f59e0b;
  --accent-hover: #f2a93b;
  --border-color: #2d3330;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .4);
  --header-bg: #1a1f1c;
  --footer-bg: #0d1210;
  --input-bg: #1e2420;
  --badge-bg: #ef4444;
  --badge-text: #ffffff;
  --overlay-bg: rgba(0, 0, 0, .7);
}

body {
  overflow-x: hidden;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}

/* Dark mode overrides for common elements */
html[data-theme="dark"] body {
  color-scheme: dark;
}

html[data-theme="dark"] #siteHeader {
  background-color: var(--header-bg) !important;
  border-color: var(--border-color) !important;
}

html[data-theme="dark"] footer {
  background-color: var(--footer-bg) !important;
}

html[data-theme="dark"] .bg-white {
  background-color: var(--card-bg) !important;
}

html[data-theme="dark"] .bg-slate-50,
html[data-theme="dark"] .bg-slate-100 {
  background-color: var(--bg-secondary) !important;
}

html[data-theme="dark"] .text-slate-900,
html[data-theme="dark"] .text-slate-800,
html[data-theme="dark"] .text-slate-700 {
  color: var(--text-primary) !important;
}

html[data-theme="dark"] .text-slate-600,
html[data-theme="dark"] .text-slate-500 {
  color: var(--text-secondary) !important;
}

html[data-theme="dark"] .text-slate-400,
html[data-theme="dark"] .text-slate-300 {
  color: var(--text-muted) !important;
}

html[data-theme="dark"] .border-slate-200,
html[data-theme="dark"] .border-slate-100 {
  border-color: var(--border-color) !important;
}

html[data-theme="dark"] .hover\:bg-slate-100:hover {
  background-color: var(--bg-secondary) !important;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background-color: var(--input-bg) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* Dark mode: colored backgrounds */
html[data-theme="dark"] .bg-brand-50,
html[data-theme="dark"] .bg-brand-100 {
  background-color: #1a2e26 !important;
}

html[data-theme="dark"] .bg-teal-50,
html[data-theme="dark"] .bg-teal-100 {
  background-color: #132b25 !important;
}

html[data-theme="dark"] .bg-amber-50,
html[data-theme="dark"] .bg-amber-100 {
  background-color: #2e2512 !important;
}

html[data-theme="dark"] .bg-red-50 {
  background-color: #2e1414 !important;
}

html[data-theme="dark"] .bg-blue-50 {
  background-color: #141e2e !important;
}

html[data-theme="dark"] .bg-slate-200 {
  background-color: #2d3330 !important;
}

/* Dark mode: gradients */
html[data-theme="dark"] .bg-gradient-to-r.from-teal-50,
html[data-theme="dark"] .bg-gradient-to-r.from-brand-50 {
  background-image: linear-gradient(to right, var(--bg-secondary), var(--card-bg)) !important;
}

/* Dark mode: colored text */
html[data-theme="dark"] .text-brand-600,
html[data-theme="dark"] .text-brand-700 {
  color: #2dd4a0 !important;
}

html[data-theme="dark"] .text-brand-800,
html[data-theme="dark"] .text-brand-900 {
  color: #34d399 !important;
}

html[data-theme="dark"] .text-teal-600,
html[data-theme="dark"] .text-teal-700,
html[data-theme="dark"] .text-teal-800 {
  color: #2dd4a0 !important;
}

html[data-theme="dark"] .text-amber-600,
html[data-theme="dark"] .text-amber-700,
html[data-theme="dark"] .text-amber-800 {
  color: #fbbf24 !important;
}

html[data-theme="dark"] .text-red-600,
html[data-theme="dark"] .text-red-700 {
  color: #f87171 !important;
}

html[data-theme="dark"] .text-blue-600,
html[data-theme="dark"] .text-blue-700 {
  color: #60a5fa !important;
}

/* Dark mode: colored borders */
html[data-theme="dark"] .border-brand-100,
html[data-theme="dark"] .border-brand-200 {
  border-color: #1a3a2e !important;
}

html[data-theme="dark"] .border-teal-100,
html[data-theme="dark"] .border-teal-200 {
  border-color: #1a3a2e !important;
}

html[data-theme="dark"] .border-amber-100,
html[data-theme="dark"] .border-amber-200 {
  border-color: #3a2e1a !important;
}

html[data-theme="dark"] .border-red-100,
html[data-theme="dark"] .border-red-200 {
  border-color: #3a1a1a !important;
}

/* Dark mode: hover backgrounds */
html[data-theme="dark"] .hover\:bg-slate-50:hover,
html[data-theme="dark"] .hover\:bg-brand-50:hover {
  background-color: var(--bg-secondary) !important;
}

html[data-theme="dark"] .hover\:border-brand-500:hover {
  border-color: var(--ev-green) !important;
}

html[data-theme="dark"] .hover\:text-brand-600:hover,
html[data-theme="dark"] .hover\:text-brand-700:hover,
html[data-theme="dark"] .hover\:text-brand-800:hover {
  color: #2dd4a0 !important;
}

html[data-theme="dark"] .hover\:text-teal-800:hover {
  color: #2dd4a0 !important;
}

html[data-theme="dark"] .hover\:bg-teal-100:hover {
  background-color: #1a3a2e !important;
}

/* Dark mode: promo cards */
html[data-theme="dark"] .bg-brand-900,
html[data-theme="dark"] .bg-brand-950 {
  background-color: #0d1a14 !important;
}

html[data-theme="dark"] .bg-teal-800 {
  background-color: #132b25 !important;
}

html[data-theme="dark"] .border-white\/20 {
  border-color: rgba(255, 255, 255, .1) !important;
}

/* Dark mode: status pills */
html[data-theme="dark"] .bg-brand-50 {
  background-color: #1a2e26 !important;
}

/* Dark mode: user menu dropdown */
html[data-theme="dark"] .ev-user-dropdown {
  background-color: var(--card-bg) !important;
  border-color: var(--border-color) !important;
}

html[data-theme="dark"] .ev-user-dropdown a:hover,
html[data-theme="dark"] .ev-user-dropdown button:hover {
  background-color: var(--bg-secondary) !important;
}

html[data-theme="dark"] .ev-user-dropdown .border-slate-100 {
  border-color: var(--border-color) !important;
}

html[data-theme="dark"] .ev-user-menu-btn:hover {
  background-color: var(--bg-secondary) !important;
}

html[data-theme="dark"] a {
  color: var(--ev-green);
}

/* ============================================================
   Shared page rhythm
   ============================================================ */
main > section,
main > div {
  scroll-margin-top: 90px;
}

a, button, input, select, textarea {
  -webkit-tap-highlight-color: transparent;
}

.table-scroll,
.overflow-x-auto {
  scrollbar-width: thin;
}

/* Tables need a minimum width to stay legible, but that must only ever
   apply inside a horizontally-scrollable wrapper — an unscoped rule here
   would force every <table> on the site (wrapped or not) to blow out
   narrow viewports and cause page-level horizontal scroll on mobile. */
.table-scroll table,
.overflow-x-auto table {
  min-width: 620px;
}

[class*="rounded-2xl"], [class*="rounded-xl"] {
  overflow-wrap: anywhere;
}

/* Phones (iPhone 12 / 12 mini and similar, 375–430px).
   `overflow-wrap: anywhere` lets flex/grid items shrink below the width of a
   single word, which is what stacked words like "Handyma/n" or "activ/e" into
   a letter-per-line block. `break-word` keeps each word whole when the layout
   is sized, and only splits a word if it is wider than its whole container
   (e.g. a very long email). Anything that then doesn't fit gets a smaller
   font size instead of being chopped up. */
@media (max-width: 430px) {
  [class*="rounded-2xl"], [class*="rounded-xl"] {
    overflow-wrap: break-word;
  }

  /* A `.grid` that only declares columns at sm:/md:/lg: gets a single `auto`
     track on phones, and an auto track grows to its widest child instead of
     the screen (cart rows, admin stat cards, etc. ran 600px+ wide and got cut
     off). Give those a one-column, shrinkable track. :where() keeps this at
     zero specificity so every explicit grid-cols-* class still wins. */
  :where(.grid) {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ============================================================
   Header & navigation
   ============================================================ */
#siteHeader {
  background-color: var(--header-bg);
  box-shadow: 0 1px 0 rgba(20, 32, 27, .03);
}

html[data-theme="dark"] #siteHeader {
  box-shadow: 0 1px 0 rgba(0, 0, 0, .2);
}

#siteHeader nav a,
#siteHeader nav button {
  text-decoration: none;
}

#siteHeader nav a:not(.category-link),
#siteHeader nav button {
  transition: color .18s ease, background-color .18s ease;
}

#siteHeader .ev-nav-icon {
  display: inline-flex;
  width: 1rem;
  justify-content: center;
  flex: 0 0 1rem;
}

#siteHeader .ev-nav-item:hover {
  background: var(--ev-green-soft);
  border-radius: var(--border-radius);
}

#siteHeader .ev-nav-text { color: var(--ev-ink); }
#siteHeader .ev-nav-icon-green { color: var(--ev-green); }
#siteHeader .ev-nav-icon-gold { color: var(--ev-gold-dark); }
#siteHeader .ev-nav-icon-blue { color: #2a5faa; }
#siteHeader .ev-nav-icon-red { color: #c1443a; }
#siteHeader .ev-nav-icon-teal { color: #0d9488; }
#siteHeader .ev-nav-icon-purple { color: #7c3aed; }
#siteHeader .ev-nav-icon-orange { color: #ea580c; }

/* User dropdown menu — replaces inline nav links to prevent overflow */
.ev-user-menu-btn {
  position: relative;
  z-index: 51;
}

.ev-user-dropdown {
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

.ev-user-dropdown a:focus-visible,
.ev-user-dropdown button:focus-visible {
  background: var(--ev-green-soft);
  outline: none;
}

/* Close dropdown when focus leaves the user links area */
#userLinks:not(:focus-within) .ev-user-dropdown {
  /* dropdown stays as-is; JS handles open/close via .hidden */
}

@media (max-width: 640px) {
  .ev-user-dropdown {
    right: -0.5rem;
    width: calc(100vw - 2rem);
    max-width: 320px;
  }
}

/* Wishlist counter badge */
.wishlist-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

/* ============================================================
   Quick-action buttons on product cards
   ============================================================ */
.card-quick-actions {
  position: absolute;
  right: 8px;
  top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity .2s ease, transform .2s ease;
  z-index: 10;
}

article:hover .card-quick-actions,
.group:hover .card-quick-actions {
  opacity: 1;
  transform: translateX(0);
}

.card-quick-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--border-radius);
  background: rgba(255, 255, 255, .92);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: background .15s ease, color .15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
  border: none;
  cursor: pointer;
}

html[data-theme="dark"] .card-quick-btn {
  background: rgba(30, 36, 32, .92);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}

.card-quick-btn:hover {
  background: var(--ev-green);
  color: #fff;
}

.card-quick-btn.wishlist-btn:hover,
.card-quick-btn.wishlist-active {
  background: #c1443a;
  color: #fff;
}

.card-quick-btn.quick-view-btn:hover {
  background: var(--ev-gold-dark);
  color: #fff;
}

/* ============================================================
   Flash sale section
   ============================================================ */
.flash-sale-card {
  position: relative;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  background: var(--card-bg);
  transition: border-color .2s ease, box-shadow .2s ease, transform .25s ease;
}

.flash-sale-card:hover {
  border-color: var(--ev-green);
  box-shadow: 0 4px 20px rgba(220, 38, 38, 0.12), var(--shadow-md);
  transform: translateY(-2px);
}

.flash-sale-card .discount-badge {
  animation: flash-pulse 2s ease-in-out infinite;
}

.flash-sale-timer {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--border-radius);
  letter-spacing: .02em;
  animation: flash-header-pulse 3s ease-in-out infinite;
}

.flash-sale-timer i {
  font-size: 9px;
  animation: flash-bolt 1.5s ease-in-out infinite;
}

@keyframes flash-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@keyframes flash-header-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}

@keyframes flash-bolt {
  0%, 100% { opacity: 1; transform: rotate(0deg); }
  25% { opacity: 0.7; transform: rotate(-8deg); }
  75% { opacity: 1; transform: rotate(8deg); }
}

.flash-sale-card .flash-shimmer {
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  pointer-events: none;
  z-index: 5;
  animation: flash-shimmer 4s ease-in-out infinite;
}

@keyframes flash-shimmer {
  0% { left: -100%; }
  30% { left: 150%; }
  100% { left: 150%; }
}

/* ============================================================
   Promotional banners
   ============================================================ */
.promo-banner {
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  position: relative;
  min-height: 200px;
}

/* ============================================================
   Settings page
   ============================================================ */
.settings-section {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.settings-section h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-back {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 2.5rem;
  padding: 0 .9rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: .875rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease;
}
.settings-back:hover { border-color: var(--ev-green, currentColor); }
.settings-back:focus-visible { outline: 2px solid var(--ev-green, currentColor); outline-offset: 2px; }
.settings-back i { transition: transform .15s ease; }
.settings-back:hover i { transform: translateX(-2px); }
@media (prefers-reduced-motion: reduce) {
  .settings-back, .settings-back i { transition: none; }
  .settings-back:hover i { transform: none; }
}

.settings-label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-description {
  font-size: .75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  border-radius: 12px;
  transition: background-color .2s ease;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: transform .2s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--ev-green);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

html[data-theme="dark"] .toggle-slider {
  background-color: #374151;
}

/* Professional appearance toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-secondary);
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.theme-toggle-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 68px;
  min-height: 36px;
  padding: 7px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.theme-toggle-option i { font-size: .8rem; }
.theme-toggle-option:hover { color: var(--text-primary); }
.theme-toggle-option.active {
  background: var(--card-bg);
  color: var(--text-primary);
  box-shadow: 0 2px 7px rgba(15, 23, 42, .12);
}
.theme-toggle-option:focus-visible {
  outline: 2px solid var(--ev-green);
  outline-offset: 2px;
}
@media (max-width: 520px) {
  /* Wrap so a wide control (the theme toggle) drops under its label instead of
     pushing past the edge of the card. */
  .settings-row { align-items: flex-start; flex-wrap: wrap; gap: 12px; }
  .theme-toggle { width: 100%; max-width: 250px; }
  .theme-toggle-option { flex: 1; min-width: 0; padding-inline: 7px; }
  .theme-toggle-option span { font-size: .7rem; }
}
/* ============================================================
   Homepage responsive polish
   ============================================================ */
#hero-slideshow h1 {
  text-wrap: balance;
}
#hero-slideshow .slide img {
  object-position: center;
}

@media (max-width: 767px) {
  #hero-slideshow {
    min-height: 560px;
  }

  #hero-slideshow .relative.z-10 {
    padding-top: 5.5rem;
    padding-bottom: 4.5rem;
  }

  #hero-slideshow h1 {
    font-size: clamp(2.15rem, 10vw, 3.25rem);
    line-height: 1.08;
  }

  #hero-slideshow p {
    font-size: .98rem;
  }

  #hero-slideshow .mt-8 > a {
    width: 100%;
  }

  main .max-w-7xl,
  main .max-w-5xl,
  main .max-w-4xl,
  main .max-w-3xl,
  main .max-w-2xl {
    max-width: 100%;
  }

  main .px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  #promoCarousel {
    scroll-snap-type: x mandatory;
    padding-bottom: .25rem;
  }

  #promoCarousel > * {
    scroll-snap-align: start;
  }

  main .grid.grid-cols-2 {
    gap: .75rem;
  }

  h1, h2, h3 {
    text-wrap: balance;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .cart-item {
    grid-template-columns: 52px 1fr;
    gap: 10px;
  }
  .cart-item > :nth-child(3),
  .cart-item > :nth-child(4) {
    grid-column: 2;
  }
  .cart-item img {
    width: 52px;
    height: 52px;
  }

  .card-quick-actions {
    opacity: 1;
    transform: none;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  #hero-slideshow {
    min-height: 590px;
  }

  #siteHeader nav {
    gap: .65rem;
  }

  #siteHeader .header-account-label {
    display: none;
  }
}

@media (max-width: 1023px) {
  .dash-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .dash-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--ev-border);
  }

  .dash-nav a {
    flex: 0 0 auto;
  }

  .checkout-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .form-card {
    margin: 1.5rem auto;
    padding: 1.25rem;
    border-radius: var(--border-radius-lg);
  }

  .section {
    padding: 1.75rem 0;
  }

  .section-head {
    align-items: flex-start;
    gap: .75rem;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
  }

  .product-info {
    padding: .65rem .7rem .8rem;
  }

  .product-name {
    font-size: .8rem;
  }

  .overflow-x-auto {
    max-width: 100%;
  }

  .card {
    padding: 1rem;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
  }

  .stat-card {
    padding: .8rem;
  }

  .stat-card .value {
    font-size: 1.3rem;
  }

  .settings-section {
    padding: 1rem;
  }
}

@media (max-width: 420px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .product-grid {
    grid-template-columns: 1fr 1fr;
  }

  #mobileDrawer {
    max-height: calc(100vh - 70px);
    overflow-y: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}


/* ============================================================
   Responsive navigation fit
   Keeps the header usable from narrow phones through desktops.
   Navigation-only overrides; page content/layout remains unchanged.
   ============================================================ */

#siteHeader {
  width: 100%;
  max-width: 100vw;
}

#siteHeader > div:first-child {
  min-width: 0;
}

#siteHeader .ev-logo-svg {
  width: 200px;
  height: auto;
  max-width: 100%;
}

#siteHeader nav[aria-label="Primary navigation"] {
  min-width: 0;
}

#siteHeader nav[aria-label="Primary navigation"] .ev-nav-item {
  min-width: 0;
}

#siteHeader nav[aria-label="Primary navigation"] .ev-nav-item > span {
  white-space: nowrap;
}

#siteHeader form[action="/products"] {
  min-width: 0;
}

#siteHeader form[action="/products"] input {
  min-width: 0;
}

#siteHeader #mobileDrawer {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#siteHeader #mobileDrawer a,
#siteHeader #mobileDrawer summary {
  min-height: 40px;
}

#siteHeader #mobileDrawer input {
  min-width: 0;
}

@media (max-width: 1023px) {
  #siteHeader .ev-logo-svg {
    width: 180px;
  }
}

@media (max-width: 639px) {
  #siteHeader .ev-logo-svg {
    width: 155px;
  }

  #siteHeader #mobileDrawer {
    max-height: calc(100dvh - 58px);
  }

  #siteHeader #mobileDrawer > form {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-bottom: 2px;
    background: var(--header-bg);
  }
}

@media (max-width: 380px) {
  #siteHeader .ev-logo-svg {
    width: 138px;
  }

  #siteHeader #mobileDrawer {
    padding-left: 12px;
    padding-right: 12px;
  }

  #siteHeader #mobileDrawer .grid.grid-cols-3 span {
    display: none;
  }
}

@media (min-width: 1024px) and (max-width: 1180px) {
  #siteHeader .ev-logo-svg {
    width: 175px;
  }

  #siteHeader nav[aria-label="Primary navigation"] {
    font-size: 0.8rem;
  }

  #siteHeader nav[aria-label="Primary navigation"] .ev-nav-item {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }

  #siteHeader nav[aria-label="Primary navigation"] .ev-nav-item > span {
    max-width: 105px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Category strip — horizontal slider, arrows scroll it, no wrap/visible scrollbar */
#categoryStrip {
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#categoryStrip::-webkit-scrollbar {
  display: none;
}



/* Seller-defined product color swatches */
.color-preview-choice:focus-visible, .color-choice:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.color-preview-swatch { flex: 0 0 auto; }
@media (max-width: 640px) { .color-row { grid-template-columns: 1fr 1fr; } .color-row .remove-color { grid-column: 1 / -1; } }

/* Seller color editor: make the native picker and exact HEX field feel like one control. */
.color-row:focus-within { border-color: currentColor; }
.color-preview-choice:hover { transform: translateY(-1px); }
.color-preview-choice[aria-pressed="true"] { box-shadow: 0 0 0 2px currentColor; }

/* ============================================================
   Homepage Redesign Styles — Mode Switcher, Countdown, Tabs, Modal
   ============================================================ */

/* Hero Mode Switcher */
.hero-mode-btn {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.hero-mode-btn.active {
  background-color: #ffffff;
  color: #0f172a;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
html[data-theme="dark"] .hero-mode-btn.active {
  background-color: #1e293b;
  color: #f8fafc;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

/* Flash Countdown Boxes */
.countdown-box {
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  border-radius: 6px;
  min-width: 44px;
  padding: 4px 6px;
  text-align: center;
  font-family: var(--font-head, 'Space Grotesk', sans-serif);
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.countdown-box .val {
  font-size: 1.15rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.countdown-box .lbl {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
  font-weight: 500;
}

/* Stock Scarcity Progress Bar */
.flash-stock-track {
  width: 100%;
  height: 6px;
  background: #f1f5f9;
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}
html[data-theme="dark"] .flash-stock-track {
  background: #334155;
}
.flash-stock-bar {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  transition: width 0.6s ease;
}

/* Trade & Services Category Cards */
.trade-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.trade-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px -5px rgba(15, 118, 110, 0.12), 0 8px 10px -6px rgba(15, 118, 110, 0.08);
  border-color: #14b8a6;
}

/* Product Filter Tabs */
.product-filter-tab {
  transition: all 0.2s ease;
}
.product-filter-tab.active {
  background-color: var(--ev-green, #1c6b4f);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(28, 107, 79, 0.25);
}

/* Quick View Dialog Modal */
dialog#quickViewModal {
  position: fixed;
  inset: 0;
  margin: auto;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 14px;
  padding: 0;
  width: calc(100% - 2rem);
  max-width: 820px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--card-bg, #ffffff);
  color: var(--text-primary, #0f172a);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  z-index: 9999;
}
dialog#quickViewModal::backdrop {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
dialog#quickViewModal[open] {
  animation: qvFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes qvFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}


/* ============================================================
   Special Campaigns — attention-grabbing flash on the banner images
   ============================================================ */
@keyframes campaignGlowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
  50% { box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.45); }
}
.campaign-flash {
  animation: campaignGlowPulse 2.4s ease-in-out infinite;
}
.campaign-flash .campaign-flash-sweep {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.55) 50%, transparent 60%);
  background-size: 250% 250%;
  background-position: -100% -100%;
  animation: campaignSweep 3.6s ease-in-out infinite;
}
@keyframes campaignSweep {
  0% { background-position: -120% -120%; }
  35%, 100% { background-position: 120% 120%; }
}
@media (prefers-reduced-motion: reduce) {
  .campaign-flash { animation: none; }
  .campaign-flash .campaign-flash-sweep { animation: none; display: none; }
}

/* ============================================================
   Products page — mobile quick-filter chips
   ============================================================ */
.quick-chip {
  background: #ffffff;
  border-color: #cbd5e1; /* slate-300 */
  color: #475569; /* slate-600 */
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.quick-chip.active {
  background: #1c6b4f; /* brand-500 */
  border-color: #1c6b4f;
  color: #ffffff;
}

/* ============================================================
   Rich text editor — seller add/edit product description field
   (bold/italic/underline/bulleted list). Shared by add-product.html
   and edit-product.html via initRichTextEditor() in main.js.
   ============================================================ */
.rich-text-input {
  min-height: 110px;
}
.rich-text-input:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8; /* slate-400, matches other placeholder text on the page */
  pointer-events: none;
}
.rich-text-toolbar button[data-rt-active="true"] {
  background: #1c6b4f; /* brand-500 */
  color: #ffffff;
}

/* ============================================================
   Rich text content — renders the sanitized HTML sellers write with the
   description editor above. Tailwind's reset strips default list/paragraph
   styling, so restore just enough for a seller's bullets and paragraph
   breaks to actually show up on the product page.
   ============================================================ */
.rich-text-content p { margin-bottom: 0.75em; }
.rich-text-content p:last-child { margin-bottom: 0; }
.rich-text-content ul { list-style: disc; padding-left: 1.25em; margin-bottom: 0.75em; }
.rich-text-content ol { list-style: decimal; padding-left: 1.25em; margin-bottom: 0.75em; }
.rich-text-content li { margin-bottom: 0.25em; }
