/* =============================================================
   Watchlist – Design-Auffrischung
   Liegt als Schicht über index.css und lässt die Struktur der App
   unangetastet: nur Flächen, Karten, Typografie und Bewegung.
   Zum Abschalten genügt es, die Einbindung in index.html zu entfernen.
   ============================================================= */

html:not(.auth-halo) {
  --app-surface: rgba(255, 255, 255, 0.045);
  --app-surface-strong: rgba(255, 255, 255, 0.075);
  --app-line: rgba(255, 255, 255, 0.10);
  --app-line-strong: rgba(255, 255, 255, 0.20);
  --app-ink: #f2f3f8;
  --app-ink-dim: #a7adc0;
  --app-a: #7c7cf8;
  --app-b: #c264f5;
  --app-c: #f56fae;
  --app-radius: 18px;
}

html.light-mode:not(.auth-halo) {
  --app-surface: rgba(255, 255, 255, 0.72);
  --app-surface-strong: rgba(255, 255, 255, 0.9);
  --app-line: rgba(23, 20, 40, 0.10);
  --app-line-strong: rgba(23, 20, 40, 0.18);
  --app-ink: #1c1a2b;
  --app-ink-dim: #5d5a75;
}

/* ===== Hintergrund: ruhige Tiefe statt flachem Schwarz ===== */
body:not(.auth-screen)::after {
  content: "";
  position: fixed;
  inset: -15%;
  z-index: -3;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 4%, rgba(124, 124, 248, 0.16), transparent 46%),
    radial-gradient(circle at 88% 12%, rgba(194, 100, 245, 0.13), transparent 44%),
    radial-gradient(circle at 60% 96%, rgba(245, 111, 174, 0.10), transparent 40%);
}
@media (prefers-reduced-motion: no-preference) {
  body:not(.auth-screen)::after { animation: appDrift 30s ease-in-out infinite alternate; }
}
@keyframes appDrift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(2%, -2%, 0) scale(1.05); }
}

/* Der Inhaltsbereich rechnete seine Breite ohne das eigene Polster und ragte
   dadurch rechts aus dem Fenster – die letzte Kartenspalte war angeschnitten. */
main.content { box-sizing: border-box; }

/* ===== Sektionsflächen: leichteres Glas, weniger Kasten ===== */
#watchlist.section,
#ranking-section.section,
#search.section,
#popular.section,
#recommendations.section,
#releases.section,
#statistics.section,
#settings.section {
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  padding: 36px 32px 40px;
}
html.light-mode #watchlist.section,
html.light-mode #ranking-section.section,
html.light-mode #search.section,
html.light-mode #popular.section,
html.light-mode #recommendations.section,
html.light-mode #releases.section,
html.light-mode #statistics.section,
html.light-mode #settings.section {
  background: var(--app-surface);
  box-shadow: 0 20px 44px rgba(60, 50, 110, 0.12);
}

/* ===== Überschriften: kräftiger Verlauf, klare Hierarchie ===== */
.section h1 {
  font-size: clamp(1.6rem, 1.1rem + 1.6vw, 2.3rem);
  font-weight: 750;
  letter-spacing: -0.025em;
  background: linear-gradient(105deg, var(--app-a) 0%, var(--app-b) 50%, var(--app-c) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 26px;
}
.section h2 {
  letter-spacing: -0.015em;
  font-weight: 700;
}
/* Schaltflächen in der Überschrift erbten die transparente Schriftfarbe des
   Verlaufs und waren dadurch leere Kästchen (z. B. das Auf-/Zuklappen-Dreieck). */
.section h1 button {
  -webkit-text-fill-color: currentColor;
  color: var(--app-ink);
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid var(--app-line);
  border-radius: 12px;
  width: auto;
  padding: 6px 12px;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.section h1 button:hover { background: rgba(255, 255, 255, 0.18); transform: translateY(-1px); }

/* ===== Filterleiste: schwebende Pillenzeile ===== */
.filters {
  position: sticky;
  top: 10px;
  z-index: 12;
  gap: 10px 14px;
  padding: 12px 16px;
  border-radius: 999px;
  background: var(--app-surface-strong);
  border: 1px solid var(--app-line);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.filters label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--app-ink-dim);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}
.filters select,
.search-filter-bar select,
.search-filter-bar input[type="text"] {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 32px 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--app-line);
  background-color: rgba(0, 0, 0, 0.26);
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--app-ink);
  font-size: 0.84rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
html.light-mode .filters select,
html.light-mode .search-filter-bar select,
html.light-mode .search-filter-bar input[type="text"] {
  background-color: rgba(255, 255, 255, 0.85);
}
.filters select:hover { border-color: var(--app-line-strong); }
.search-filter-bar input[type="text"] { background-image: none; padding-right: 14px; }

/* ===== Karten: Poster im Vordergrund, Text als Overlay ===== */
.grid-list {
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 22px;
  justify-items: stretch;
}

.card {
  width: 100%;
  min-height: 0;
  padding: 0;
  display: block;
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: var(--app-radius);
  border: 1px solid var(--app-line);
  background: #14131c;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.3, 1), box-shadow 0.35s ease, border-color 0.3s ease;
}
.card:hover,
.card:focus-within {
  transform: translateY(-6px);
  border-color: var(--app-line-strong);
  box-shadow: 0 26px 54px rgba(0, 0, 0, 0.5);
}

.card-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
}
.card-poster img { transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.3, 1), filter 0.35s ease; }
.card:hover .card-poster img { transform: scale(1.07); }

