/* ═══════════════════════════════════════════
   Reusable Fly-in Drawer Component
   Used by: learn archive filters, sort,
   shop filters, and any future drawers.
   ═══════════════════════════════════════════ */

/* ── Overlay ── */
.wv-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--wv-color-overlay);
  z-index: 1100;
}
.wv-drawer-overlay.open { display: block; }
.admin-bar .wv-drawer-overlay { z-index: 100000; }

/* ── Drawer shell ── */
.wv-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 340px;
  background: #FDFAF5; /* TODO: add to CSS variables if used across multiple pages */
  z-index: 1101;
  transition: transform 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.admin-bar .wv-drawer { z-index: 100001; }

/* Direction variants */
.wv-drawer--left {
  left: 0;
  transform: translateX(-100%);
}
.wv-drawer--left.open { transform: translateX(0); }

.wv-drawer--right {
  right: 0;
  width: 280px;
  transform: translateX(100%);
}
.wv-drawer--right.open { transform: translateX(0); }

/* ── Header (fixed at top) ── */
.wv-drawer__head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--wv-color-text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: #FDFAF5; /* TODO: add to CSS variables if used across multiple pages */
}
.wv-drawer__title {
  font-family: var(--wv-font-primary);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wv-color-text-primary);
}
.wv-drawer__close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--wv-color-text-secondary);
  cursor: pointer;
  line-height: 1;
}

/* ── Body (scrollable) ── */
.wv-drawer__body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ── Footer (fixed at bottom) ── */
.wv-drawer__foot {
  padding: 16px 24px;
  border-top: 1px solid var(--wv-color-text-primary);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  background: #FDFAF5; /* TODO: add to CSS variables if used across multiple pages */
}

/* ── Filter group ── */
.wv-drawer-filter-group {
  margin-bottom: 28px;
}
.wv-drawer-filter-group__label {
  font-family: var(--wv-font-primary);
  font-size: var(--wv-text-small, 15px);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wv-color-text-primary);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--wv-color-text-primary);
}
.wv-drawer-filter-group__label--toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
.wv-drawer-filter-group__chevron {
  transition: transform var(--wv-transition-fast);
}
.wv-drawer-filter-group--collapsed .wv-drawer-filter-group__chevron {
  transform: rotate(-90deg);
}
.wv-drawer-filter-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wv-drawer-filter-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.wv-drawer-filter-opt:hover {
  background: var(--wv-color-surface);
}
.wv-drawer-filter-opt input {
  width: 15px;
  height: 15px;
  accent-color: var(--wv-color-accent);
  cursor: pointer;
  flex-shrink: 0;
}
.wv-drawer-filter-opt__label {
  font-family: var(--wv-font-primary);
  font-size: var(--wv-text-small, 15px);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wv-color-text-secondary);
}

/* ── More/Less toggle ── */
.wv-drawer-filter-more-btn {
  background: none;
  border: none;
  font-family: var(--wv-font-primary);
  font-size: 12px;
  font-weight: 600;
  color: var(--wv-color-accent);
  cursor: pointer;
  padding: 8px 10px;
  transition: color var(--wv-transition-fast);
}
.wv-drawer-filter-more-btn:hover {
  color: var(--wv-color-accent);
  opacity: 0.8;
}

/* ── Sort options ── */
.wv-drawer-sort-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}
.wv-drawer-sort-opt:hover,
.wv-drawer-sort-opt.active {
  background: var(--wv-color-surface);
}
.wv-drawer-sort-opt input {
  accent-color: var(--wv-color-accent);
  cursor: pointer;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.wv-drawer-sort-opt__label {
  font-family: var(--wv-font-primary);
  font-size: 13px;
  font-weight: 400;
  color: var(--wv-color-text-secondary);
}
.wv-drawer-sort-opt.active .wv-drawer-sort-opt__label {
  font-weight: 600;
  color: var(--wv-color-text-primary);
}

/* ── Action buttons (footer) ── */
.wv-drawer-btn--apply {
  flex: 1;
  background: var(--wv-color-accent);
  color: #fff;
  border: none;
  border-radius: 0;
  padding: 12px;
  font-family: var(--wv-font-primary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}
.wv-drawer-btn--apply:hover { background: var(--wv-color-accent); opacity: 0.85; }

.wv-drawer-btn--clear {
  background: none;
  border: 1px solid var(--wv-color-text-primary);
  border-radius: 0;
  padding: 12px 18px;
  font-family: var(--wv-font-primary);
  font-size: 12px;
  font-weight: 600;
  color: var(--wv-color-text-primary);
  cursor: pointer;
  transition: all 0.15s;
}
.wv-drawer-btn--clear:hover {
  background: var(--wv-color-text-primary);
  color: #fff;
}

/* ── Responsive ── */
@media (max-width: 767px) {
  .wv-drawer,
  .wv-drawer--right {
    width: 100%;
  }
}
