:root { color-scheme: light dark; }
body { font-family: system-ui, sans-serif; margin: 0; padding: 1.5rem; background: #12131a; color: #e6e6ea; }
h1 { font-size: 1.4rem; margin-bottom: 1rem; }
nav.main { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
nav.main a { color: #9a9cad; text-decoration: none; padding: 0.3rem 0.7rem; border-radius: 4px; }
nav.main a.active { background: #4a7dff; color: white; }
nav.main a:not(.active):hover { background: #1c1e29; color: #e6e6ea; }
form.filters, .season-picker { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem; margin-bottom: 1rem; background: #1c1e29; padding: 1rem; border-radius: 8px; }
.field { display: flex; flex-direction: column; gap: 0.25rem; }
.field label { font-size: 0.75rem; color: #9a9cad; }
.field input, .field select { padding: 0.4rem 0.5rem; border-radius: 4px; border: 1px solid #3a3c4c; background: #12131a; color: #e6e6ea; }
.field input[type=number] { width: 5.5rem; }
form.filters button { padding: 0.4rem 1rem; border-radius: 4px; border: none; background: #4a7dff; color: white; cursor: pointer; height: 2.15rem; }
.meta { margin-bottom: 0.8rem; color: #9a9cad; font-size: 0.9rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 0.5rem 0.6rem; border-bottom: 1px solid #2a2c3a; text-align: left; vertical-align: top; }
th { color: #9a9cad; font-weight: 600; position: sticky; top: 0; background: #12131a; }
th a { color: #9a9cad; text-decoration: none; white-space: nowrap; }
th a:hover { color: #e6e6ea; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: #e6e6ea; }
th.sortable.sort-asc::after { content: " \25B2"; }
th.sortable.sort-desc::after { content: " \25BC"; }
tr:hover { background: #1c1e29; }
a { color: #6fa0ff; }
.pagination { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1rem 0; align-items: center; justify-content: center; }
.pagination a, .pagination span { padding: 0.3rem 0.7rem; border-radius: 4px; background: #1c1e29; color: #e6e6ea; text-decoration: none; }
.pagination a:hover { background: #2a2c3a; }
.pagination .current { background: #4a7dff; }
.pagination .ellipsis { background: transparent; padding: 0.3rem 0.2rem; color: #9a9cad; }
.badge { display: inline-block; padding: 0.1rem 0.4rem; border-radius: 4px; background: #2a2c3a; font-size: 0.78rem; }
.serie-title { color: #e6e6ea; text-decoration: none; }
.serie-title:hover { color: #6fa0ff; }
.season { margin-bottom: 1.5rem; }
.season h2 { font-size: 1.1rem; color: #9a9cad; border-bottom: 1px solid #2a2c3a; padding-bottom: 0.4rem; margin-bottom: 0.6rem; }
.serie-header { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-bottom: 1.2rem; }
.cast-title { font-size: 1.1rem; color: #9a9cad; border-bottom: 1px solid #2a2c3a; padding-bottom: 0.4rem; margin: 0 0 0.6rem; }
.cast-row { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 0.6rem; margin-bottom: 1.2rem; }
.cast-card { flex: 0 0 100px; text-decoration: none; text-align: center; }
.cast-card img,
.cast-card .cast-placeholder {
  width: 100px; height: 100px; border-radius: 50%; object-fit: cover; background: #1c1e29; display: block;
}
.cast-card .cast-placeholder { display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: #9a9cad; }
.cast-card .cast-name { margin-top: 0.4rem; font-size: 0.8rem; font-weight: 600; color: #e6e6ea; }
.cast-card .cast-character { font-size: 0.74rem; color: #9a9cad; }
.serie-header img {
  width: 180px; aspect-ratio: 2 / 3; object-fit: cover;
  border-radius: 6px; flex-shrink: 0; background: #1c1e29;
}
.serie-meta { color: #9a9cad; font-size: 0.9rem; margin: 0.3rem 0; }
.serie-overview { max-width: 60rem; line-height: 1.5; margin: 0.6rem 0; }
.view-toggle { float: right; display: flex; gap: 0.4rem; }
.view-toggle a { padding: 0.2rem 0.6rem; border-radius: 4px; background: #1c1e29; color: #9a9cad; text-decoration: none; }
.view-toggle a.active { background: #4a7dff; color: white; }
.serie-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 1rem; }
.serie-grid .card { display: flex; flex-direction: column; position: relative; }
.serie-grid .card .poster-wrap { position: relative; display: block; }
.serie-grid .card img,
.serie-grid .card .poster-placeholder {
  width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 6px; background: #1c1e29;
}
.serie-grid .card .poster-placeholder {
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 0.6rem; font-size: 0.85rem; color: #9a9cad; box-sizing: border-box;
}
.status-badge {
  position: absolute; top: 0.4rem; right: 0.4rem; padding: 0.15rem 0.5rem;
  border-radius: 4px; font-size: 0.68rem; font-weight: 600; color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.status-badge.status-ended { background: #2e9e5b; }
.status-badge.status-ongoing { background: #d97a1f; }
.status-badge.status-canceled { background: #c9414b; }
.status-badge.status-production { background: #3d7fd9; }
.status-badge.status-planned { background: #6b6f7a; }
.serie-grid .card-title { margin-top: 0.5rem; font-size: 0.88rem; font-weight: 600; }
.serie-grid .card-info { margin-top: 0.2rem; font-size: 0.78rem; color: #9a9cad; line-height: 1.4; }
@media (max-width: 1500px) { .serie-grid { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 1100px) { .serie-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 700px) { .serie-grid { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 700px) {
  body { padding: 0.9rem; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  th, td { padding: 0.5rem 0.5rem; }
  .logout-link { margin-left: 0; }
  .serie-header img { width: 130px; }
  /* Vignettes 2 colonnes : le cœur (haut-gauche) et le badge de statut
     (haut-droite) se rapprochent trop et peuvent se chevaucher — on
     descend le cœur en bas-gauche pour libérer le coin haut-droit. */
  .fav-btn.overlay { top: auto; bottom: 0.4rem; }
}

.stat-cards { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: #1c1e29; border-radius: 8px; padding: 1rem 1.5rem; min-width: 140px; }
.stat-card-value { font-size: 1.8rem; font-weight: 700; }
.stat-card-label { color: #9a9cad; font-size: 0.85rem; margin-top: 0.2rem; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.stat-block { background: #1c1e29; border-radius: 8px; padding: 1rem 1.2rem; }
.stat-block h2 { font-size: 1rem; color: #9a9cad; margin: 0 0 0.8rem; }
.stat-bar-row { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; margin-bottom: 0.5rem; }
.stat-bar-label { flex: 0 0 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-bar-track { flex: 1; background: #12131a; border-radius: 4px; height: 0.6rem; overflow: hidden; }
.stat-bar-fill { background: #4a7dff; height: 100%; }
.stat-bar-value { flex: 0 0 auto; color: #9a9cad; min-width: 3.5rem; text-align: right; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: 1fr; } }

.fav-btn {
  border: none; background: transparent; cursor: pointer; color: #9a9cad;
  font-size: 1.3rem; line-height: 1; padding: 0; display: inline-flex; align-items: center; justify-content: center;
}
.fav-btn:hover { color: #ff5577; }
.fav-btn.active { color: #ff5577; }
.fav-btn.overlay {
  position: absolute; top: 0.4rem; left: 0.4rem; z-index: 2;
  width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: rgba(18,19,26,0.65); font-size: 1rem;
}
.fav-btn.overlay:hover { background: rgba(18,19,26,0.9); }
.fav-btn.inline { font-size: 1.1rem; vertical-align: middle; }
td .fav-btn { font-size: 1.1rem; }

.logout-link { margin-left: auto; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 80vh; }
.login-form {
  background: #1c1e29; padding: 2rem 2.2rem; border-radius: 10px;
  display: flex; flex-direction: column; gap: 0.9rem; width: 100%; max-width: 320px;
}
.login-form h1 { text-align: center; margin: 0 0 0.4rem; }
.login-form .field { display: flex; flex-direction: column; gap: 0.3rem; }
.login-form label { font-size: 0.8rem; color: #9a9cad; }
.login-form input {
  padding: 0.55rem 0.6rem; border-radius: 4px; border: 1px solid #3a3c4c;
  background: #12131a; color: #e6e6ea; font-size: 0.95rem;
}
.login-form button {
  padding: 0.6rem; border-radius: 4px; border: none; background: #4a7dff;
  color: white; cursor: pointer; font-size: 0.95rem; margin-top: 0.4rem;
}
.login-error { color: #ff5577; font-size: 0.85rem; margin: 0; }
