/* ==========================================================================
   Vatlieuso — sidebar-filters.css
   Full filter sidebar visual system:
   Collapsible sections · Chips · Color swatches · Price range + presets ·
   Active badges · Mobile sheet · Subcategory tile ring improvements
   ========================================================================== */

/* ── Filter Section (accordion unit) ─────────────────────────────────────── */

.vls-filter-section {
  border-bottom: 1px solid var(--border-1);
}
.vls-filter-section:last-of-type { border-bottom: none; }

/* Section toggle button */
.vls-filter-section__toggle {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 11px var(--sp-4);
  background: none;
  border: none;
  cursor: pointer;
  gap: var(--sp-2);
  text-align: left;
  transition: background var(--dur-fast);
  min-height: 44px;
}
.vls-filter-section__toggle:hover  { background: var(--bg-sunken); }
.vls-filter-section.has-active > .vls-filter-section__toggle {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.vls-filter-section__label {
  font-family: var(--font-body);
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--fg-1);
  flex: 1;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.vls-filter-section__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent);
  color: #26251F;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  flex-shrink: 0;
}
.vls-filter-section__arrow {
  color: var(--fg-3);
  flex-shrink: 0;
  transition: transform 200ms var(--ease-out);
}
.vls-filter-section__toggle[aria-expanded="false"] .vls-filter-section__arrow {
  transform: rotate(-90deg);
}

/* Section body */
.vls-filter-section__body {
  padding: 0 var(--sp-4) var(--sp-3);
  animation: slideDown 180ms var(--ease-out) both;
}
.vls-filter-section__body[hidden] { display: none !important; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Checkbox Options ─────────────────────────────────────────────────────── */

.vls-filter-section__opts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 224px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-1) transparent;
  padding-right: 2px;
}
.vls-filter-section__opts::-webkit-scrollbar { width: 3px; }
.vls-filter-section__opts::-webkit-scrollbar-thumb { background: var(--border-1); border-radius: 2px; }

.vls-sidebar__opt {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 5px 6px;
  border-radius: var(--r-1);
  font-family: var(--font-body);
  font-size: var(--fs-13);
  color: var(--fg-1);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
  width: 100%;
}
.vls-sidebar__opt:hover { background: var(--bg-sunken); }
.vls-sidebar__opt.is-checked {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--fg-1);
}

.vls-sidebar__opt-check {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.vls-sidebar__opt-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  margin: 0;
  cursor: pointer;
}
.vls-sidebar__opt-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}
.vls-sidebar__count {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  margin-left: auto;
  padding-left: var(--sp-1);
}

/* ── Chip Filter ──────────────────────────────────────────────────────────── */

.vls-sidebar__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.vls-sidebar__chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border: 1px solid var(--border-1);
  border-radius: var(--r-1);
  font-family: var(--font-body);
  font-size: var(--fs-12);
  color: var(--fg-2);
  background: var(--bg-surface);
  text-decoration: none;
  transition: border-color 120ms, background 120ms, color 120ms, transform 80ms;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
}
.vls-sidebar__chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}
.vls-sidebar__chip.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #26251F;
  font-weight: 600;
}
.vls-chip__x {
  font-size: 13px;
  line-height: 1;
  opacity: 0.7;
  font-weight: 400;
}

/* ── Color Swatch Filter ──────────────────────────────────────────────────── */

.vls-sidebar__colors {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.vls-color-swatch {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 5px 6px;
  border-radius: var(--r-1);
  text-decoration: none;
  transition: background var(--dur-fast);
  cursor: pointer;
  border: 1px solid transparent;
}
.vls-color-swatch:hover { background: var(--bg-sunken); border-color: var(--border-1); }
.vls-color-swatch.is-active {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-color: var(--accent);
}
.vls-color-swatch__dot {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,.12);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
  transition: transform 120ms;
}
.vls-color-swatch:hover .vls-color-swatch__dot { transform: scale(1.15); }
.vls-color-swatch.is-active .vls-color-swatch__dot {
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 3px var(--accent);
  transform: scale(1.1);
}
.vls-color-swatch__label {
  font-family: var(--font-body);
  font-size: var(--fs-12);
  color: var(--fg-1);
  flex: 1;
}
.vls-color-swatch__check {
  color: var(--accent);
  display: flex;
  align-items: center;
}

