/*
 * Smak Filter — frontend styles
 * Uses CSS variables from the eurosmak theme.
 * BEM-ish: .smak-filter, .smak-fg, .smak-item, .smak-products-wrap
 */

/* ── Layout ─────────────────────────────────────────────────────────────── */
.smak-filter {
  font-size: 14px;
  line-height: 1.5;
  width: 100%;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.smak-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  margin-bottom: 4px;
}
.smak-filter-head-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text, #111827);
}
.smak-filter-reset {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent, #2563eb);
  font-size: 12px;
  padding: 2px 0;
  text-decoration: underline;
  transition: opacity .15s;
}
.smak-filter-reset:hover { opacity: .75; }

/* ── Filter group ───────────────────────────────────────────────────────── */
.smak-fg {
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.smak-fg-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px 0;
  text-align: left;
  gap: 6px;
  color: var(--text, #111827);
  font-size: 13px;
  font-weight: 600;
}
.smak-fg-toggle:hover { color: var(--accent, #2563eb); }
.smak-fg-toggle-label { flex: 1; }
.smak-fg-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent, #2563eb);
  color: #fff;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
}
.smak-fg-arrow {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform .2s;
  color: var(--text2, #6b7280);
}
.smak-fg-toggle[aria-expanded="true"] .smak-fg-arrow {
  transform: rotate(180deg);
}

/* ── Group body ─────────────────────────────────────────────────────────── */
.smak-fg-body {
  overflow: hidden;
  padding-bottom: 12px;
  transition: max-height .25s ease;
}
.smak-fg--collapsed .smak-fg-body {
  display: none;
}

/* ── Item list ──────────────────────────────────────────────────────────── */
.smak-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
}
.smak-items::-webkit-scrollbar { width: 4px; }
.smak-items::-webkit-scrollbar-track { background: transparent; }
.smak-items::-webkit-scrollbar-thumb { background: var(--border, #e5e7eb); border-radius: 2px; }

/* ── Checkbox / radio item ──────────────────────────────────────────────── */
.smak-item label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: var(--radius, 6px);
  transition: background .12s;
}
.smak-item label:hover { background: var(--surface, #f9fafb); }
.smak-item input[type="checkbox"],
.smak-item input[type="radio"] {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  accent-color: var(--accent, #2563eb);
  cursor: pointer;
}
.smak-item-label {
  flex: 1;
  color: var(--text, #111827);
  font-size: 13px;
}
.smak-item-count {
  font-size: 11px;
  color: var(--text3, #9ca3af);
  margin-left: auto;
}
.smak-item--active .smak-item-label { font-weight: 600; color: var(--accent, #2563eb); }

/* ── Color swatch ───────────────────────────────────────────────────────── */
.smak-swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,.12);
  flex-shrink: 0;
}
.smak-item--active .smak-swatch {
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 2px var(--accent, #2563eb);
}
.smak-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ── Price range ────────────────────────────────────────────────────────── */
.smak-price-range { padding: 4px 0 8px; }
.smak-slider-wrap {
  position: relative;
  height: 22px;
  margin-bottom: 12px;
}
.smak-slider-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--border, #e5e7eb);
  border-radius: 2px;
  transform: translateY(-50%);
}
.smak-slider-fill {
  position: absolute;
  height: 100%;
  background: var(--accent, #2563eb);
  border-radius: 2px;
}
.smak-range {
  position: absolute;
  width: 100%;
  top: 50%;
  transform: translateY(-50%);
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  margin: 0;
}
.smak-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent, #2563eb);
  pointer-events: all;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.smak-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent, #2563eb);
  pointer-events: all;
  cursor: pointer;
  border: 2px solid #fff;
}
.smak-price-inputs {
  display: flex;
  gap: 8px;
  align-items: center;
}
.smak-price-inputs label {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  font-size: 12px;
  color: var(--text2, #6b7280);
}
.smak-price-inputs input[type="number"] {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--radius, 6px);
  font-size: 13px;
  color: var(--text, #111827);
}
.smak-price-inputs input[type="number"]:focus {
  outline: none;
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 2px rgba(37,99,235,.15);
}

/* ── Apply button ───────────────────────────────────────────────────────── */
.smak-filter-footer { padding: 16px 0 0; }
.smak-filter-apply {
  width: 100%;
  padding: 10px;
  background: var(--accent, #2563eb);
  color: #fff;
  border: none;
  border-radius: var(--radius, 8px);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.smak-filter-apply:hover { opacity: .88; }

/* ── Products wrap + loading overlay ────────────────────────────────────── */
.smak-products-wrap {
  position: relative;
  min-height: 200px;
}
.smak-products-wrap.smak-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.7);
  z-index: 5;
  border-radius: var(--radius, 8px);
}
.smak-spinner {
  display: none;
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border, #e5e7eb);
  border-top-color: var(--accent, #2563eb);
  border-radius: 50%;
  animation: smak-spin .7s linear infinite;
}
.smak-products-wrap.smak-loading .smak-spinner { display: block; }

@keyframes smak-spin { to { transform: translateX(-50%) rotate(360deg); } }

/* ── No products ─────────────────────────────────────────────────────────── */
.smak-no-products {
  padding: 32px 16px;
  text-align: center;
  color: var(--text2, #6b7280);
  font-size: 15px;
}
.smak-filter-reset-link {
  display: block;
  margin-top: 8px;
  color: var(--accent, #2563eb);
  font-size: 13px;
}

/* ── Pagination area ──────────────────────────────────────────────────────── */
.smak-pagination {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
}
.smak-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--radius, 6px);
  font-size: 13px;
  color: var(--text, #111827);
  text-decoration: none;
  transition: background .12s, color .12s;
}
.smak-pagination .page-numbers:hover,
.smak-pagination .page-numbers.current {
  background: var(--accent, #2563eb);
  border-color: var(--accent, #2563eb);
  color: #fff;
}
.smak-pagination .page-numbers.dots {
  border: none;
  background: none;
}

/* ── SEO filter page intro/bottom text ──────────────────────────────────── */
.smak-intro-text {
  margin-bottom: 20px;
  color: var(--text2, #6b7280);
  font-size: 14px;
  line-height: 1.6;
}
.smak-bottom-text {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border, #e5e7eb);
  color: var(--text2, #6b7280);
  font-size: 13px;
  line-height: 1.7;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .smak-filter {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 90vw);
    background: #fff;
    z-index: 999;
    overflow-y: auto;
    padding: 16px;
    transform: translateX(-110%);
    transition: transform .28s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.12);
  }
  .smak-filter.smak-filter--open {
    transform: translateX(0);
  }
  body.smak-filter-overlay-active::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 998;
  }
}
