/* ═══════════════════════════════════════════════════════════════════
   Teufelswerk Produktfilter – Sidebar-Styles
   ═══════════════════════════════════════════════════════════════════ */

/* ── Layout-Wrapper ────────────────────────────────────────────────
   Wrap Sidebar + Produktgrid in einem Flex-Container.
   Tipp: Auf der Seite selbst einen Spalten-Block / Row-Block anlegen
   und [tw_produktfilter] in die linke, [product_category ...] in die
   rechte Spalte setzen.
   Alternativ: das Plugin macht das automatisch via JS wenn beide
   Elemente direkt nebeneinander stehen.
────────────────────────────────────────────────────────────────── */

/* ── Sidebar ───────────────────────────────────────────────────────── */
.tw-filter-sidebar {
  width: 260px;
  min-width: 220px;
  max-width: 280px;
  font-family: inherit;
  font-size: 14px;
  color: #333;
  background: #fafafa;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 16px;
  box-sizing: border-box;
  align-self: flex-start;
  position: sticky;
  top: 24px;
}

/* ── Header ────────────────────────────────────────────────────────── */
.tw-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid #1a1a2e;
}

.tw-filter-titel {
  font-weight: 700;
  font-size: 15px;
  color: #1a1a2e;
  letter-spacing: 0.3px;
}

.tw-filter-reset {
  background: none;
  border: 1px solid #e94560;
  color: #e94560;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tw-filter-reset:hover {
  background: #e94560;
  color: #fff;
}

/* ── Sektion ───────────────────────────────────────────────────────── */
.tw-filter-section {
  border-bottom: 1px solid #ebebeb;
  margin-bottom: 4px;
}

.tw-filter-section:last-of-type {
  border-bottom: none;
}

.tw-filter-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 10px 0;
  font-weight: 600;
  font-size: 13px;
  color: #1a1a2e;
  cursor: pointer;
  text-align: left;
}

.tw-filter-section-toggle:hover {
  color: #e94560;
}

.tw-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 0.2s;
  color: #888;
}

.tw-filter-section-toggle[aria-expanded="false"] .tw-chevron {
  transform: rotate(-90deg);
}

/* ── Optionen ──────────────────────────────────────────────────────── */
.tw-filter-options {
  padding-bottom: 8px;
}

.tw-filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
  line-height: 1.4;
  user-select: none;
}

.tw-filter-option:hover .tw-option-label {
  color: #e94560;
}

.tw-filter-option input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Custom Checkbox */
.tw-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 2px solid #bbb;
  border-radius: 3px;
  flex-shrink: 0;
  background: #fff;
  transition: border-color 0.15s, background 0.15s;
}

.tw-filter-option input:checked ~ .tw-checkbox {
  border-color: #e94560;
  background: #e94560;
}

.tw-filter-option input:checked ~ .tw-checkbox::after {
  content: '';
  display: block;
  width: 9px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

.tw-option-label {
  flex: 1;
  font-size: 13px;
  color: #444;
  transition: color 0.15s;
}

.tw-option-count {
  font-size: 11px;
  color: #999;
  min-width: 24px;
  text-align: right;
}

/* Ausgegraute Option (0 Treffer) */
.tw-filter-option.tw-zero {
  opacity: 0.35;
  pointer-events: none;
}

/* ── Treffer-Anzeige ───────────────────────────────────────────────── */
.tw-filter-count {
  margin-top: 12px;
  font-size: 12px;
  color: #1a1a2e;
  font-weight: 600;
  text-align: center;
  background: #eef2ff;
  padding: 6px;
  border-radius: 4px;
}

/* ── Versteckte Produkte ───────────────────────────────────────────── */
/* Mit CSS-Grid reicht display:none – keine Löcher im Grid */
li.product[style*="display: none"],
li.product[style*="display:none"] {
  display: none !important;
}

/* Grid-Basis überschreiben damit JS die Kontrolle hat */
ul.products.tw-filterable {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  float: none !important;
}

ul.products.tw-filterable li.product {
  float: none !important;
  width: auto !important;
  margin: 0 !important;
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .tw-filter-sidebar {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    position: static;
    margin-bottom: 20px;
  }
}
