/* katalog.css - Produktkatalog: Filter (Desktop links / Handy als Fenster),
   Ergebnisleiste, Chips, einheitliches Raster, Ladezustaende. */

.sr-nur {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* Auf sehr breiten Bildschirmen darf der Katalog etwas breiter werden (5 Spalten) */
@media (min-width: 1600px) {
  .seite-katalog main, .seite-katalog .kopf-innen, .seite-katalog .fuss-innen { max-width: 1480px; }
}

.katalog-layout { display: block; }
@media (min-width: 900px) {
  .katalog-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; align-items: start; }
}

/* ---------- Filter ---------- */
.filter-panel {
  background: #fffcf6; border: 1px solid #e8dac2; border-radius: 14px;
  box-shadow: 0 4px 14px rgba(73, 54, 45, .08);
}
.filter-panel-kopf { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 4px; }
.filter-panel-kopf h2 { margin: 0; font-size: 1.05rem; }
.filter-schliessen {
  display: none; width: 44px; height: 44px; border: none; background: none; font-size: 1.9rem; line-height: 1;
  color: var(--grau); cursor: pointer; border-radius: 50%;
}
.filter-form { display: flex; flex-direction: column; min-height: 0; }
#filterInhalt { padding: 0 18px; }
.filter-gruppe { border: 0; border-top: 1px solid var(--rand); margin: 0; padding: 14px 0 12px; min-width: 0; }
.filter-gruppe:first-of-type { border-top: 0; }
.filter-gruppe legend { padding: 0; font-weight: 700; font-size: .9rem; margin-bottom: 8px; float: left; width: 100%; }
.filter-gruppe legend + * { clear: both; }
.filter-liste { margin: 0 -6px; padding: 0 6px; }
#kuenstlerListe { max-height: 264px; overflow-y: auto; overscroll-behavior: contain; }
.filter-option {
  display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 2px 0; cursor: pointer; font-size: .92rem;
}
.filter-option input { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--rot); margin: 0; }
.fo-text { flex: 1; min-width: 0; line-height: 1.25; overflow-wrap: anywhere; }
.fo-zahl { color: var(--grau); font-size: .8rem; background: #f1e7d5; border-radius: 999px; padding: 1px 8px; flex-shrink: 0; }
.filter-suche, .filter-preis-zeile input {
  width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid var(--rand); border-radius: 10px;
  font-size: 16px; background: #fff; color: inherit;
}
.filter-suche { margin-bottom: 6px; }
.filter-suche:focus, .filter-preis-zeile input:focus { outline: 2px solid var(--violett); outline-offset: 1px; }
.filter-preis-zeile { display: flex; align-items: center; gap: 8px; }
.filter-preis-zeile input { width: 0; flex: 1; min-width: 0; }
.filter-hinweis, .filter-keine { margin: 6px 0 0; font-size: .78rem; color: var(--grau); }
.filter-fuss {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px 18px; border-top: 1px solid var(--rand);
}
.filter-reset { color: var(--rot); font-size: .88rem; font-weight: 600; text-decoration: none; }
.filter-reset:hover { text-decoration: underline; }
.filter-anwenden { font-weight: 600; white-space: nowrap; padding-left: 14px; padding-right: 14px; }

@media (min-width: 900px) {
  .filter-panel { position: sticky; top: 118px; max-height: calc(100vh - 140px); display: flex; flex-direction: column; overflow: hidden; }
  .filter-form { flex: 1; overflow-y: auto; }
  /* Mit JavaScript wird sofort beim Anklicken gefiltert - dann braucht es keinen Knopf */
  .js .filter-anwenden { display: none; }
  .js .filter-fuss { justify-content: flex-end; border-top: 0; padding-top: 4px; }
}

/* Handy & Tablet: Filter als Fenster von links */
@media (max-width: 899px) {
  .filter-panel {
    position: fixed; z-index: 1200; top: 0; left: 0; bottom: 0; width: min(92vw, 400px);
    border-radius: 0 18px 18px 0; display: flex; flex-direction: column;
    transform: translateX(-104%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s;
  }
  .filter-offen .filter-panel { transform: none; visibility: visible; transition: transform .25s ease; }
  .filter-panel-kopf { padding: 8px 8px 8px 18px; border-bottom: 1px solid var(--rand); }
  .filter-schliessen { display: block; }
  .filter-form { flex: 1; min-height: 0; }
  #filterInhalt { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 8px; }
  .filter-fuss { padding-bottom: calc(14px + env(safe-area-inset-bottom)); background: #fffcf6; }
  .filter-anwenden { flex: 1; min-height: 48px; }
  .filter-ueberlagerung { position: fixed; inset: 0; z-index: 1100; background: rgba(20, 16, 32, .55); }
  .filter-ueberlagerung[hidden] { display: none; }
  .filter-offen { overflow: hidden; }
  /* Die haftende Kopfzeile soll beim offenen Fenster darunter liegen und mit abgedunkelt werden */
  .filter-offen .kopf { z-index: 1; }
}

/* ---------- Ergebnisleiste ---------- */
.katalog-ergebnis { min-width: 0; }
.ergebnis-leiste { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.treffer { margin: 0; color: var(--grau); font-size: .95rem; }
.treffer b { color: var(--violett-dunkel); font-size: 1.05rem; }
.sortierung { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--grau); }
.sortierung select {
  min-height: 44px; padding: 0 34px 0 12px; font-size: 16px; color: var(--violett-dunkel);
  border: 1px solid var(--rand); border-radius: 10px; background-color: #fff; cursor: pointer;
}
.filter-knopf {
  display: none; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; cursor: pointer;
  background: var(--violett-dunkel); color: #fff; border: none; border-radius: 999px; font-weight: 600; font-size: .95rem;
}
.filter-knopf .ico { font-size: 1.1rem; }
.filter-zahl {
  background: var(--rot); color: #fff; border-radius: 999px; min-width: 22px; height: 22px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700;
}
@media (max-width: 899px) {
  .filter-knopf { display: inline-flex; }
  .treffer { order: 3; flex: 1 1 100%; }
  .sortierung-text { display: none; }
}

/* ---------- Aktive Filter als Chips ---------- */
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 999px;
  background: #fff; border: 1px solid #d9c6a4; color: var(--violett-dunkel); font-size: .88rem; font-weight: 600;
  text-decoration: none; max-width: 100%;
}
.chip:hover { border-color: var(--rot); }
.chip-x { color: var(--rot); font-size: 1.15rem; line-height: 1; }
.chips-reset { color: var(--rot); font-size: .88rem; font-weight: 600; text-decoration: none; padding: 0 6px; }
.chips-reset:hover { text-decoration: underline; }

/* ---------- Einheitliches Raster ---------- */
.katalog-gitter.karten-gitter { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 560px) { .katalog-gitter.karten-gitter { gap: 16px; } }
@media (min-width: 640px) { .katalog-gitter.karten-gitter { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .katalog-gitter.karten-gitter { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; } }
@media (min-width: 1600px) { .katalog-gitter.karten-gitter { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
/* Cover immer quadratisch und unverzerrt */
.katalog-gitter .karte img.cover, .katalog-gitter .karte .cover-leer { aspect-ratio: 1 / 1; object-fit: cover; }

/* ---------- Mehr laden / Seiten / leer ---------- */
.mehr-zeile { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 28px 0 8px; }
.mehr-laden { min-width: 240px; font-weight: 600; }
.mehr-laden.laedt { opacity: .7; pointer-events: none; }
.mehr-info { margin: 0; color: var(--grau); font-size: .88rem; }
.seiten-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 22px 0 8px; }
.seiten-nav a {
  min-width: 40px; min-height: 40px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rand); border-radius: 10px; background: #fff; text-decoration: none; font-weight: 600;
}
.seiten-nav a.aktiv { background: var(--violett-dunkel); color: #fff; border-color: var(--violett-dunkel); }
.js .seiten-nav { display: none; }
html:not(.js) .mehr-laden { display: none; }
.leer-zustand {
  text-align: center; background: #fffcf6; border: 1px dashed #d9c6a4; border-radius: 14px; padding: 40px 20px;
}
.leer-titel { margin: 0 0 6px; font-size: 1.1rem; font-weight: 700; }
.leer-text { margin: 0 0 18px; color: var(--grau); }

/* ---------- Ladezustand ---------- */
.ladebalken { height: 3px; margin-bottom: 8px; overflow: hidden; position: relative; opacity: 0; transition: opacity .15s; border-radius: 2px; }
.ladebalken::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 35%; background: var(--rot); border-radius: 2px;
  animation: balken 1s ease-in-out infinite;
}
@keyframes balken { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.katalog.laedt .ladebalken { opacity: 1; }
.katalog.laedt .katalog-gitter, .katalog.laedt .chips { opacity: .45; pointer-events: none; transition: opacity .15s; }
@media (prefers-reduced-motion: reduce) {
  .ladebalken::after { animation: none; width: 100%; }
  .filter-panel { transition: none !important; }
}
