/* Portail Nelsflix — thème sombre, mobile-first. */

:root {
  --bg: #100d0e;
  --surface: #1a1516;
  --surface-2: #241d1f;
  --border: #362b2e;
  --text: #f0e9ea;
  --muted: #a2918f;
  --accent: #e5484d;
  --accent-dim: #c2373c;
  --accent-contrast: #2a0c0e;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --info: #7dd3fc;
  --radius: 12px;
  --nav-h: 62px;
  --tap: 44px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
  min-height: 100dvh;
}

#app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

/* ---------- En-tête ---------- */

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--accent); }
.brand h1 { font-size: 1.1rem; font-weight: 700; color: var(--text); letter-spacing: .02em; }

/* ---------- Navigation ---------- */

#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

#nav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  min-height: var(--nav-h);
  color: var(--muted);
  text-decoration: none;
  font-size: .72rem;
}

#nav a svg { width: 22px; height: 22px; }
#nav a[aria-current="page"] { color: var(--accent); }

main {
  flex: 1;
  padding: 16px 16px calc(var(--nav-h) + 24px);
  max-width: 900px; width: 100%; margin: 0 auto;
}

/* ---------- Blocs ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.card h2 { font-size: .95rem; margin-bottom: 12px; color: var(--muted); font-weight: 600; }

.statut-card { text-align: center; padding: 26px 16px; }
.statut-card .pastille {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.statut-card h3 { font-size: 1.5rem; margin: 14px 0 6px; }
.statut-card p { color: var(--muted); font-size: .9rem; }

.pastille.offert   { background: rgba(74,222,128,.14); color: var(--ok); }
.pastille.actif    { background: rgba(74,222,128,.14); color: var(--ok); }
.pastille.bientot  { background: rgba(251,191,36,.14); color: var(--warn); }
.pastille.en_retard{ background: rgba(251,191,36,.18); color: var(--warn); }
.pastille.expire   { background: rgba(248,113,113,.16); color: var(--danger); }
.pastille.sans_abonnement { background: rgba(162,145,143,.16); color: var(--muted); }

.lignes { display: flex; flex-direction: column; gap: 8px; }
.ligne { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; }
.ligne span:first-child { color: var(--muted); }
.ligne span:last-child { text-align: right; }

/* ---------- Contrôles ---------- */

button, .btn {
  font: inherit; cursor: pointer; border-radius: 9px; border: 1px solid transparent;
  min-height: var(--tap); padding: 0 16px;
}

.btn-primary { background: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent-dim); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(248,113,113,.4); }
.btn-sm { min-height: 34px; padding: 0 10px; font-size: .82rem; }

input, select, textarea {
  font: inherit; width: 100%;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 10px 12px; min-height: var(--tap);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-dim); outline-offset: 1px; }

label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 5px; }
.champ { margin-bottom: 12px; }

.msg { padding: 10px 12px; border-radius: 9px; font-size: .88rem; margin-bottom: 12px; }
.msg.erreur { background: rgba(248,113,113,.12); color: var(--danger); }
.msg.succes { background: rgba(74,222,128,.12); color: var(--ok); }
.msg.info   { background: rgba(125,211,252,.10); color: var(--info); }

/* ---------- Interrupteur d'exemption ---------- */

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .piste {
  width: 42px; height: 24px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  position: relative; transition: background .15s;
}
.switch .piste::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--muted); transition: transform .15s, background .15s;
}
.switch input:checked + .piste { background: rgba(74,222,128,.25); border-color: var(--ok); }
.switch input:checked + .piste::after { transform: translateX(18px); background: var(--ok); }
.switch input:focus-visible + .piste { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Tableau admin ---------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 640px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }
td .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: .72rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted);
}
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.danger { color: var(--danger); }

/* ---------- Nouveautés ---------- */

.nouveautes { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.nouveaute img { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.nouveaute p { font-size: .76rem; margin-top: 5px; line-height: 1.25; }
.nouveaute span { font-size: .72rem; color: var(--muted); }

/* ---------- Divers ---------- */

.vide { color: var(--muted); font-size: .88rem; text-align: center; padding: 20px 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; word-break: break-all; }
.centre { display: flex; align-items: center; justify-content: center; min-height: 70vh; }
.centre .card { width: 100%; max-width: 380px; margin: 0; }
.entete-section { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.entete-section h2 { margin: 0; }
