/* ============================================================
   MediaTrack — style sombre, épuré, responsive
   ============================================================ */
:root {
    --bg:        #12151c;
    --bg-2:      #1a1f2b;
    --bg-3:      #232a38;
    --text:      #e8ebf2;
    --muted:     #8b93a5;
    --accent:    #4f8cff;
    --accent-2:  #6ad3a8;
    --danger:    #ff6b6b;
    --border:    #2a3140;
    --radius:    12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Barre du haut ---------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: .75rem 1rem;
    background: var(--bg-2); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
    padding-top: max(.75rem, env(safe-area-inset-top));
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav a {
    color: var(--muted); padding: .4rem .7rem; border-radius: 8px; font-size: .95rem;
}
.nav a:hover { background: var(--bg-3); color: var(--text); text-decoration: none; }
.nav a.admin-link { color: var(--accent-2); }
.nav a.logout { color: var(--danger); }

/* ---------- Conteneur ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }

h1 { font-size: 1.6rem; margin: .3rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .75rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .5rem; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- Messages ---------- */
.error, .success {
    padding: .7rem 1rem; border-radius: 8px; margin: .5rem 0;
}
.error   { background: rgba(255,107,107,.12); color: #ffb3b3; border: 1px solid rgba(255,107,107,.3); }
.success { background: rgba(106,211,168,.12); color: #a9f0d1; border: 1px solid rgba(106,211,168,.3); }

/* ---------- Formulaires ---------- */
label { display: block; margin: .6rem 0; font-size: .95rem; }
input, select, button, textarea {
    font: inherit;
}
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=number], select, textarea {
    width: 100%; padding: .6rem .7rem; margin-top: .25rem;
    background: var(--bg-3); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px;
}
input:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
label.checkbox { display: flex; align-items: center; gap: .5rem; }
label.checkbox input { width: auto; margin: 0; }

button { cursor: pointer; }
.btn-primary {
    background: var(--accent); color: #fff; border: none;
    padding: .6rem 1.1rem; border-radius: 8px; font-weight: 600; margin-top: .5rem;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary {
    display: inline-block; background: var(--bg-3); color: var(--text);
    border: 1px solid var(--border); padding: .6rem 1.1rem; border-radius: 8px;
}
.btn-small {
    background: var(--bg-3); color: var(--text); border: 1px solid var(--border);
    padding: .4rem .8rem; border-radius: 8px; font-size: .9rem;
}
.btn-small:hover { background: var(--border); }
.btn-ghost { background: transparent; }
.btn-tiny {
    display: inline-block; background: var(--bg-3); color: var(--text);
    border: 1px solid var(--border); padding: .25rem .6rem; border-radius: 6px; font-size: .8rem;
}
.btn-danger { color: var(--danger); border-color: rgba(255,107,107,.4); }

/* ---------- Cartes d'auth ---------- */
.auth-card {
    max-width: 380px; margin: 3rem auto; background: var(--bg-2);
    padding: 2rem; border-radius: var(--radius); border: 1px solid var(--border);
}

/* ---------- Panneaux ---------- */
.panel {
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem; margin: 1rem 0;
}

/* ---------- Grille de cartes (affiches) ---------- */
.grid {
    display: grid; gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.card {
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; color: var(--text);
    display: flex; flex-direction: column;
}
.card:hover { text-decoration: none; border-color: var(--accent); }
.card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; background: var(--bg-3); }
.card-body { padding: .6rem; display: flex; flex-direction: column; gap: .25rem; }
.card-body strong { font-size: .92rem; line-height: 1.25; }

.badge {
    display: inline-block; font-size: .7rem; padding: .1rem .5rem;
    border-radius: 20px; width: fit-content; font-weight: 600;
}
.badge.movie  { background: rgba(79,140,255,.2);  color: #a9c6ff; }
.badge.series { background: rgba(106,211,168,.2); color: #a9f0d1; }

/* ---------- Barre / formulaire de recherche ---------- */
.search-form { margin: 1rem 0; }
.search-row { display: flex; gap: .5rem; }
.search-row input { flex: 1; }
.filters { margin-top: .75rem; }
.filters summary { cursor: pointer; color: var(--muted); }
.filters-grid {
    display: grid; gap: .75rem; margin-top: .75rem;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

/* ---------- Détail d'un titre ---------- */
.detail { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.detail-poster img {
    width: 220px; max-width: 40vw; border-radius: var(--radius);
    aspect-ratio: 2/3; object-fit: cover; background: var(--bg-3);
}
.detail-info { flex: 1; min-width: 260px; }
.genres { color: var(--accent-2); font-size: .9rem; }
.overview { color: var(--muted); }

.status-buttons { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; }
.status-btn {
    background: var(--bg-3); color: var(--text); border: 1px solid var(--border);
    padding: .5rem 1rem; border-radius: 8px;
}
.status-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Progression série ---------- */
.progress-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
.all-actions { display: flex; gap: .5rem; }
.progress-bar { height: 8px; background: var(--bg-3); border-radius: 20px; overflow: hidden; margin: .5rem 0 1rem; }
.progress-fill { height: 100%; background: var(--accent-2); }

.season { border: 1px solid var(--border); border-radius: 8px; margin: .5rem 0; padding: .5rem .75rem; }
.season summary { cursor: pointer; font-weight: 600; }
.season-actions { margin: .5rem 0; }
.episodes { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .35rem; }
.ep-form { margin: 0; }
.ep-toggle {
    width: 100%; text-align: left; display: flex; align-items: center; gap: .6rem;
    background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
    padding: .45rem .6rem; border-radius: 6px;
}
.ep-toggle.watched { background: rgba(106,211,168,.12); border-color: rgba(106,211,168,.35); }
.ep-toggle .check {
    width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border);
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    color: var(--accent-2); font-weight: 700;
}
.ep-toggle.watched .check { background: var(--accent-2); color: #12151c; border-color: var(--accent-2); }
.ep-num { font-weight: 600; color: var(--muted); flex-shrink: 0; }
.ep-name { color: var(--text); }

/* ---------- Disponibilité ---------- */
.platforms { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .4rem; }
.platform-row {
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
    background: var(--bg-3); border: 1px solid var(--border);
    padding: .5rem .75rem; border-radius: 8px;
}
.platform-name { font-weight: 600; }
.confirm-date { color: var(--muted); font-size: .85rem; margin-left: auto; }
.alt-country h3 { margin-bottom: .25rem; }
.add-avail { margin-top: 1rem; }
.add-avail summary { cursor: pointer; color: var(--muted); }

/* ---------- Onglets ---------- */
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tab {
    padding: .5rem .9rem; border-radius: 8px; color: var(--muted); background: var(--bg-2);
    border: 1px solid var(--border);
}
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tab:hover { text-decoration: none; }

.status-pill {
    font-size: .72rem; padding: .1rem .5rem; border-radius: 20px; width: fit-content;
}
.status-pill.watched  { background: rgba(106,211,168,.2); color: #a9f0d1; }
.status-pill.watching { background: rgba(79,140,255,.2);  color: #a9c6ff; }
.status-pill.to_watch { background: var(--bg-3); color: var(--muted); }

/* ---------- Admin ---------- */
.dup-group { border-bottom: 1px solid var(--border); padding-bottom: 1rem; margin-bottom: 1rem; }
.merge-form { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; margin-top: .5rem; }
.merge-form label { margin: 0; flex: 1; min-width: 180px; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--border); }

/* ---------- Footer ---------- */
.footer { text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: .85rem; }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    .nav { gap: 0; }
    .nav a { padding: .4rem .5rem; font-size: .85rem; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