/* Textblock liegt auf dem Poster, mit weichem Verlauf darunter */
.card .info {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  /* index.css stapelt hier in einer Spalte – für die kompakte Zeile
     mit Chip, Sternen und Knöpfen brauchen wir Zeilenfluss. */
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 auto;
  box-sizing: border-box;
  gap: 6px;
  width: 100%;
  padding: 34px 11px 11px;
  text-align: left;
  background: linear-gradient(to top,
    rgba(9, 8, 14, 0.96) 0%,
    rgba(9, 8, 14, 0.88) 42%,
    rgba(9, 8, 14, 0.45) 72%,
    transparent 100%);
}
.card .info h3 {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* "Typ: Serie" wird zum kleinen Chip */
.card .info p.small {
  flex: 0 0 auto;
  margin: 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #dcd9ff;
  background: rgba(124, 124, 248, 0.22);
  border: 1px solid rgba(124, 124, 248, 0.3);
}
.card .info .stars {
  flex: 0 0 auto;
  font-size: 0.72rem;
  letter-spacing: -0.5px;
  color: #ffc14d;
}
/* Genres: eine Zeile, dezent */
.card .info div.small {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.62);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card .info .favorite {
  flex: 0 0 auto;
  /* kein auto-Rand: sonst schluckt er den Platz, den die Knöpfe brauchen */
  margin: 2px 0 0;
  font-size: 1rem;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
}

/* Aktionen: eine kompakte Zeile statt zweier breiter Blöcke.
   Die Selektoren nennen bewusst auch das Element (button.…), weil die
   Regeln in index.css sonst gewinnen und die Knöpfe wieder umbrechen. */
.card .info button,
.card .info button.seen-toggle,
.card .info button.card-actions-btn {
  flex: 1 1 60px;
  width: auto;
  min-width: 0;
  margin: 2px 0 0;
  padding: 7px 10px;
  font-size: 0.73rem;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--app-line-strong);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.card .info button:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.34);
}
.card .info button.seen-toggle.is-seen-active {
  background: rgba(52, 199, 123, 0.24);
  border-color: rgba(52, 199, 123, 0.45);
  color: #b6f2d0;
}
.card .info button.seen-toggle.is-seen-active:hover {
  background: rgba(52, 199, 123, 0.38);
}
/* "⋯ Aktionen" wird zur kompakten Schaltfläche neben "Gesehen" */
.card .info button.card-actions-btn {
  flex: 0 0 34px;
  width: 34px;
  min-width: 34px;
  padding: 7px 0;
  font-size: 0;
  border-radius: 10px;
}
.card .info button.card-actions-btn::after {
  content: "⋯";
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0;
}

/* Statusabzeichen auf dem Poster */
.poster-rating {
  background: linear-gradient(135deg, var(--app-a), var(--app-b));
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 3px 9px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.poster-seen {
  background: rgba(52, 199, 123, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.card.is-seen .card-poster img { filter: grayscale(0.4) brightness(0.7); }
.card.is-seen:hover .card-poster img { filter: grayscale(0) brightness(0.92); }
.card.is-fav {
  border-color: rgba(255, 193, 77, 0.55);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(255, 193, 77, 0.18) inset;
}

/* Karten laufen beim Rendern sanft ein */
@media (prefers-reduced-motion: no-preference) {
  .grid-list > .card { animation: cardIn 0.45s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
  .grid-list > .card:nth-child(1) { animation-delay: 0.02s; }
  .grid-list > .card:nth-child(2) { animation-delay: 0.05s; }
  .grid-list > .card:nth-child(3) { animation-delay: 0.08s; }
  .grid-list > .card:nth-child(4) { animation-delay: 0.11s; }
  .grid-list > .card:nth-child(5) { animation-delay: 0.14s; }
  .grid-list > .card:nth-child(n + 6) { animation-delay: 0.17s; }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ===== Navigation: Glasleiste mit deutlicher Aktiv-Markierung ===== */
nav,
nav#sidebar-nav {
  background: rgba(16, 15, 24, 0.72);
  backdrop-filter: blur(26px) saturate(170%);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
  border-color: var(--app-line);
}
html.light-mode nav,
html.light-mode nav#sidebar-nav { background: rgba(255, 255, 255, 0.82); }
html.light-mode nav#sidebar-nav { border-color: rgba(23, 20, 40, 0.10); }

nav .menu-item {
  position: relative;
  border-radius: 14px;
  transition: background 0.25s ease, transform 0.25s ease, color 0.25s ease;
}
nav .menu-item:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-1px); }
nav .menu-item.active {
  background: linear-gradient(135deg, rgba(124, 124, 248, 0.28), rgba(194, 100, 245, 0.22));
  box-shadow: 0 6px 18px rgba(124, 124, 248, 0.22);
}
nav .menu-item.active::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--app-a), var(--app-c));
}

/* Auf breiten Schirmen sitzt die Leiste links – Markierung dort seitlich */
@media (min-width: 1024px) {
  nav .menu-item.active::before {
    left: 4px;
    bottom: 50%;
    transform: translateY(50%);
    width: 3px;
    height: 20px;
  }
}

/* Das Aktionsmenü wird zum Ausmessen kurz auf visibility:hidden gesetzt.
   Weil für die Zeilen "transition: all" gilt, wurde daraus eine 300-ms-Blende,
   in der die Einträge unsichtbar blieben. Sichtbarkeit nicht mitanimieren. */
.card-action-menu button[data-act],
.card-action-menu .external-links a {
  transition-property: background-color, color, border-color;
  transition-duration: 0.18s;
}

/* ===== Feinschliff: Scrollbalken, Auswahl, Fokus ===== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(124, 124, 248, 0.5), rgba(194, 100, 245, 0.4));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(124, 124, 248, 0.75), rgba(194, 100, 245, 0.6));
  background-clip: padding-box;
}
::selection { background: rgba(124, 124, 248, 0.35); color: #fff; }
