/* =========================================================
   Category Page Styles
   ========================================================= */

/* ---- Design tokens ---- */
:root {
  --bg-page: #f4f5f7;
  --header-bg: #072908;
  --accent: #072908;
  --accent-light: #0b4f2d;

  --card-bg: #ffffff;
  --card-border: #e5e7eb;
  --surface-1: rgba(0,0,0,0.03);
  --surface-2: rgba(0,0,0,0.06);
  --surface-3: rgba(0,0,0,0.12);

  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6b7280;

  --radius-lg: 10px;
  --shadow-outer: 0 6px 16px rgba(0,0,0,.10);
}

html { scroll-behavior: smooth; }

/* ---- Full-page background (matches homepage) ---- */
html, body {
  height: 100%;
  min-height: 100vh;
}

body {
  background-color: var(--bg-page);

  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text-secondary);
}

/* =========================================================
   Brand Header
   ========================================================= */
.brand-header {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--header-bg);
  border-bottom: 1px solid rgba(0,0,0,.08);
  backdrop-filter: blur(6px);
  color: var(--text-primary);
  flex-wrap: wrap;
  gap: 8px;
}

.brand-logo {
  height: 65px; max-width: 250px; object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.15));
  cursor: pointer; transition: transform .25s ease;
}
.brand-logo:hover { transform: scale(1.02); }

.brand-actions {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text-primary);
  flex-wrap: wrap;
}

.auth-status {
  font-weight: 600;
  color: #fff;
  opacity: 0.85;
  margin-right: 12px;
  white-space: nowrap;
}

/* Pill button */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 8px 14px; border-radius: 999px;
  font-weight: 600; border: 1px solid rgba(255,255,255,0.2);
  cursor: pointer; line-height: 1;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease, transform .08s ease;
}
.btn-label-short { display: none; }

.btn-secondary {
  background: transparent;
  color: #fff;
  border: none;
  box-shadow: none;
  font-size: 14px;
  text-decoration: none;
}
.btn-secondary:hover {
  background: transparent;
  color: rgba(255,255,255,0.75);
}

