/* ==========================================================================
   Vexa Player — thème sombre premium (bleu électrique / violet)
   ========================================================================== */
:root {
  --bg: #05050c;
  --bg-2: #0b0b18;
  --surface: rgba(255, 255, 255, .035);
  --surface-2: rgba(255, 255, 255, .065);
  --surface-3: rgba(255, 255, 255, .11);
  --line: rgba(255, 255, 255, .075);
  --line-2: rgba(255, 255, 255, .14);
  --text: #f1f2ff;
  --muted: #9396bd;
  --dim: #63668e;
  --blue: #1fb8ff;
  --indigo: #5161ff;
  --violet: #a855f7;
  --grad: linear-gradient(135deg, #1fb8ff 0%, #5161ff 52%, #a855f7 100%);
  --grad-soft: linear-gradient(135deg, rgba(31, 184, 255, .16), rgba(168, 85, 247, .18));
  --glow: 0 0 0 2px rgba(160, 130, 255, .95), 0 0 20px rgba(70, 120, 255, .55), 0 0 42px rgba(168, 85, 247, .35);
  --danger: #ff5a7a;
  --ok: #34d399;
  --warn: #fbbf24;
  --r: 16px;
  --r-sm: 11px;
  --sb: 260px;
  --rail: 84px;
  --top: 74px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
@media (min-width: 1700px) { html { font-size: 19px; } }
@media (min-width: 2400px) { html { font-size: 25px; } }
html, body { height: 100%; margin: 0; }
body {
  background:
    radial-gradient(1100px 700px at -10% -20%, rgba(31, 184, 255, .12), transparent 60%),
    radial-gradient(1000px 700px at 110% -10%, rgba(168, 85, 247, .15), transparent 60%),
    radial-gradient(900px 600px at 50% 125%, rgba(81, 97, 255, .10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { display: block; }
img[data-src] { opacity: 0; transition: opacity .25s; }
img[data-src].ok { opacity: 1; }
.hidden { display: none !important; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.ic { width: 1.25em; height: 1.25em; flex: none; display: block; }
i[data-icon] { display: inline-flex; font-style: normal; }

/* ---------- Focus (télécommande / clavier) ---------- */
:focus { outline: none; }
:focus-visible { outline: none; }
.nav-item:focus, .btn:focus, .cat:focus, .row:focus, .card:focus, .pbtn:focus, .icon-btn:focus,
.pl-chip:focus, .switch:focus, .season:focus, .ep:focus, select:focus, .tile:focus, .chip:focus {
  box-shadow: var(--glow);
  position: relative;
  z-index: 2;
}
input:focus, select:focus, textarea:focus { border-color: rgba(160, 130, 255, .9) !important; box-shadow: 0 0 0 3px rgba(130, 100, 255, .25); }

/* ---------- Scrollbars ---------- */
.scroll { overflow-y: auto; overscroll-behavior: contain; }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.14) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .22); }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }

/* ==========================================================================
   Structure
   ========================================================================== */
#app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); height: 100vh; height: 100dvh; }

/* Menu latéral : barre d'icônes repliée, s'ouvre par-dessus le contenu au clic sur ☰ */
#sidebar {
  position: relative; z-index: 60;
  width: var(--rail);
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 12px 16px;
  background: linear-gradient(180deg, #0e0e20, #08080f);
  border-right: 1px solid var(--line);
  min-height: 0; overflow: hidden;
  transition: width .22s cubic-bezier(.2, .8, .2, 1), box-shadow .22s;
}
#app.nav-open #sidebar { width: var(--sb); box-shadow: 20px 0 60px rgba(0, 0, 0, .55), 1px 0 0 rgba(140, 120, 255, .25); }
.nav-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(3, 3, 10, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .22s; }
#app.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 12px; padding: 0 0 18px; min-height: 66px; }
.nav-toggle { width: 58px; height: 48px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; color: var(--muted); transition: background .15s, color .15s; }
.nav-toggle:hover { background: var(--surface-2); color: var(--text); }
.nav-toggle .ic { width: 24px; height: 24px; }
.nav-toggle:focus { box-shadow: var(--glow); }
.brand-name { font-size: 1.32rem; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
#sidebar .brand-name, #sidebar .nav-item span, #sidebar .sidebar-foot { opacity: 0; transition: opacity .15s; pointer-events: none; }
#app.nav-open #sidebar .brand-name, #app.nav-open #sidebar .nav-item span, #app.nav-open #sidebar .sidebar-foot { opacity: 1; transition-delay: .08s; pointer-events: auto; }
.nav-item span { white-space: nowrap; }
.brand-name b { font-weight: 600; margin-left: 5px; background: linear-gradient(90deg, #8b7bff, #b06cff); -webkit-background-clip: text; background-clip: text; color: transparent; }

#nav { display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.nav-item {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 18px; border-radius: 12px; flex: none;
  color: var(--muted); font-weight: 600; font-size: .96rem; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item .ic { width: 22px; height: 22px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { color: #fff; background: var(--grad-soft); box-shadow: inset 0 0 0 1px rgba(140, 120, 255, .28); }
.nav-item.active .ic { color: #9d8cff; filter: drop-shadow(0 0 8px rgba(120, 110, 255, .7)); }
.nav-sep { height: 1px; background: var(--line); margin: 10px 8px; }
.sidebar-foot { padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: .8rem; color: var(--dim); line-height: 1.5; }
.sidebar-foot strong { display: block; color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#topbar { height: var(--top); flex: none; display: flex; align-items: center; gap: 14px; padding: 0 26px; border-bottom: 1px solid var(--line); }
.top-logo { display: block; width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 0 20px rgba(91, 97, 255, .4); }
.search {
  flex: 1; max-width: 640px; display: flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 16px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: rgba(160, 130, 255, .8); box-shadow: 0 0 0 3px rgba(130, 100, 255, .2), 0 0 26px rgba(80, 110, 255, .25); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0 !important; background: transparent; outline: none; box-shadow: none !important; font-size: .95rem; color: var(--text); }
.search input::placeholder { color: var(--dim); }
.pl-chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: .85rem; font-weight: 600; color: var(--muted); max-width: 260px; }
.pl-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); flex: none; }
.clock { margin-left: auto; font-weight: 700; font-size: 1.15rem; letter-spacing: .02em; font-variant-numeric: tabular-nums; }

#view { flex: 1; min-height: 0; position: relative; }

/* ==========================================================================
   Boutons & formulaires
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 46px; padding: 0 20px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line-2);
  font-weight: 700; font-size: .92rem; white-space: nowrap;
  transition: transform .12s, background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 28px rgba(81, 97, 255, .35); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.danger { color: #ffb3c1; border-color: rgba(255, 90, 122, .35); }
.btn.danger:hover { background: rgba(255, 90, 122, .14); }
.btn.sm { height: 38px; padding: 0 14px; font-size: .84rem; border-radius: 10px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn.on .ic { color: #ffd75e; fill: #ffd75e; }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field label { font-size: .82rem; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.field small { color: var(--dim); font-size: .78rem; line-height: 1.45; }
.input, select.input, textarea.input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 12px;
  background: rgba(0, 0, 0, .35); border: 1px solid var(--line-2); outline: none;
  font-size: .95rem; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 90px; padding: 12px 14px; resize: vertical; }
select.input { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, #9396bd 50%), linear-gradient(135deg, #9396bd 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 38px; }
select.input option { background: #12122a; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-err { display: none; margin: 4px 0 14px; padding: 12px 14px; border-radius: 12px; background: rgba(255, 90, 122, .1); border: 1px solid rgba(255, 90, 122, .3); color: #ffc2cf; font-size: .86rem; line-height: 1.45; }
.form-err.show { display: block; }
.file-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 26px; border: 1.5px dashed var(--line-2); border-radius: 14px; color: var(--muted); text-align: center; cursor: pointer; }
.file-drop:hover, .file-drop.drag { border-color: var(--violet); background: rgba(168, 85, 247, .06); }
.file-drop .ic { width: 34px; height: 34px; color: #9d8cff; }

.switch { position: relative; width: 52px; height: 30px; border-radius: 99px; background: var(--surface-3); flex: none; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--grad); }
.switch[aria-checked="true"]::after { transform: translateX(22px); }

/* ==========================================================================
   États
   ========================================================================== */
.state { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 30px; text-align: center; color: var(--muted); }
.state h2 { margin: 0; color: var(--text); font-size: 1.4rem; }
.state p { margin: 0; max-width: 520px; line-height: 1.6; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .08); border-top-color: var(--blue); border-right-color: var(--violet); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 50px 20px; text-align: center; color: var(--dim); line-height: 1.6; }
.empty .ic { width: 40px; height: 40px; margin: 0 auto 12px; opacity: .6; }

/* ==========================================================================
   Accueil
   ========================================================================== */
.welcome { height: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; padding: 48px 24px 60px; text-align: center; }
.welcome-logo { width: 220px; height: 220px; border-radius: 40px; filter: drop-shadow(0 0 50px rgba(110, 90, 255, .45)); animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px); } }
.welcome h1 { font-size: 2.3rem; letter-spacing: -.03em; margin: 26px 0 10px; }
.welcome > p { color: var(--muted); max-width: 560px; line-height: 1.6; margin: 0 0 30px; font-size: 1.04rem; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.welcome-actions .btn { height: 54px; padding: 0 26px; font-size: 1rem; }
.features { display: grid; grid-template-columns: repeat(4, minmax(0, 190px)); gap: 14px; margin-top: 46px; }
.feature { padding: 20px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); text-align: left; }
.feature .ic { width: 28px; height: 28px; color: #8f86ff; margin-bottom: 12px; }
.feature b { display: block; font-size: .95rem; margin-bottom: 4px; }
.feature span { font-size: .8rem; color: var(--muted); line-height: 1.5; }
.disclaimer { display: flex; gap: 10px; align-items: flex-start; max-width: 720px; margin: 36px auto 0; padding: 14px 18px; border-radius: 14px; background: rgba(81, 97, 255, .07); border: 1px solid rgba(81, 97, 255, .2); color: var(--muted); font-size: .84rem; line-height: 1.55; text-align: left; }
.disclaimer .ic { color: #8f9bff; margin-top: 1px; }

/* ==========================================================================
   Navigation de contenu (TV / Films / Séries / Favoris / Récents)
   ========================================================================== */
.browse { position: absolute; inset: 0; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.browse.live { grid-template-columns: 250px minmax(260px, 1fr) minmax(360px, 1.35fr); }
.col { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--line); }
.col:last-child { border-right: 0; }
.col-head { flex: none; display: flex; align-items: center; gap: 10px; height: 58px; padding: 0 20px; font-weight: 800; font-size: .95rem; letter-spacing: -.01em; }
.col-head .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-head .count { margin-left: auto; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: .76rem; font-weight: 700; }
.col-head .ic { color: #8f86ff; }

.cats { padding: 0 10px 14px; display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; }
.cat { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; text-align: left; color: var(--muted); font-size: .88rem; font-weight: 600; }
.cat span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat em { font-style: normal; font-size: .74rem; color: var(--dim); font-variant-numeric: tabular-nums; }
.cat:hover { background: var(--surface); color: var(--text); }
.cat.active { background: var(--grad-soft); color: #fff; box-shadow: inset 3px 0 0 #8b7bff; }
.cat.active em { color: #b9b2ff; }

.cat-pick, .cat-close, .cat-scrim { display: none; }

/* Liste de chaînes */
.items { flex: 1; min-height: 0; padding: 0 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 8px 12px; border-radius: 12px; cursor: pointer; transition: background .12s; flex: none; }
.row:hover { background: var(--surface-2); }
.row .num { width: 34px; flex: none; text-align: right; font-size: .78rem; font-weight: 700; color: var(--dim); font-variant-numeric: tabular-nums; }
.row .meta { flex: 1; min-width: 0; }
.row .name { font-weight: 700; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.row .sub:empty { display: none; }
.row .favmark .ic { width: 16px; height: 16px; color: #ffd75e; fill: #ffd75e; }
.row.playing { background: var(--grad-soft); box-shadow: inset 0 0 0 1px rgba(140, 120, 255, .35); }
.row.playing .num { color: transparent; position: relative; }
.row.playing .num::after { content: ''; position: absolute; right: 2px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 12px var(--blue); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.logo { position: relative; width: 52px; height: 40px; flex: none; border-radius: 9px; background: rgba(255, 255, 255, .055); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.logo img { max-width: 86%; max-height: 82%; object-fit: contain; }
.logo b { display: none; }
/* Pas de logo disponible : l'icône Vexa Player prend sa place */
.logo.nologo::before, .thumb.nologo::before {
  content: ''; position: absolute; background: url(../assets/icon.png) center / contain no-repeat;
  filter: drop-shadow(0 0 8px rgba(110, 90, 255, .35));
}
.logo.nologo::before { inset: 3px; }

/* Grille d'affiches */
.grid { flex: 1; min-height: 0; padding: 4px 20px 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; align-content: start; }
.card { display: flex; flex-direction: column; gap: 8px; border-radius: 14px; padding: 6px; cursor: pointer; transition: transform .15s, background .15s; min-width: 0; }
.card:hover { background: var(--surface); }
.card:focus { transform: scale(1.04); }
.thumb { position: relative; aspect-ratio: 2 / 3; border-radius: 11px; overflow: hidden; background: linear-gradient(160deg, rgba(81, 97, 255, .25), rgba(168, 85, 247, .18) 60%, rgba(10, 10, 25, 1)); display: flex; align-items: center; justify-content: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb b { display: none; padding: 12px; font-size: .9rem; font-weight: 800; text-align: center; color: #d6d2ff; line-height: 1.35; }
.thumb.nologo b { display: block; position: absolute; left: 0; right: 0; bottom: 10%; }
.thumb.nologo::before { left: 22%; right: 22%; top: 16%; height: 42%; }
.card.chan .thumb.nologo b { display: none; }
.card.chan .thumb.nologo::before { left: 30%; right: 30%; top: 14%; height: 72%; }
.card.chan .thumb { aspect-ratio: 16 / 10; background: rgba(255, 255, 255, .05); }
.card.chan .thumb img { width: 70%; height: 70%; object-fit: contain; }
.thumb .badge { position: absolute; top: 8px; left: 8px; padding: 3px 8px; border-radius: 7px; background: rgba(5, 5, 12, .75); backdrop-filter: blur(6px); font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.thumb .rating { position: absolute; top: 8px; right: 8px; padding: 3px 7px; border-radius: 7px; background: rgba(5, 5, 12, .75); font-size: .72rem; font-weight: 800; color: #ffd75e; }
.thumb .prog { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .15); }
.thumb .prog i { display: block; height: 100%; background: var(--grad); }
.cap { font-size: .84rem; font-weight: 700; line-height: 1.35; padding: 0 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Aperçu (TV en direct) */
.preview { padding: 18px 20px 20px; gap: 16px; overflow-y: auto; }
.slot { position: relative; flex: none; aspect-ratio: 16 / 9; border-radius: var(--r); background: #000; border: 1px solid var(--line); overflow: hidden; }
.slot-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--dim); font-size: .9rem; background: radial-gradient(circle at 50% 40%, rgba(81, 97, 255, .14), transparent 65%); }
.slot-empty img { width: 74px; height: 74px; border-radius: 18px; opacity: .85; }
.pinfo { display: flex; flex-direction: column; gap: 14px; }
.pi-head { display: flex; align-items: center; gap: 14px; }
.pi-head .logo { width: 64px; height: 48px; }
.pi-head h3 { margin: 0; font-size: 1.2rem; letter-spacing: -.01em; }
.pi-head p { margin: 3px 0 0; font-size: .82rem; color: var(--muted); }
.pi-box { padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 6px; font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: rgba(255, 90, 122, .16); color: #ff8ea5; }
.tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.next { background: var(--surface-2); color: var(--muted); }
.tag.next::before { display: none; }
.pi-box h4 { margin: 10px 0 4px; font-size: 1.02rem; }
.pi-box .time { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pi-box .desc { margin: 10px 0 0; font-size: .84rem; color: var(--muted); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.bar { height: 5px; border-radius: 9px; background: rgba(255, 255, 255, .08); margin-top: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 9px; background: var(--grad); }
.pi-next { display: flex; gap: 10px; align-items: center; font-size: .86rem; color: var(--muted); }
.pi-next b { color: var(--text); font-weight: 600; }
.pi-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.tips { display: grid; gap: 10px; font-size: .84rem; color: var(--muted); }
.tips div { display: flex; gap: 10px; align-items: center; }
.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 26px; padding: 0 8px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: .72rem; font-weight: 800; color: var(--text); }

/* ==========================================================================
   Pages (Playlists / Paramètres)
   ========================================================================== */
.page { position: absolute; inset: 0; overflow-y: auto; padding: 30px 34px 60px; }
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head h1 { margin: 0; font-size: 1.75rem; letter-spacing: -.03em; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.pl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.pl-card { position: relative; padding: 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.pl-card.active { border-color: rgba(140, 120, 255, .5); background: linear-gradient(160deg, rgba(31, 184, 255, .08), rgba(168, 85, 247, .1)); box-shadow: 0 10px 40px rgba(81, 97, 255, .15); }
.pl-top { display: flex; gap: 14px; align-items: center; }
.pl-ico { width: 48px; height: 48px; border-radius: 13px; display: flex; align-items: center; justify-content: center; background: var(--grad-soft); color: #a99cff; flex: none; }
.pl-ico .ic { width: 24px; height: 24px; }
.pl-top h3 { margin: 0; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-top p { margin: 3px 0 0; font-size: .78rem; color: var(--muted); }
.pl-top > div { min-width: 0; flex: 1; }
.pill { padding: 4px 10px; border-radius: 99px; font-size: .7rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; background: var(--grad); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 10px; border-radius: 11px; background: rgba(0, 0, 0, .25); text-align: center; }
.stat b { display: block; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: .72rem; color: var(--muted); }
.pl-meta { font-size: .78rem; color: var(--dim); line-height: 1.6; word-break: break-all; }
.pl-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.settings { max-width: 860px; display: flex; flex-direction: column; gap: 18px; }
.set-group { padding: 6px 22px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.set-group h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: #8f86ff; margin: 16px 0 6px; }
.set-row { display: flex; align-items: center; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row > div:first-child { flex: 1; min-width: 0; }
.set-row b { display: block; font-size: .95rem; margin-bottom: 3px; }
.set-row span { font-size: .82rem; color: var(--muted); line-height: 1.5; }
.set-row .input { max-width: 340px; }
.set-row.col-row { flex-direction: column; align-items: stretch; gap: 10px; }
.set-row.col-row .input { max-width: none; }
.about { display: flex; gap: 20px; align-items: center; padding: 20px 0; }
.about img { width: 92px; height: 92px; border-radius: 22px; }
.about p { margin: 4px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.55; }

/* ==========================================================================
   Modales
   ========================================================================== */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } }
.modal-back { position: absolute; inset: 0; background: rgba(3, 3, 10, .72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.modal-box { position: relative; width: 100%; max-width: 540px; max-height: 100%; display: flex; flex-direction: column; border-radius: 22px; background: linear-gradient(170deg, #12122a, #0b0b19); border: 1px solid var(--line-2); box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 60px rgba(81, 97, 255, .14); animation: pop .22s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { transform: translateY(14px) scale(.98); } }
.modal.wide .modal-box { max-width: 980px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 10px; }
.modal-head h2 { margin: 0; font-size: 1.2rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 10px 22px 6px; overflow-y: auto; min-height: 0; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px 20px; flex-wrap: wrap; }
.modal-foot:empty { display: none; }
.modal p.lead { margin: 0 0 16px; color: var(--muted); font-size: .9rem; line-height: 1.55; }

/* Série */
.series-head { display: flex; gap: 20px; margin-bottom: 18px; }
.series-head img { width: 150px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 14px; flex: none; background: var(--surface-2); }
.series-head .meta { font-size: .82rem; color: var(--muted); margin-bottom: 10px; }
.series-head p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.seasons { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px; scrollbar-width: none; }
.season { flex: none; height: 38px; padding: 0 16px; border-radius: 10px; background: var(--surface-2); font-weight: 700; font-size: .85rem; color: var(--muted); }
.season.active { background: var(--grad); color: #fff; }
.eps { display: flex; flex-direction: column; gap: 6px; padding-bottom: 6px; }
.ep { display: flex; gap: 14px; align-items: center; padding: 8px; border-radius: 12px; cursor: pointer; text-align: left; }
.ep:hover { background: var(--surface-2); }
.ep .eimg { width: 128px; aspect-ratio: 16 / 9; border-radius: 9px; overflow: hidden; background: var(--surface-2); flex: none; display: flex; align-items: center; justify-content: center; color: var(--dim); }
.ep .eimg img { width: 100%; height: 100%; object-fit: cover; }
.ep b { display: block; font-size: .9rem; margin-bottom: 4px; }
.ep span { font-size: .78rem; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ep .eprog { height: 3px; background: rgba(255,255,255,.1); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.ep .eprog i { display: block; height: 100%; background: var(--grad); }

/* Guide EPG */
.guide-day { font-size: .76rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #8f86ff; margin: 14px 0 8px; }
.guide-day:first-child { margin-top: 0; }
.prog { display: flex; gap: 16px; padding: 12px 14px; border-radius: 12px; }
.prog:nth-child(odd) { background: var(--surface); }
.prog.now { background: var(--grad-soft); box-shadow: inset 0 0 0 1px rgba(140, 120, 255, .3); }
.prog.past { opacity: .5; }
.prog time { width: 54px; flex: none; font-weight: 800; font-size: .86rem; font-variant-numeric: tabular-nums; }
.prog b { display: block; font-size: .9rem; }
.prog span { display: block; font-size: .8rem; color: var(--muted); margin-top: 4px; line-height: 1.5; }

/* Chargement global */
.busy { position: fixed; inset: 0; z-index: 400; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: rgba(3, 3, 10, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); text-align: center; padding: 30px; }
.busy img { width: 96px; height: 96px; border-radius: 24px; animation: float 3s ease-in-out infinite; filter: drop-shadow(0 0 30px rgba(110, 90, 255, .5)); }
.busy p { margin: 0; color: var(--muted); font-weight: 600; }

/* Toasts */
#toasts { position: fixed; z-index: 500; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; max-width: 440px; display: flex; gap: 10px; align-items: flex-start; padding: 13px 16px; border-radius: 13px; background: rgba(20, 20, 42, .96); border: 1px solid var(--line-2); box-shadow: 0 14px 40px rgba(0, 0, 0, .5); font-size: .88rem; line-height: 1.45; animation: toastIn .25s ease; }
.toast .ic { color: #8f9bff; margin-top: 1px; }
.toast.error .ic { color: var(--danger); }
.toast.ok .ic { color: var(--ok); }
.toast.warn .ic { color: var(--warn); }
.toast.out { opacity: 0; transform: translateY(8px); transition: .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* ==========================================================================
   Lecteur
   ========================================================================== */
.player { position: fixed; z-index: 50; background: #000; overflow: hidden; }
.player.mini { border-radius: var(--r); }
.player.full { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; z-index: 150; border-radius: 0; }
.player video { width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }
.player.full.idle { cursor: none; }

.p-spinner { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; pointer-events: none; }
.p-spinner span { width: 54px; height: 54px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .1); border-top-color: var(--blue); border-right-color: var(--violet); animation: spin .8s linear infinite; }
.player.loading .p-spinner { display: flex; }
.p-error { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(5, 5, 12, .88); z-index: 3; }
.p-error-box { max-width: 520px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.p-error-box .ic { width: 40px; height: 40px; color: var(--danger); }
.p-error-box p { margin: 0; color: var(--muted); line-height: 1.55; font-size: .9rem; }
.player.mini .p-error-box p { font-size: .8rem; }

.p-expand { position: absolute; right: 12px; bottom: 12px; width: 40px; height: 40px; border-radius: 10px; display: none; align-items: center; justify-content: center; background: rgba(5, 5, 12, .6); backdrop-filter: blur(6px); opacity: 0; transition: opacity .2s; z-index: 2; }
.player.mini .p-expand { display: flex; }
.player.mini:hover .p-expand { opacity: 1; }
.player.mini video { cursor: pointer; }

.p-overlay { position: absolute; inset: 0; display: none; flex-direction: column; justify-content: space-between; transition: opacity .3s; z-index: 2; pointer-events: none; }
.player.full .p-overlay { display: flex; }
.player.full.idle .p-overlay { opacity: 0; }
.p-top, .p-bottom { pointer-events: auto; }
.p-top { display: flex; align-items: center; gap: 18px; padding: 26px 34px 60px; background: linear-gradient(180deg, rgba(0, 0, 0, .85), transparent); }
.p-titles { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; }
.p-titles .logo { width: 70px; height: 52px; background: rgba(255, 255, 255, .08); }
.p-titles .logo:empty { display: none; }
.p-titles h2 { margin: 0; font-size: 1.45rem; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-titles p { margin: 4px 0 0; color: rgba(255, 255, 255, .7); font-size: .9rem; }
.p-titles > div { min-width: 0; }
.p-clock { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.p-bottom { padding: 60px 34px 28px; background: linear-gradient(0deg, rgba(0, 0, 0, .9), transparent); display: flex; flex-direction: column; gap: 14px; }
.p-epg { display: flex; flex-direction: column; gap: 6px; max-width: 760px; }
.p-epg:empty { display: none; }
.p-epg .now-title { font-size: 1.05rem; font-weight: 700; }
.p-epg .now-time { font-size: .82rem; color: rgba(255, 255, 255, .7); }
.p-epg .bar { max-width: 420px; margin-top: 4px; }
.p-epg .next-title { font-size: .84rem; color: rgba(255, 255, 255, .6); }
.p-seek { display: flex; align-items: center; gap: 14px; font-size: .82rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.p-seek input { flex: 1; }
.p-ctrl { display: flex; align-items: center; gap: 20px; }
.p-ctrl .grp { display: flex; align-items: center; gap: 8px; }
.p-ctrl .grp.end { margin-left: auto; }
.pbtn { width: 50px; height: 50px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; transition: background .15s, transform .12s; flex: none; }
.pbtn:hover { background: rgba(255, 255, 255, .12); }
.pbtn:active { transform: scale(.93); }
.pbtn .ic { width: 24px; height: 24px; }
.pbtn.main { width: 62px; height: 62px; background: var(--grad); box-shadow: 0 6px 26px rgba(81, 97, 255, .5); }
.pbtn.main .ic { width: 28px; height: 28px; }
.pbtn.on .ic { color: #ffd75e; fill: #ffd75e; }
.pbtn[disabled] { opacity: .3; pointer-events: none; }

input[type=range] { -webkit-appearance: none; appearance: none; height: 22px; background: transparent; cursor: pointer; --p: 0%; }
input[type=range]::-webkit-slider-runnable-track { height: 5px; border-radius: 9px; background: linear-gradient(90deg, #1fb8ff, #a855f7) 0 0 / var(--p) 100% no-repeat, rgba(255, 255, 255, .2); }
input[type=range]::-moz-range-track { height: 5px; border-radius: 9px; background: rgba(255, 255, 255, .2); }
input[type=range]::-moz-range-progress { height: 5px; border-radius: 9px; background: linear-gradient(90deg, #1fb8ff, #a855f7); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -5.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 12px rgba(130, 110, 255, .9); }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; }
input[type=range]:focus { box-shadow: none !important; }
input[type=range]:focus::-webkit-slider-thumb { box-shadow: 0 0 0 5px rgba(160, 130, 255, .45), 0 0 18px rgba(130, 110, 255, 1); transform: scale(1.25); }
#pVol { width: 110px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1280px) {
  .browse.live { grid-template-columns: 220px minmax(240px, 1fr) minmax(320px, 1.2fr); }
}
@media (max-width: 1050px) {
  .browse.live { grid-template-columns: 210px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .browse.live .preview { grid-column: 1 / -1; grid-row: 1; flex-direction: row; align-items: flex-start; border-bottom: 1px solid var(--line); border-right: 0; overflow: visible; }
  .browse.live .slot { width: 46%; max-width: 520px; }
  .browse.live .pinfo { flex: 1; min-width: 0; }
  .browse.live .pi-box .desc { -webkit-line-clamp: 2; }
  .browse { grid-template-columns: 210px minmax(0, 1fr); }
  .features { grid-template-columns: repeat(2, minmax(0, 220px)); }
}
@media (max-width: 760px) {
  :root { --top: 62px; }
  #app { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  #sidebar { grid-row: 2; width: auto !important; box-shadow: none !important; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  #sidebar .nav-item span { opacity: 1; }
  .brand, .sidebar-foot, .nav-sep, .nav-scrim { display: none; }
  #nav { flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .nav-item { flex: 1 0 64px; flex-direction: column; gap: 4px; padding: 8px 4px; font-size: .66rem; }
  .nav-item span { display: block; white-space: nowrap; }
  #topbar { padding: 0 12px; gap: 10px; }
  .top-logo { display: block; }
  .pl-chip, .clock { display: none; }
  .search { height: 42px; }
  .browse, .browse.live { display: flex; flex-direction: column; }
  .browse .col { border-right: 0; flex: 1; min-height: 0; }
  /* Catégories : panneau qui monte du bas, ouvert par le bouton « catégorie ▾ » */
  .browse .col.cat-col {
    position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; top: 16%; flex: none;
    background: linear-gradient(180deg, #12122a, #0a0a17); border: 1px solid var(--line-2); border-bottom: 0;
    border-radius: 22px 22px 0 0; box-shadow: 0 -20px 60px rgba(0, 0, 0, .6);
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(105%); visibility: hidden; transition: transform .22s ease, visibility 0s .22s;
  }
  .browse.cats-open .col.cat-col { transform: none; visibility: visible; transition: transform .22s ease; }
  .cat-col .col-head { height: 58px; padding: 0 10px 0 20px; border-bottom: 1px solid var(--line); }
  .cat-close { display: flex; align-items: center; justify-content: center; margin-left: 10px; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); color: var(--text); flex: none; }
  .cat-col .col-head .count { display: none; }
  .cats { padding: 8px 10px 16px; }
  .cat { min-height: 50px; font-size: .95rem; }
  .cat-scrim { position: fixed; inset: 0; z-index: 60; background: rgba(3, 3, 10, .6); }
  .browse.cats-open .cat-scrim { display: block; }
  .cat-pick {
    display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: calc(100% - 64px); height: 38px; padding: 0 12px 0 14px;
    border-radius: 99px; background: var(--grad-soft); border: 1px solid rgba(140, 120, 255, .35); color: #fff; font-weight: 800; font-size: .88rem;
  }
  .cat-pick span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cat-pick .ic { flex: none; width: 18px; height: 18px; color: #b9b2ff; }
  #listTitle { display: none; }
  /* Lecteur en haut, taille fixe ; la liste prend le reste et défile */
  .browse.live .preview { flex: none; flex-direction: column; padding: 10px 12px 8px; gap: 8px; order: -1; overflow: visible; border-bottom: 1px solid var(--line); }
  .browse.live .slot { width: 100%; max-width: none; }
  .browse.live .pinfo { flex-direction: row; align-items: center; gap: 10px; }
  .browse.live .pinfo .pi-box, .browse.live .pinfo .tips, .browse.live .pinfo .pi-next, .browse.live #piEpg { display: none; }
  .browse.live .pi-head { flex: 1; min-width: 0; gap: 10px; }
  .browse.live .pi-head .logo { width: 44px; height: 34px; }
  .browse.live .pi-head > div { min-width: 0; }
  .browse.live .pi-head h3 { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .browse.live .pi-head p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .browse.live .pi-actions { flex: none; flex-wrap: nowrap; gap: 6px; }
  .browse.live .pi-actions .btn { width: 40px; height: 40px; min-height: 40px; padding: 0; justify-content: center; }
  .browse.live .pi-actions .btn span { display: none; }
  .col-head { height: 46px; padding: 0 14px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; padding: 4px 12px 20px; }
  .items { padding: 0 8px 12px; }
  .page { padding: 20px 14px 40px; }
  .pl-grid { grid-template-columns: 1fr; }
  .set-row { flex-wrap: wrap; }
  .set-row .input { max-width: none; }
  .welcome { padding-top: 26px; }
  .welcome-logo { width: 150px; height: 150px; }
  .welcome h1 { font-size: 1.6rem; }
  .features { grid-template-columns: 1fr 1fr; }
  .p-top { padding: 14px 14px 40px; }
  .p-bottom { padding: 40px 14px 16px; }
  .p-titles h2 { font-size: 1.05rem; }
  .p-clock, .grp.vol, #pPip { display: none; }
  .p-ctrl { gap: 8px; }
  .pbtn { width: 44px; height: 44px; }
  .series-head img { width: 100px; }
  .ep .eimg { width: 96px; }
  .row2 { grid-template-columns: 1fr; }
  #toasts { left: 12px; right: 12px; bottom: 80px; align-items: stretch; }
}
@media (hover: none) {
  .player.mini .p-expand { opacity: 1; }
}
