/* cinoche — thème cinéma sombre. Vanilla, sans dépendance. */
:root {
  --bg: #0d0e13;
  --panel: #15161c;
  --panel-2: #1c1e27;
  --line: #262936;
  --text: #e7e8ee;
  --muted: #9498a8;
  --accent: #e5b13a;
  --danger: #e0655e;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* ── Barre du haut ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #14151c, #101117);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; text-decoration: none; letter-spacing: .3px; }
.brand span { color: var(--accent); }
.topnav { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.topnav a { color: var(--muted); text-decoration: none; }
.topnav a:hover { color: var(--text); }
.who { color: var(--text); font-weight: 600; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 80px; }

/* ── Auth ── */
.auth {
  max-width: 380px; margin: 12vh auto 0; padding: 32px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.auth h1 { margin: 0 0 4px; }
.auth form { display: grid; gap: 14px; margin-top: 20px; }
.auth label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }

input, select, button {
  font: inherit; color: var(--text);
}
input, select {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
button {
  background: var(--accent); color: #1a1400; border: 0; cursor: pointer;
  border-radius: 8px; padding: 10px 16px; font-weight: 600;
}
button:hover { filter: brightness(1.06); }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); background: #2a1614; border: 1px solid #4a2320;
  padding: 8px 12px; border-radius: 8px; }
.ok { color: #6fd08a; background: #14251a; border: 1px solid #244a30;
  padding: 8px 12px; border-radius: 8px; }
.empty { color: var(--muted); text-align: center; padding: 48px 0; }

/* ── Barre d'outils / filtres ── */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.search { flex: 1; min-width: 220px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.chip {
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
  padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 500;
}
.chip.on { background: var(--accent); color: #1a1400; border-color: var(--accent); }

/* ── Grille ── */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; text-align: left; padding: 0; color: inherit;
  transition: transform .12s ease, border-color .12s ease;
}
.tile:hover { transform: translateY(-3px); border-color: #38404f; }
.tile .poster { position: relative; aspect-ratio: 16/9; background: #0a0b0f; }
.tile .poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .play {
  position: absolute; inset: 0; display: grid; place-items: center;
  opacity: 0; transition: opacity .12s; font-size: 34px; color: #fff;
  background: rgba(0,0,0,.28);
}
.tile:hover .play { opacity: 1; }
.tile .lvl {
  position: absolute; top: 8px; right: 8px; font-size: 10px; letter-spacing: .4px;
  background: rgba(0,0,0,.6); color: #ddd; padding: 3px 7px; border-radius: 6px;
}
.tile .meta { padding: 10px 12px 12px; }
.tile .t { font-weight: 600; }
.tile .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ── Lecteur (modale) ── */
.player {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(4,5,8,.86); padding: 20px;
}
.player-inner { width: min(1000px, 100%); }
.player video { width: 100%; border-radius: 10px; background: #000; max-height: 74vh; }
.player h2 { margin: 14px 4px 2px; }
.pdesc { margin: 6px 4px 0; color: #cfd2dc; white-space: pre-wrap; }
.player .close {
  position: absolute; top: 16px; right: 20px; background: transparent; color: #fff;
  font-size: 22px; padding: 6px 10px;
}

/* ── Admin ── */
.page-h1 { margin: 8px 0 20px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 22px;
}
.card h2 { margin: 0 0 14px; font-size: 17px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.link-danger { background: transparent; color: var(--danger); padding: 2px 4px; font-weight: 600; }
.adder { margin-top: 16px; }
.adder summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-top: 14px; }
.form-row label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }

textarea {
  font: inherit; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  outline: none; resize: vertical; width: 100%;
}
textarea:focus { border-color: var(--accent); }

/* Import */
.upload .up-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px 16px; align-items: end; margin-top: 14px; }
.upload label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.up-desc { grid-column: 1 / -1; }
.up-actions { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
#up-progress { width: 220px; height: 14px; }

/* Sélecteur de vignette (import) */
.up-video-row { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.up-file { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.picker { display: grid; gap: 10px; flex: 1; min-width: 280px; }
.pick-video { width: 100%; max-width: 520px; max-height: 300px; background: #000; border-radius: 8px; }
.pick-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pick-file { font-size: 12px; color: var(--muted); display: grid; gap: 4px; }
.thumb-mini { width: 128px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; background: #0a0b0f; }
.btn-ghost {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 13px;
}
.btn-ghost:hover { border-color: var(--accent); filter: none; }

/* Fichiers FTP détectés */
.orphan-row {
  display: flex; align-items: center; gap: 14px; padding: 8px 0;
  border-top: 1px solid var(--line); flex-wrap: wrap;
}
.orphan-row:first-of-type { border-top: 0; }
.orphan-row code { flex: 1; min-width: 200px; word-break: break-all; }
.orphan-row button { padding: 6px 12px; }

/* Capture depuis la vidéo en ligne (édition) */
.pick-details { font-size: 12px; }
.pick-details summary { cursor: pointer; color: var(--accent); }
.row-video { width: 100%; margin: 8px 0; background: #000; border-radius: 6px; max-height: 220px; }
.row-capture { margin-bottom: 6px; }

/* Édition d'un film */
.film-edit { display: flex; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.film-edit:first-of-type { border-top: 0; }
.thumb-sm { width: 160px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: #0a0b0f; flex: none; }
.film-thumb { display: grid; gap: 6px; width: 160px; flex: none; }
.repl { font-size: 11px; color: var(--muted); display: grid; gap: 3px; }
.repl input { font-size: 11px; }
.film-fields { display: grid; grid-template-columns: 2fr 1fr; gap: 10px 14px; flex: 1; }
.film-fields label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.film-desc { grid-column: 1 / -1; }
.film-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.film-actions button[type=submit] { padding: 7px 14px; }
.link-warn { background: transparent; color: #d9a441; padding: 2px 4px; font-weight: 600; }

@media (max-width: 720px) {
  .upload .up-grid { grid-template-columns: 1fr; }
  .up-file { grid-row: auto; }
  .film-edit { flex-direction: column; }
  .film-fields { grid-template-columns: 1fr; }
  .thumb-sm, .film-thumb { width: 100%; }
}