/* Beta feedback button — prominent in header */
.btn-feedback { background: #e8a020; color: #fff; border: none; font-size: 14px; text-decoration: none; }
.btn-feedback:hover { background: #d18f18; color: #fff; transform: none; text-decoration: none; }

/* =========================================================
   Category Page Layout
   ========================================================= */
.category-page {
  max-width: 1500px;
  margin: 0 auto;
  /* Fluid gutter — below 1500px there's no auto-margin left, so a fixed 4px
     ran product cards flush into the window edge on laptops. */
  padding: 0 clamp(16px, 2vw, 28px) 100px;
}

/* ---- Category nav (matches homepage) ---- */
.category-nav {
  position: sticky; top: 58px; z-index: 999;
  background: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}
.category-nav-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.category-nav-inner::-webkit-scrollbar { display: none; }
.category-nav-link {
  display: inline-flex; align-items: center;
  flex-direction: column; gap: 4px;
  padding: 10px 16px;
  font-size: 13px; font-weight: 600;
  color: #555;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
}
.cat-nav-icon { width: 22px; height: 22px; flex-shrink: 0; }
.cat-nav-label { line-height: 1; }
.category-nav-link:hover {
  color: #072908;
  border-bottom-color: #072908;
}
.category-nav-link.active {
  color: #072908;
  border-bottom-color: #072908;
  font-weight: 700;
}

/* ---- Subcategory Hero (tan band below nav, mirrors homepage "Good stuff, sorted") ---- */
.subcategory-hero {
  width: 100%;
  margin: 0;
  padding: 20px 0 24px;
  background: #f0ebe1;
  border-bottom: 1px solid #e4ddd0;
  box-sizing: border-box;
}

.subcategory-hero-wrap {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 16px;
}

.subcategory-hero-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 16px;
  padding: 0 0 0 14px;
  border-left: 3px solid var(--accent, #072908);
  text-align: left;
}

.subcategory-hero-title {
  font-size: 22px;
  color: #111827;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.3px;
  text-transform: none;
}


/* Legacy class (kept for JS references) */
.category-hero {
  text-align: left;
  padding: 20px 0 4px;
  margin-bottom: 0;
}

.category-hero h1 {
  color: #1a1a1a;
  font-size: 13px;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

/* =========================================================
   Category Wheel (Quince-style scrolling circles)
   ========================================================= */
.filter-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  justify-content: space-between;
  padding: 8px 0 16px;
  margin: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }

/* Circle chip (category wheel) */
.filter-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 72px;
  box-shadow: none;
}

.filter-chip {
  flex: 1 1 0;
  min-width: 0;
}
.filter-chip .chip-circle {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: var(--chip-bg, #072908);
  border: 2px solid var(--chip-bg, #072908);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  overflow: hidden;
}

/* Rotating pastel palette for subcategory circles */
.filter-chip:nth-child(1)  { --chip-bg: #2e8b3e; } /* green */
.filter-chip:nth-child(2)  { --chip-bg: #5b8a72; } /* sage */
.filter-chip:nth-child(3)  { --chip-bg: #7a6e8a; } /* muted purple */
.filter-chip:nth-child(4)  { --chip-bg: #8a6e6e; } /* dusty rose */
.filter-chip:nth-child(5)  { --chip-bg: #6e7f8a; } /* slate blue */
.filter-chip:nth-child(6)  { --chip-bg: #8a7e5a; } /* olive gold */
.filter-chip:nth-child(7)  { --chip-bg: #5a7a8a; } /* teal */
.filter-chip:nth-child(8)  { --chip-bg: #8a5a6e; } /* mauve */
.filter-chip:nth-child(9)  { --chip-bg: #6a8a5a; } /* moss */
.filter-chip:nth-child(10) { --chip-bg: #7a6a5a; } /* warm taupe */
.filter-chip:nth-child(11) { --chip-bg: #5a6a8a; } /* periwinkle */
.filter-chip:nth-child(12) { --chip-bg: #8a6a7a; } /* plum */
.filter-chip:nth-child(13) { --chip-bg: #6a8a7a; } /* seafoam */
.filter-chip:nth-child(14) { --chip-bg: #7a8a5a; } /* chartreuse */
.filter-chip:nth-child(15) { --chip-bg: #5a8a7a; } /* jade */

.filter-chip .chip-circle svg {
  width: 48px;
  height: 48px;
  color: #ffffff;
  opacity: 1;
  transition: transform 0.2s ease;
}
.filter-chip .chip-circle img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.filter-chip:hover .chip-circle img,
.filter-chip.active .chip-circle img {
  opacity: 0.85;
}

.filter-chip:hover .chip-circle {
  box-shadow: 0 6px 16px rgba(0,0,0,0.28);
  transform: translateY(-2px);
}

.filter-chip.active .chip-circle {
  background: var(--chip-bg, #072908);
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--chip-bg, #072908), 0 6px 16px rgba(0,0,0,0.3);
}

.filter-chip.active {
  color: var(--accent);
  font-weight: 700;
}

.filter-chip .chip-label {
  font-size: 13px;
  line-height: 1.2;
  text-align: center;
  max-width: 120px;
}

/* =========================================================
   Toolbar (Filter + inline dropdowns left, count + score right)
   ========================================================= */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  margin: 0 0 8px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}


/* Inline toolbar select (Sort By, Store, etc.) */
.toolbar-select {
  padding: 8px 28px 8px 12px;
  border-radius: 999px;
  border: 1.5px solid rgba(0,0,0,0.12);
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  color: #1a1a1a;
  cursor: pointer;
  transition: all 0.15s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.toolbar-select:hover { border-color: rgba(0,0,0,0.35); }
.toolbar-select:focus { outline: none; border-color: var(--accent); }

.filter-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; font-weight: 700; font-size: 13px;
  background: #ffffff; color: #000000;
  border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: 999px;
  cursor: pointer; transition: all 0.2s ease;
}
.filter-toggle svg { flex-shrink: 0; }
.filter-toggle:hover {
  border-color: var(--accent);
}
.filter-count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1;
}

/* Score Mode Toggle */
.score-mode {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  user-select: none;
}

.score-mode__label {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}
.brand-header .score-mode__label { color: #fff; font-size: 14px; font-weight: 600; }

/* iOS-style checkbox switch */
.score-switch {
  --w: 38px;
  --h: 22px;
  --p: 3px;
  appearance: none;
  width: var(--w);
  height: var(--h);
  background: #c9c9c9;
  border-radius: var(--h);
  position: relative;
  outline: none;
  cursor: pointer;
  transition: background 120ms ease;
}
.score-switch::after {
  content: '';
  position: absolute;
  top: var(--p);
  left: var(--p);
  width: calc(var(--h) - 2*var(--p));
  height: calc(var(--h) - 2*var(--p));
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
  transition: transform 120ms ease;
}
.score-switch:checked { background: #0b4f2d; }
.score-switch:checked::after { transform: translateX(calc(var(--w) - var(--h))); }

/* =========================================================
   Filter Overlay + Drawer
   ========================================================= */
.filter-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1100;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.filter-overlay.active { opacity: 1; pointer-events: auto; }

.filter-drawer {
  position: fixed; top: 0; left: 0;
  width: 360px; max-width: 85vw; height: 100vh;
  background: #ffffff;
  z-index: 1200;
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}
.filter-drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  flex-shrink: 0;
}
.drawer-header-left { display: flex; align-items: center; gap: 8px; }
.drawer-title {
  font-size: 14px; font-weight: 800;
  letter-spacing: 1px; color: #1a1a1a;
}
.drawer-filter-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700;
}
.drawer-filter-count:empty { display: none; }
.drawer-close {
  width: 32px; height: 32px; border: none; background: none;
  font-size: 24px; color: #666; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: background 0.15s ease;
}
.drawer-close:hover { background: rgba(0,0,0,0.06); color: #333; }

.drawer-active-pills {
  padding: 10px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  flex-shrink: 0;
}
.drawer-active-pills-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.drawer-pills-clear {
  background: none; border: none;
  color: var(--accent); font-size: 12px; font-weight: 700;
  cursor: pointer; text-decoration: underline; padding: 0;
}

.drawer-body { flex: 1; overflow-y: auto; padding: 4px 0; }

.drawer-section { padding: 14px 20px; }
.drawer-section-title {
  font-size: 12px; font-weight: 800;
  letter-spacing: 0.8px; color: #1a1a1a;
  margin-bottom: 10px;
}
.drawer-divider { height: 1px; background: rgba(0, 0, 0, 0.06); margin: 0 20px; }

.drawer-footer {
  display: flex; gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid rgba(0,0,0,0.1);
  background: #fff; flex-shrink: 0;
}
.drawer-btn-clear {
  flex: 0 0 auto; padding: 12px 24px;
  border: 2px solid rgba(0,0,0,0.15); border-radius: 999px;
  background: #fff; color: #1a1a1a;
  font-size: 13px; font-weight: 700; letter-spacing: 0.5px;
  cursor: pointer; transition: all 0.15s ease;
}
.drawer-btn-clear:hover { border-color: rgba(0,0,0,0.3); }
.drawer-btn-view {
  flex: 1; padding: 12px 24px;
  border: none; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 700; letter-spacing: 0.5px;
  cursor: pointer; transition: all 0.15s ease;
}
.drawer-btn-view:hover { background: var(--accent-light); }

/* Active filter pills */
.active-filter-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 999px;
  background: #f3f4f6; border: 1px solid rgba(0,0,0,0.2);
  font-size: 12px; font-weight: 600; color: var(--accent);
  white-space: nowrap;
}
.active-filter-pill .pill-remove {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(0,0,0,0.15); border: none;
  color: var(--accent); font-size: 12px; font-weight: 700; line-height: 1;
  cursor: pointer; padding: 0; margin-left: 2px;
  transition: background 0.15s ease;
}
.active-filter-pill .pill-remove:hover { background: rgba(0,0,0,0.3); }

.active-filters-bar {
  display: flex; align-items: center; gap: 8px;
  justify-content: center; flex-wrap: wrap;
  max-width: 1000px; margin: 0 auto;
  padding: 8px 0 4px;
}
.active-filters-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.active-filters-clear {
  background: none; border: none;
  color: var(--accent); font-size: 12px; font-weight: 700;
  cursor: pointer; text-decoration: underline; padding: 2px 4px;
}

/* =========================================================
   Drawer form controls
   ========================================================= */
.fp-select {
  padding: 9px 32px 9px 12px;
  border-radius: 8px;
  border: 1.5px solid rgba(0, 0, 0, 0.12);
  font-size: 13px; font-weight: 600;
  background: #ffffff; color: #1a1a1a;
  cursor: pointer; transition: all 0.15s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.fp-select:hover { border-color: rgba(0, 0, 0, 0.35); }
.fp-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.12); }
.fp-select--full { width: 100%; }

.fp-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.fp-tag {
  display: inline-flex !important; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 8px;
  border: 1.5px solid rgba(0, 0, 0, 0.2);
  background: #ffffff; font-size: 12px !important; font-weight: 700;
  color: #2d3e35 !important; cursor: pointer;
  transition: all 0.15s ease; margin: 0 !important; user-select: none;
}
.fp-tag:hover { border-color: var(--accent); background: #f3f4f6; }
.fp-tag:has(input:checked) {
  background: var(--accent); color: #fff !important;
  border-color: var(--accent); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.fp-tag input[type="checkbox"] {
  width: 0; height: 0; opacity: 0; position: absolute; pointer-events: none;
}

/* Facet availability: hide brand-value / ESG tags (and empty sections + their
   preceding divider) that no product in the current filtered set would match. */
.fp-tag--unavailable { display: none !important; }
.drawer-section--empty { display: none !important; }
.drawer-divider:has(+ .drawer-section--empty) { display: none !important; }

.fp-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.fp-pill {
  display: inline-flex !important; align-items: center;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #ffffff; font-size: 11px !important; font-weight: 600;
  color: #555 !important; cursor: pointer;
  transition: all 0.15s ease; margin: 0 !important;
  user-select: none; line-height: 1.4;
}
.fp-pill:hover { border-color: var(--accent); color: var(--accent) !important; background: #f5faf7; }
.fp-pill:has(input:checked) {
  background: var(--accent); color: #fff !important;
  border-color: var(--accent); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.fp-pill input[type="checkbox"] {
  width: 0; height: 0; opacity: 0; position: absolute; pointer-events: none;
}

/* =========================================================
   Products Grid
   ========================================================= */
.products-container {
  margin-top: 8px;
  padding-bottom: 16px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.products-grid > .product-card {
  min-width: 0;
}

/* Load More button */
.load-more-btn {
  display: block;
  margin: 32px auto 16px;
  padding: 12px 36px;
  background: #2d6a4f;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.load-more-btn:hover:not(:disabled) {
  background: #1b4332;
}
.load-more-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Card entrance animation */
@keyframes cardFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.products-grid > .product-card {
  animation: cardFadeIn 0.35s ease forwards;
}

.products-grid > .product-card:nth-child(1)  { animation-delay: 0.00s; }
.products-grid > .product-card:nth-child(2)  { animation-delay: 0.04s; }
.products-grid > .product-card:nth-child(3)  { animation-delay: 0.08s; }
.products-grid > .product-card:nth-child(4)  { animation-delay: 0.10s; }
.products-grid > .product-card:nth-child(5)  { animation-delay: 0.14s; }
.products-grid > .product-card:nth-child(6)  { animation-delay: 0.18s; }
.products-grid > .product-card:nth-child(7)  { animation-delay: 0.20s; }
.products-grid > .product-card:nth-child(8)  { animation-delay: 0.24s; }
.products-grid > .product-card:nth-child(9)  { animation-delay: 0.28s; }

.products-grid > .product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  border-color: #d1d5db;
}

/* =========================================================
   Loading / Empty States
   ========================================================= */
.loading-state,
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 18px;
}

.empty-state {
  background: rgba(255,255,255,0.5);
  border-radius: 16px;
  padding: 80px 20px;
}

/* =========================================================
   Back-to-top button
   ========================================================= */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 800;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.15s ease;
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-to-top:hover {
  background: var(--accent-light);
  transform: translateY(-2px);
}

/* =========================================================
   Responsive
   ========================================================= */

/* Hide "Cart" label on desktop */
.cart-label { display: none; }


@media (max-width: 900px) {
  .category-hero { padding: 16px 0 4px; }

  .subcategory-hero { padding: 16px 0 20px; }
  .subcategory-hero-header { margin-bottom: 12px; }
  .subcategory-hero-title { font-size: 20px; }

  .filter-chips { gap: 16px; }
  .filter-chip .chip-circle { width: 60px; height: 60px; }
  .filter-chip .chip-circle img { width: 36px; height: 36px; }
  .filter-chip .chip-label { font-size: 11px; }

  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }

  .category-page { padding: 0 24px 60px; }

  .toolbar-select { display: none; }
}

@media (max-width: 640px) {
  .btn-label-full { display: none; }
  .btn-label-short { display: none; }
  #userProfileBtn { padding: 6px !important; }
  #userProfileBtn svg { width: 14px; height: 14px; }

  .brand-header {
    padding: 12px 16px 10px;
    gap: 0;
    flex-wrap: wrap;
  }
  .brand-logo {
    height: 48px;
    max-width: 130px;
    order: 1;
  }
  .brand-actions {
    order: 2;
    margin-left: auto;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .brand-header .auth-status { display: none; }
  .brand-header .btn-secondary {
    padding: 5px 8px;
    font-size: 12px;
    gap: 5px;
    white-space: nowrap;
  }
  .brand-header .btn-secondary svg { width: 14px; height: 14px; flex-shrink: 0; }
  .brand-header .score-mode { font-size: 12px; gap: 5px; margin-left: 0; }
  .brand-header .score-mode__label { white-space: nowrap; font-size: 12px; line-height: 1.1; }
  .brand-header .score-switch { --w: 34px; --h: 20px; }
  .cart-label { display: none !important; }
  .cart-btn { padding: 6px !important; }
  .cart-btn svg { width: 14px !important; height: 14px !important; }
  .brand-header .brand-logo { height: 40px; max-width: 100px; }
  .btn-feedback {
    font-size: 0 !important;
    padding: 6px !important;
    gap: 0 !important;
    border: none;
  }
  .btn-feedback svg { width: 16px; height: 16px; flex-shrink: 0; }
  #tutorialBtn { font-size: 11px; }

  .category-hero { padding: 14px 0 4px; }

  .subcategory-hero { padding: 12px 0 16px; }
  .subcategory-hero-wrap { padding: 0 12px; }
  .subcategory-hero-header { margin-bottom: 10px; gap: 2px; padding-left: 10px; }
  .subcategory-hero-title { font-size: 16px; }

  .filter-chips {
    gap: 14px;
    justify-content: flex-start;
    padding: 8px 4px 12px;
    scroll-padding: 0 16px;
  }
  .filter-chip {
    flex: 0 0 auto;
    min-width: 0;
    width: auto;
  }
  .filter-chip .chip-circle { width: 48px; height: 48px; }
  .filter-chip .chip-circle svg { width: 22px; height: 22px; }
  .filter-chip .chip-circle img { width: 28px; height: 28px; }
  .filter-chip .chip-label {
    font-size: 10px;
    max-width: 68px;
    white-space: normal;
    line-height: 1.15;
  }

  .toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
  }

  .category-nav-inner { justify-content: flex-start; padding: 0 12px; }
  .category-nav-link { padding: 10px 12px; font-size: 11px; }

  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  .category-page { padding: 0 16px 60px; }

  .filter-drawer { width: 100%; max-width: 100%; }

  .fp-tag { font-size: 11px !important; padding: 5px 10px; }
  .fp-pill { font-size: 10px !important; padding: 3px 8px; }

  .active-filters-bar { padding: 6px 12px 4px; }
  .empty-state { padding: 60px 16px; }
  .back-to-top { bottom: 20px; right: 16px; width: 40px; height: 40px; }
}

@media (max-width: 414px) {
  .filter-chip .chip-circle { width: 40px; height: 40px; }
  .filter-chip .chip-circle svg { width: 16px; height: 16px; }
  .filter-chip .chip-circle img { width: 22px; height: 22px; }
  .filter-chip .chip-label { font-size: 9px; max-width: 56px; }
  .filter-chips { gap: 10px; }

  .brand-header .score-switch { --w: 26px; --h: 16px; }
  .brand-header .score-mode__label { display: none; }

  .brand-actions { gap: 4px; }
  .brand-header .btn-secondary { padding: 4px 6px; font-size: 10px; }
}

/* =========================================================
   Tutorial overlay
   ========================================================= */
.tut-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}
.tut-overlay[hidden] { display: none !important; }
.tut-overlay > * { pointer-events: auto; }

.tut-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  transition: opacity .3s ease;
}

.tut-spotlight {
  position: fixed;
  border-radius: 14px;
  border: 3px solid var(--brand-500, #0b7a4f);
  transition: all .4s cubic-bezier(0.4,0,0.2,1);
  pointer-events: none;
  z-index: 10002;
}
.tut-spotlight::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 18px;
  border: 2px solid rgba(11,122,79,0.3);
  animation: tutPulse 2s ease-in-out infinite;
}
@keyframes tutPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.01); }
}

.tut-tooltip {
  position: fixed;
  z-index: 10001;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22), 0 2px 8px rgba(0,0,0,0.10);
  padding: 20px 22px 16px;
  max-width: 380px;
  min-width: 280px;
  transition: all .4s cubic-bezier(0.4,0,0.2,1);
  border: 1px solid rgba(11,122,79,0.15);
}

.tut-step-indicator { display: flex; gap: 6px; margin-bottom: 12px; }
.tut-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(0,0,0,0.12); transition: all .2s ease; }
.tut-dot.active { background: var(--brand-500, #0b7a4f); transform: scale(1.25); }
.tut-dot.done { background: var(--brand-100, #d4edda); border: 1.5px solid var(--brand-500, #0b7a4f); }

.tut-content h4 { margin: 0 0 8px; font-size: 17px; color: #1a1a1a; }
.tut-content p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.55; color: #444; }

.tut-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid #eee;
}
.tut-btn { border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; padding: 8px 16px; transition: all .15s ease; }
.tut-btn--skip { background: transparent; color: #888; padding: 8px 12px; }
.tut-btn--skip:hover { color: #444; background: rgba(0,0,0,0.04); }
.tut-btn--next { background: var(--brand-600, #0b4f2d); color: #fff; padding: 8px 20px; box-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.tut-btn--next:hover:not(:disabled) { background: var(--brand-500, #0b7a4f); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.3); }

body.tut-active { /* allow scroll */ }

@media (max-width: 700px) {
  .tut-tooltip { max-width: calc(100vw - 24px); min-width: unset; padding: 14px 14px 10px; }
  .tut-content { max-height: calc(100vh - 200px); overflow-y: auto; }
  .tut-content h4 { font-size: 15px; }
  .tut-content p { font-size: 12px; line-height: 1.45; margin-bottom: 6px; }
  .tut-content .tut-action { font-size: 11px; padding: 5px 10px; }
  .tut-actions { margin-top: 10px; padding-top: 8px; }
  .tut-btn { font-size: 13px; padding: 7px 14px; }
  .tut-step-indicator { margin-bottom: 8px; }
}