/* ── Price Range + Presets ────────────────────────────────────────────────── */

.vls-sidebar__range { padding: var(--sp-2) 0 var(--sp-1); }
.vls-sidebar__range-track {
  position: relative;
  height: 4px;
  background: var(--border-1);
  border-radius: 2px;
  margin: var(--sp-5) 8px var(--sp-2);
}
.vls-sidebar__range-fill {
  position: absolute;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}
.vls-sidebar__range-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--bg-surface);
  border: 2px solid var(--accent);
  border-radius: 50%;
  top: -6px;
  cursor: grab;
  transition: box-shadow 120ms;
  box-shadow: var(--shadow-1);
}
.vls-sidebar__range-handle:active { cursor: grabbing; }
.vls-sidebar__range-handle:focus  { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.vls-sidebar__range-handle--min   { transform: translateX(-50%); }
.vls-sidebar__range-handle--max   { transform: translateX(-50%); }
.vls-sidebar__range-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  color: var(--fg-2);
  margin-top: var(--sp-2);
  font-feature-settings: "tnum" 1;
}

/* Price quick-presets */
.vls-price-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: var(--sp-3);
}
.vls-price-preset {
  padding: 3px 9px;
  border: 1px solid var(--border-1);
  border-radius: var(--r-1);
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  color: var(--fg-2);
  text-decoration: none;
  background: var(--bg-surface);
  transition: border-color 120ms, color 120ms, background 120ms;
  white-space: nowrap;
}
.vls-price-preset:hover  { border-color: var(--accent); color: var(--accent); }
.vls-price-preset.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--fg-1);
  font-weight: 600;
}

/* ── Sidebar Apply + Reset ────────────────────────────────────────────────── */

.vls-sidebar__apply {
  padding: var(--sp-4);
  border-top: 1px solid var(--border-1);
  position: sticky;
  bottom: 0;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  z-index: 2;
}
.vls-sidebar__apply .vls-btn--primary {
  background: #F7C948;
  border-color: #F7C948;
  color: #152445;
  font-weight: 700;
}
.vls-sidebar__apply .vls-btn--primary:hover {
  background: #F0B429;
  border-color: #F0B429;
  color: #10203F;
}
.vls-sidebar__apply .vls-btn--primary .vls-icon,
.vls-sidebar__apply .vls-btn--primary svg {
  color: currentColor;
}
.vls-sidebar__reset-link {
  text-align: center;
  font-family: var(--font-body);
  font-size: var(--fs-12);
  color: var(--fg-3);
  text-decoration: none;
  transition: color var(--dur-fast);
}
.vls-sidebar__reset-link:hover { color: var(--c-danger); }

/* Total active badge in sidebar heading */
.vls-sidebar__total-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  background: var(--accent);
  color: #26251F;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  margin-left: var(--sp-1);
}

/* ── Subcat Tile Ring improvements ────────────────────────────────────────── */

.vls-sub-ring {
  display: grid;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border-1);
}
.vls-sub-ring--c7 { grid-template-columns: repeat(7, 1fr); }
.vls-sub-ring--c6 { grid-template-columns: repeat(6, 1fr); }
.vls-sub-ring--c5 { grid-template-columns: repeat(5, 1fr); }
.vls-sub-ring--c4 { grid-template-columns: repeat(4, 1fr); }
.vls-sub-ring--c3 { grid-template-columns: repeat(3, 1fr); }
.vls-sub-ring--c2 { grid-template-columns: repeat(2, 1fr); }

