:root {
  --bg: #141414; --panel: #1f1f1f; --panel2: #2a2a2a; --text: #ececec; --muted: #9a9a9a;
  --accent: #e50914; --accent2: #b20710; --ok: #2e9e5b; --warn: #d39b1f; --info: #2f7ed8; --err: #d33f3f;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: #fff; }
h1 { margin: 0 0 16px; font-size: 1.7rem; }
h2 { margin: 40px 0 12px; font-size: 1.25rem; }

.card { background: var(--panel); border-radius: 10px; padding: 24px; }
.narrow { max-width: 420px; margin: 40px auto; }
.detail { display: grid; grid-template-columns: 220px 1fr; gap: 24px; }
.detail img { width: 100%; border-radius: 8px; }
@media (max-width: 640px) { .detail { grid-template-columns: 1fr; } .detail img { max-width: 200px; } }

label { display: block; margin: 0 0 14px; color: var(--muted); font-size: .9rem; }
input[type=text], input[type=email], input[type=password], input[type=search], input:not([type]) {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid #444; border-radius: 6px;
  background: var(--panel2); color: var(--text); font-size: 1rem; }
input:focus { outline: 2px solid var(--accent); border-color: transparent; }
fieldset { border: 1px solid #333; border-radius: 8px; margin: 16px 0; padding: 12px 16px; }
label.check { color: var(--text); display: flex; gap: 8px; align-items: center; margin: 6px 0; }

button, .button { display: inline-block; padding: 9px 18px; border: 0; border-radius: 6px; background: var(--accent);
  color: #fff; font-size: .95rem; font-weight: 600; cursor: pointer; text-decoration: none; }
button:hover, .button:hover { background: var(--accent2); }
button.secondary { background: #444; } button.secondary:hover { background: #555; }
button.danger { background: transparent; color: var(--err); border: 1px solid var(--err); }
button.link { background: none; padding: 0; color: var(--text); font-weight: 400; }
button.link:hover { text-decoration: underline; }
button.link.danger { border: 0; color: var(--err); font-size: .85rem; }
form.inline { display: inline; }

.searchbar { display: flex; gap: 8px; margin-bottom: 24px; }
.searchbar input { margin: 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.muted { color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.tile { background: var(--panel); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.tile img { width: 100%; aspect-ratio: 2/3; object-fit: cover; background: var(--panel2); }
.tile-body { padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tile-body h3 { margin: 0; font-size: .95rem; }
.tile-body .button { margin-top: auto; text-align: center; }
.overview { font-size: .82rem; color: var(--muted); margin: 0; }
progress { width: 100%; height: 6px; accent-color: var(--accent); }

.badge { display: inline-block; width: fit-content; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #444; }
.st-pending, .st-searching { background: var(--info); }
.st-not_found { background: var(--warn); color: #111; }
.st-downloading { background: #7b4fd6; }
.st-airing { background: #2f7fd6; }
.st-completed { background: var(--ok); }
.st-failed, .st-rejected { background: var(--err); }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.flash-success { background: rgba(46,158,91,.2); border: 1px solid var(--ok); }
.flash-error { background: rgba(211,63,63,.2); border: 1px solid var(--err); }
.flash-info { background: rgba(47,126,216,.2); border: 1px solid var(--info); }

.tile-body .meta { margin: -2px 0 0; font-size: .82rem; color: var(--muted); }
.button.secondary-btn { background: #444; }
.button.secondary-btn:hover { background: #555; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 8px; overflow: hidden; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #2c2c2c; vertical-align: top; font-size: .88rem; }
th { background: var(--panel2); }
td.actions { white-space: nowrap; }
td.actions button { padding: 4px 10px; font-size: .8rem; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.chip { padding: 5px 14px; border-radius: 999px; background: var(--panel2); color: var(--text); text-decoration: none; font-size: .88rem; border: 1px solid #3a3a3a; }
.chip:hover { background: #3a3a3a; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* Bibliothèque */
.filters-sep { width: 1px; background: #3a3a3a; margin: 0 6px; }
.tile-actions { margin-top: auto; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.tile-actions .link { align-self: center; }
.seen-btn { background: #444; font-weight: 500; }
.seen-btn:hover { background: #555; }
.seen-btn.is-on { background: var(--ok); }
.seen-btn.is-on:hover { background: #267f4a; }
.tile.is-seen img { opacity: .55; }
.tile.is-deleting { opacity: .6; }
.error-text { color: var(--err); }

/* Profil */
.profile { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.profile h2 { margin: 0 0 14px; }
.profile dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.profile dt { color: var(--muted); }
.profile dd { margin: 0; }
.devices { list-style: none; margin: 0 0 14px; padding: 0; }
.devices li { padding: 8px 0; border-bottom: 1px solid #2c2c2c; font-size: .88rem; }

/* ---------- Mise en page : menu latéral (ordinateur) / onglets en bas (smartphone) ---------- */
:root { --side: 240px; --sidebg: #101010; --tabh: 62px; }
main { max-width: 1400px; margin: 0 auto; padding: 28px 32px 64px; }
.ico { width: 22px; height: 22px; flex: none; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 1.6rem; text-decoration: none; letter-spacing: .5px; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 30; display: flex; flex-direction: column;
  gap: 18px; padding: 22px 14px 16px; background: var(--sidebg); border-right: 1px solid #222; overflow-y: auto; }
.sidebar .brand { padding: 0 10px; }
.brand img { width: 32px; height: 32px; flex: none; }
.mobilebar .brand img { width: 28px; height: 28px; }
.side-search { position: relative; }
.side-search .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.side-search input[type=search] { margin: 0; padding: 8px 10px 8px 36px; font-size: .92rem; border-radius: 8px; background: #1c1c1c; border-color: #2e2e2e; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-title { margin: 14px 10px 6px; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6f6f6f; }
.side-title:first-child { margin-top: 0; }
.side-nav a, .side-logout { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 12px; border-radius: 8px;
  color: #cfcfcf; text-decoration: none; font-size: .95rem; font-weight: 500; background: none; text-align: left; }
.side-nav a:hover, .side-logout:hover { background: #1e1e1e; color: #fff; }
.side-nav a.active { background: rgba(229,9,20,.16); color: #fff; }
.side-nav a.active .ico { color: var(--accent); }
.side-nav form { margin: 0; }
.side-user { margin: auto 0 0; display: flex; align-items: center; gap: 10px; padding: 12px 12px 0; border-top: 1px solid #222; color: var(--muted); font-size: .88rem; }
.side-user .ico { width: 18px; height: 18px; }

.mobilebar { display: none; }
.no-nav .mobilebar { display: flex; padding: 14px 24px; background: linear-gradient(#000, var(--bg)); }
.tabbar { display: none; }

@media (min-width: 900px) {
  body.with-nav { padding-left: var(--side); }
}

@media (max-width: 899px) {
  .sidebar { display: none; }
  main { padding: 18px 14px calc(var(--tabh) + 28px + env(safe-area-inset-bottom)); }
  .with-nav .mobilebar { display: flex; position: sticky; top: 0; z-index: 30; padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: rgba(16,16,16,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid #222; }
  .mobilebar .brand { font-size: 1.3rem; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px 4px env(safe-area-inset-bottom); background: rgba(16,16,16,.96);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid #262626; }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: var(--tabh); padding: 4px 2px; color: #8d8d8d; text-decoration: none; font-size: .68rem; font-weight: 600;
    -webkit-tap-highlight-color: transparent; }
  .tabbar a .ico { width: 24px; height: 24px; }
  .tabbar a.active { color: #fff; }
  .tabbar a.active .ico { color: var(--accent); }
  h1 { font-size: 1.45rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
}

/* Raccourcis du compte (page profil, smartphone uniquement) */
.only-mobile { display: none; }
@media (max-width: 899px) {
  .only-mobile { display: block; }
  .account-links { margin: 0 0 18px; background: var(--panel); border-radius: 10px; overflow: hidden; }
  .account-links a, .account-links button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px;
    background: none; border: 0; border-radius: 0; border-bottom: 1px solid #2c2c2c; color: var(--text);
    text-decoration: none; font-size: 1rem; font-weight: 500; text-align: left; }
  .account-links form { margin: 0; }
  .account-links button { border-bottom: 0; color: var(--err); }
  .account-links a:active, .account-links button:active { background: var(--panel2); }
}

/* Actualités : saisons disponibles */
.tile-body .seasons { margin: 0; color: var(--ok); font-size: .82rem; font-weight: 600; line-height: 1.35; }
.season-ok { color: var(--ok); font-size: .82rem; font-weight: 600; }
.small { font-size: .85rem; margin: 0 0 8px; }

/* Déjà là : pictos Vu / J'aime / Je n'aime pas */
.tile-icons { display: flex; gap: 6px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; flex: 1; min-height: 38px;
  padding: 6px 4px; border-radius: 8px; background: #2c2c2c; color: #a5a5a5; font-weight: 600; font-size: .82rem;
  -webkit-tap-highlight-color: transparent; transition: background .15s, color .15s, transform .1s; }
.icon-btn:hover { background: #383838; color: #fff; }
.icon-btn:active { transform: scale(.94); }
.icon-btn .ico { width: 20px; height: 20px; }
.icon-btn .count:empty { display: none; }
.icon-btn.is-on .ico { fill: currentColor; fill-opacity: .22; }
.icon-btn.seen.is-on, .icon-btn.up.is-on { color: var(--ok); background: rgba(46,158,91,.16); }
.icon-btn.down.is-on { color: var(--err); background: rgba(211,63,63,.16); }
.icon-btn.is-busy { opacity: .6; pointer-events: none; }

/* Actualités : pastille « C'est tout chaud » sur l'affiche */
.tile { position: relative; }
.hot-badge { position: absolute; top: 8px; left: 8px; z-index: 2; padding: 3px 9px; border-radius: 999px;
  background: linear-gradient(135deg, #ff7a18, #e50914); color: #fff; font-size: .72rem; font-weight: 800;
  letter-spacing: .02em; box-shadow: 0 2px 8px rgba(0,0,0,.45); }

/* Quoi de neuf */
.feed-day { margin: 28px 0 10px; font-size: 1rem; color: var(--muted); font-weight: 700; }
.feed { list-style: none; margin: 0; padding: 0; background: var(--panel); border-radius: 10px; overflow: hidden; }
.feed-item { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-bottom: 1px solid #2a2a2a; }
.feed-item:last-child { border-bottom: 0; }
.feed-item img { width: 46px; aspect-ratio: 2/3; object-fit: cover; border-radius: 4px; background: var(--panel2); flex: none; }
.feed-body { flex: 1; min-width: 0; }
.feed-title { margin: 2px 0 0; font-weight: 700; font-size: .95rem; }
.feed-meta { margin: 1px 0 0; font-size: .82rem; color: var(--muted); }
.feed-meta strong { color: var(--text); font-weight: 600; }
.feed-time { color: var(--muted); font-size: .82rem; flex: none; align-self: flex-start; padding-top: 2px; }
.ev { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .7rem; font-weight: 700; }
.ev-added { background: rgba(46,158,91,.18); color: #4cc781; }
.ev-request { background: rgba(47,126,216,.18); color: #6aa8f0; }
.ev-deleted { background: rgba(211,63,63,.18); color: #f07272; }
.feed-more { text-align: center; margin-top: 22px; }

/* Bande-annonce : bouton et lecteur */
.trailer-btn { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 4px 11px 4px 8px;
  border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid #3a3a3a; color: var(--text);
  font-size: .8rem; font-weight: 600; text-decoration: none; }
.trailer-btn:hover { background: rgba(255,255,255,.16); }
.trailer-btn .ico { width: 14px; height: 14px; fill: currentColor; stroke-width: 1.4; }
.detail .trailer-btn { margin-left: 8px; vertical-align: middle; }
.player { width: min(960px, 94vw); padding: 0; border: 0; border-radius: 12px; background: #000; color: var(--text);
  box-shadow: 0 20px 60px rgba(0,0,0,.7); }
.player::backdrop { background: rgba(0,0,0,.82); }
.player-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 16px; background: #161616; }
.player-title { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-close { display: inline-flex; padding: 6px; background: none; color: var(--text); border-radius: 6px; }
.player-close:hover { background: #2a2a2a; }
.player-frame { position: relative; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Bouton « Ajouter » */
.add-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: auto;
  padding: 9px 16px 9px 12px; border: 0; border-radius: 999px; cursor: pointer; text-decoration: none;
  background: linear-gradient(135deg, #ff2a36, var(--accent2)); color: #fff; font-size: .92rem; font-weight: 700;
  letter-spacing: .01em; box-shadow: 0 4px 14px rgba(229,9,20,.32); transition: transform .12s, box-shadow .12s, filter .12s; }
.add-btn:hover { filter: brightness(1.08); box-shadow: 0 6px 18px rgba(229,9,20,.45); transform: translateY(-1px); }
.add-btn:active { transform: scale(.97); }
.add-btn .ico { width: 18px; height: 18px; padding: 2px; border-radius: 50%; background: rgba(255,255,255,.22); stroke-width: 2.6; }
.tile-body .add-btn { width: 100%; }
.detail .add-btn { margin-top: 6px; }

.back-link { margin: 0 0 14px; }
.back-link a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .92rem; }
.back-link a:hover { color: #fff; }

/* Logos des plateformes */
.prov-logo { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; flex: none; background: #222; }
.prov-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 0; }
.prov-list .chip-logo:hover { background: var(--panel2); }
.chip-logo { display: inline-flex; align-items: center; padding: 4px; }
.chip-logo .prov-logo { width: 28px; height: 28px; border-radius: 7px; }
.chip-logo.active { box-shadow: 0 0 0 2px var(--accent); border-color: var(--accent); background: var(--panel2); }

/* Gélule Film / Série sur l'affiche */
.poster { position: relative; }
.poster img { display: block; }
.type-pill { position: absolute; right: 8px; bottom: 8px; padding: 2px 9px; border-radius: 999px;
  background: rgba(0,0,0,.68); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.18); color: #fff; font-size: .7rem; font-weight: 700; letter-spacing: .03em; }

/* Logos des plateformes dans le coin inférieur gauche de l'affiche */
.poster-bl { position: absolute; left: 8px; bottom: 8px; right: 60px; display: flex; flex-wrap: wrap-reverse; gap: 4px; }
.poster-bl .chip-logo { padding: 2px; background: rgba(0,0,0,.6); border-color: rgba(255,255,255,.18);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.poster-bl .chip-logo .prov-logo { width: 22px; height: 22px; border-radius: 6px; }

/* Déjà dans la bibliothèque / quota */
.in-lib { display: inline-flex; align-items: center; justify-content: center; gap: 7px; margin-top: auto; padding: 9px 14px;
  border-radius: 999px; background: rgba(46,158,91,.14); border: 1px solid rgba(46,158,91,.45); color: #5fd193;
  font-size: .88rem; font-weight: 700; }
.tile-body .in-lib { width: 100%; }
.detail .in-lib { margin-top: 8px; }
.in-lib .ico, .in-lib-seasons .ico { width: 17px; height: 17px; stroke-width: 2.6; }
.in-lib-seasons { display: flex; align-items: center; gap: 5px; margin: auto 0 0; color: #5fd193; font-size: .8rem; font-weight: 600; }
.in-lib-seasons + .add-btn { margin-top: 0; }
.quota { margin: 10px 0 6px; font-size: .85rem; color: var(--muted); }
.quota strong { color: var(--text); }
.quota-empty { color: var(--warn); }
.add-btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.4); transform: none; box-shadow: none; }

/* Administration : création de compte */
.admin-create { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; align-items: end; max-width: 900px; }
.admin-create label { margin: 0; }
.admin-create .check { align-self: center; }

.last-check { margin: 28px 0 0; text-align: center; font-size: .78rem; color: var(--muted); }

/* Saison en cours de diffusion (page d'ajout) */
.season-airing { display: block; margin: 2px 0 4px 26px; color: var(--muted); font-size: .8rem; line-height: 1.4; }

/* Recherche : personnes et filmographie */
.people { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 18px; }
.person-chip { display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: 40px;
  background: var(--panel); border: 1px solid var(--panel2); color: var(--text); text-decoration: none; }
.person-chip:hover { border-color: var(--accent); }
.person-chip img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; background: #222; }
.person-chip span { display: flex; flex-direction: column; line-height: 1.2; }
.person-chip small { color: var(--muted); font-size: .75rem; }
.person-head { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; }
.person-head img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; flex: none; background: #222; }
.person-head h1 { margin: 0 0 4px; }
.person-head p { margin: 2px 0; }
.trailer-btn[hidden] { display: none; }
/* Sur Jellyfin : tuiles cliquables et fiche avec « Lire sur Jellyfin » */
.tile-link { color: inherit; text-decoration: none; }
a.tile-link:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.tile-link .poster { transition: filter .15s; }
.tile-link:hover .poster { filter: brightness(1.12); }
.detail .play-btn { margin: 14px 0 4px; padding-left: 14px; padding-right: 18px; }
.play-btn .ico { fill: currentColor; stroke-width: 1.4; }
.detail .tile-actions { margin-top: 16px; }
/* Filtres des plateformes : pastilles rondes serrées sur le logo */
.filters { align-items: center; }
.filters .chip-logo { width: 40px; height: 40px; padding: 0; justify-content: center; overflow: hidden;
  border-radius: 50%; border: 0; background: none; opacity: .72;
  transition: opacity .15s, transform .15s, box-shadow .15s; }
.filters .chip-logo .prov-logo { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.filters .chip-logo:hover { opacity: 1; background: none; transform: translateY(-1px); }
.filters .chip-logo.active { opacity: 1; background: none; border: 0;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
@media (max-width: 700px) { .filters .chip-logo { width: 36px; height: 36px; } }
/* Administration : partage du Mac mini */
.share-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 6px; }
.share-stats .stat { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.stat-label { color: var(--muted); font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat-value { font-size: 1.9rem; line-height: 1.1; }
.stat-value.ok { color: var(--ok); } .stat-value.warn { color: var(--warn); } .stat-value.bad { color: var(--err); }
