/*
 * FILE: assets/css/components/filter-sidebar.css
 * PATTERN — Shop Filter Sidebar
 * Spec: 280px fixed left sidebar, section gap 24px, checkbox gap 12px
 */

/* ── Layout wrapper ── */
.pg-shop-layout {
  display: grid;
  grid-template-columns: var(--filter-w) 1fr;
  gap: var(--space-32);
  align-items: start;
  padding: var(--space-64) var(--space-96);
}
@media (max-width: 1024px) {
  .pg-shop-layout { grid-template-columns: 1fr; padding: var(--space-32) var(--space-24); }
}

/* ── Sidebar container ── */
.pg-filter-sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 16px);
  background: var(--card);
  border: .5px solid var(--gold-border);
  border-radius: var(--radius-card);
  padding: var(--space-24);
  max-height: calc(100vh - var(--nav-h) - 32px);
  overflow-y: auto;
}
.pg-filter-sidebar::-webkit-scrollbar { width: 4px; }
.pg-filter-sidebar::-webkit-scrollbar-track { background: transparent; }
.pg-filter-sidebar::-webkit-scrollbar-thumb { background: var(--gold-border); border-radius: 2px; }

/* ── Filter header ── */
.pg-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-24);
  padding-bottom: var(--space-16);
  border-bottom: .5px solid var(--gold-border);
}
.pg-filter-head h3 {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-bright);
}
.pg-filter-reset {
  font-size: var(--type-caption);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold);
  background: none;
  border: none;
  cursor: pointer;
  transition: opacity .2s;
}
.pg-filter-reset:hover { opacity: .7; }

/* ── Filter group ── */
.pg-filter-group {
  margin-bottom: var(--space-24);
  border-bottom: .5px solid rgba(212,175,55,.06);
  padding-bottom: var(--space-24);
}
.pg-filter-group:last-child { border-bottom: none; margin-bottom: 0; }

.pg-filter-group-title {
  font-size: var(--type-small);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  padding: 0;
}
.pg-filter-group-title svg {
  width: 14px; height: 14px;
  color: var(--text-dim);
  transition: transform .2s var(--ease);
  flex-shrink: 0;
}
.pg-filter-group.is-collapsed .pg-filter-group-title svg { transform: rotate(-90deg); }
.pg-filter-group-body { overflow: hidden; transition: max-height .3s var(--ease); }

/* ── Checkbox list ── */
.pg-filter-list { display: flex; flex-direction: column; gap: var(--space-12); }

.pg-filter-check {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  cursor: pointer;
  font-size: var(--type-small);
  color: var(--text-muted);
  transition: color .15s;
  user-select: none;
}
.pg-filter-check:hover { color: var(--text-mid); }
.pg-filter-check input[type="checkbox"] { display: none; }
.pg-filter-check-box {
  width: 16px; height: 16px;
  border: .5px solid var(--gold-border);
  border-radius: 3px;
  background: transparent;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.pg-filter-check input:checked ~ .pg-filter-check-box {
  background: var(--gold);
  border-color: var(--gold);
}
.pg-filter-check-box::after {
  content: '';
  width: 8px; height: 5px;
  border-left: 1.5px solid var(--black);
  border-bottom: 1.5px solid var(--black);
  transform: rotate(-45deg) translateY(-1px);
  opacity: 0;
  transition: opacity .1s;
}
.pg-filter-check input:checked ~ .pg-filter-check-box::after { opacity: 1; }

.pg-filter-check-count {
  margin-left: auto;
  font-size: var(--type-caption);
  color: var(--text-dim);
}

/* ── Colour swatches ── */
.pg-filter-swatches { display: flex; flex-wrap: wrap; gap: var(--space-8); }
.pg-filter-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
  position: relative;
}
.pg-filter-swatch:hover { transform: scale(1.1); }
.pg-filter-swatch.is-active { border-color: var(--gold); }
.pg-filter-swatch[data-color="yellow"] { background: #D4AF37; }
.pg-filter-swatch[data-color="rose"]   { background: #E6B7A9; }
.pg-filter-swatch[data-color="white"]  { background: #E0E0E0; }

/* ── Price slider ── */
.pg-filter-range { padding: var(--space-8) 0; }
.pg-range-track {
  position: relative;
  height: 3px;
  background: rgba(212,175,55,.15);
  border-radius: 2px;
  margin: var(--space-16) 0;
}
.pg-range-fill {
  position: absolute;
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
}
.pg-range-input {
  position: absolute;
  top: -8px;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.pg-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--type-caption);
  color: var(--text-dim);
  margin-top: var(--space-8);
}
.pg-range-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--black);
  cursor: pointer;
  transition: transform .15s;
}
.pg-range-thumb:hover { transform: translate(-50%, -50%) scale(1.2); }

/* ── Sort bar (top of product grid) ── */
.pg-sort-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-32);
  padding-bottom: var(--space-16);
  border-bottom: .5px solid var(--gold-border);
  flex-wrap: wrap;
  gap: var(--space-12);
}
.pg-sort-count {
  font-size: var(--type-small);
  color: var(--text-dim);
}
.pg-sort-select {
  background: var(--card);
  border: .5px solid var(--gold-border);
  color: var(--text-mid);
  font-size: var(--type-small);
  padding: 8px 32px 8px 12px;
  border-radius: var(--radius-btn);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23D4AF37' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.pg-sort-select:focus { outline: none; border-color: var(--gold); }

/* ── Mobile filter toggle ── */
.pg-filter-toggle-btn {
  display: none;
  align-items: center;
  gap: var(--space-8);
  background: var(--card);
  border: .5px solid var(--gold-border);
  color: var(--text-mid);
  padding: 10px var(--space-16);
  border-radius: var(--radius-btn);
  font-size: var(--type-small);
  cursor: pointer;
}
@media (max-width: 1024px) {
  .pg-filter-toggle-btn { display: flex; }
  .pg-filter-sidebar {
    position: fixed;
    top: 0; left: -100%;
    max-height: 100vh;
    height: 100vh;
    z-index: 8000;
    border-radius: 0;
    border: none;
    border-right: .5px solid var(--gold-border);
    width: min(320px, 85vw);
    transition: left .35s var(--ease);
  }
  .pg-filter-sidebar.is-open { left: 0; }
  .pg-filter-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 7999;
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s;
  }
  .pg-filter-overlay.is-open { opacity: 1; pointer-events: all; }
}
