/* ============================================
   Torrent-Filme DE – Dunkles Theme Stylesheet
   2-spaltige kompakte Liste
   ============================================ */

:root {
  --bg-primary: #0f0f12;
  --bg-card: #1a1a1f;
  --bg-card-hover: #22222a;
  --bg-input: #1a1a1f;
  --accent: #a78bfa;
  --accent-dim: rgba(167, 139, 250, 0.15);
  --text-primary: #e4e4e7;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border: #27272a;
  --error: #f87171;
  --success: #4ade80;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 4px 16px rgba(0, 0, 0, 0.5);
  --transition: 0.2s ease;
}

/* Reset & Basis */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

/* ============================================
   Header & Suchleiste (sticky)
   ============================================ */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 15, 18, 0.92);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header__inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.header__top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.search-input {
  flex: 1;
  max-width: 360px;
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

/* ============================================
   Status-Balken (Quellen)
   ============================================ */

.sources-bar {
  max-width: 900px;
  margin: 0 auto;
  padding: 8px 16px 0;
}

.sources-bar__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.sources-bar__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.75rem;
}

.source-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.source-tag--ok {
  border-color: rgba(74, 222, 128, 0.3);
  color: var(--success);
}

.source-tag--error {
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--error);
}

.source-tag__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ============================================
   Hauptinhalt
   ============================================ */

.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 16px;
}

/* ============================================
   Ladezustand & Fehler
   ============================================ */

.state-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 16px;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 1rem;
}

.state-message--error {
  color: var(--error);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   Film-Liste (2-spaltig, kompakt)
   ============================================ */

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* ============================================
   Film-Karte (kompakt, horizontal)
   ============================================ */

.card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
  box-shadow: var(--shadow-card-hover);
}

/* Thumbnail */
.card__poster-wrap {
  flex-shrink: 0;
  width: 50px;
  height: 70px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-primary);
  position: relative;
}

.card__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Fallback-Platzhalter */
.card__poster-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a1f 0%, #2a2a30 100%);
  color: var(--text-muted);
}

.card__poster-placeholder svg {
  width: 24px;
  height: 24px;
  opacity: 0.4;
}

/* Seeder-Badge auf dem Thumbnail */
.card__badge {
  position: absolute;
  top: 3px;
  left: 3px;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.75);
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--success);
  line-height: 1.4;
  z-index: 2;
}

/* Magnet-Button unten-rechts auf Thumbnail */
.card__magnet {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  border-radius: 50%;
  color: var(--accent);
  font-size: 0.65rem;
  z-index: 2;
  border: none;
  cursor: pointer;
  transition: background var(--transition);
  padding: 0;
}

.card__magnet:hover {
  background: var(--accent);
  color: #fff;
}

/* Text-Bereich rechts */
.card__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card__title {
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 600px) {
  .header__top {
    flex-wrap: wrap;
  }

  .search-input {
    max-width: 100%;
    order: 3;
    flex-basis: 100%;
  }

  /* Auf Mobil: 1 Spalte */
  .grid {
    grid-template-columns: 1fr;
  }
}