.vls-sub-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-1);
  border-radius: var(--r-3);
  padding: var(--sp-4) var(--sp-3) var(--sp-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 150ms, transform 150ms var(--ease-out), box-shadow 150ms, background 150ms;
  position: relative;
  overflow: hidden;
}
.vls-sub-tile::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 150ms var(--ease-out);
}
.vls-sub-tile:hover,
.vls-sub-tile.is-active  { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.vls-sub-tile.is-active  { background: color-mix(in srgb, var(--accent) 7%, var(--bg-surface)); }
.vls-sub-tile:hover::before,
.vls-sub-tile.is-active::before { transform: scaleX(1); }

.vls-sub-tile__icon { color: var(--fg-2); transition: color 150ms; }
.vls-sub-tile:hover .vls-sub-tile__icon,
.vls-sub-tile.is-active .vls-sub-tile__icon { color: var(--accent); }

.vls-sub-tile__name {
  font-family: var(--font-display);
  font-size: var(--fs-11);
  font-weight: 600;
  color: var(--fg-1);
  text-align: center;
  line-height: var(--lh-snug);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.vls-sub-tile__count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 0.02em;
}

/* ── Category Grid (front-page / widget) ─────────────────────────────────── */

.vls-category-grid {
  display: grid;
  gap: var(--sp-3);
}
.vls-category-grid--6 { grid-template-columns: repeat(6, 1fr); }
.vls-category-grid--5 { grid-template-columns: repeat(5, 1fr); }
.vls-category-grid--4 { grid-template-columns: repeat(4, 1fr); }

.vls-cat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-1);
  border-radius: var(--r-3);
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-2);
  text-decoration: none;
  transition: border-color 150ms, box-shadow 150ms, transform 150ms var(--ease-out);
  position: relative;
  overflow: hidden;
}
.vls-cat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 4%, transparent) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 150ms;
}
.vls-cat-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}
.vls-cat-card:hover::after { opacity: 1; }
.vls-cat-card.is-current {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-surface));
}
.vls-cat-card__icon {
  color: var(--fg-2);
  transition: color 150ms, transform 150ms;
  position: relative;
  z-index: 1;
}
.vls-cat-card:hover .vls-cat-card__icon { color: var(--accent); transform: scale(1.08); }
.vls-cat-card__name {
  font-family: var(--font-display);
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--fg-1);
  line-height: var(--lh-snug);
  position: relative;
  z-index: 1;
}
.vls-cat-card__count {
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  color: var(--fg-3);
  position: relative;
  z-index: 1;
}

/* ── Mobile: sidebar as sliding sheet ────────────────────────────────────── */

.vls-mobile-filter-btn { display: none; }

@media (max-width: 900px) {
  .vls-mobile-filter-btn {
    display: inline-flex;
    margin-bottom: var(--sp-4);
  }
  .vls-archive-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: min(320px, 88vw);
    height: 100dvh;
    max-height: none;
    z-index: 500;
    border-radius: 0 var(--r-3) var(--r-3) 0;
    border: none;
    box-shadow: var(--shadow-3);
    overflow-y: auto;
    transition: left 280ms var(--ease-out);
  }
  .vls-archive-sidebar.is-open { left: 0; }
  /* Backdrop */
  body.sidebar-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(14,13,9,.55);
    backdrop-filter: blur(2px);
    z-index: 499;
    animation: fadeIn 200ms ease both;
  }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

  /* Mobile close button inside sidebar head */
  .vls-archive-sidebar .vls-sidebar__head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-1);
  }

  .vls-sub-ring--c7,
  .vls-sub-ring--c6,
  .vls-sub-ring--c5  { grid-template-columns: repeat(3, 1fr); }
  .vls-sub-ring--c4  { grid-template-columns: repeat(2, 1fr); }
  .vls-category-grid--6,
  .vls-category-grid--5  { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
  .vls-sub-ring--c7,
  .vls-sub-ring--c6,
  .vls-sub-ring--c5,
  .vls-sub-ring--c4,
  .vls-sub-ring--c3  { grid-template-columns: repeat(2, 1fr); }
  .vls-category-grid--6,
  .vls-category-grid--5,
  .vls-category-grid--4 { grid-template-columns: repeat(2, 1fr); }
}
