/* ==========================================================================
   senior-tv — back-office (les enfants / Laurent)
   Charte IDSWORLD : fond sombre #121212, accent or #C7A35B.
   ========================================================================== */

@font-face {
    font-family: 'Atkinson Hyperlegible';
    src: url('/fonts/atkinson-regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Atkinson Hyperlegible';
    src: url('/fonts/atkinson-bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

:root {
    --bg: #121212;
    --card: #1B1B1B;
    --card-2: #232323;
    --border: #333333;
    --accent: #C7A35B;
    --accent-soft: rgba(199, 163, 91, 0.14);
    --ink: #F5F5F5;
    --dim: #A8A8A8;
    --ok: #2E9E63;
    --warn: #D0883A;
    --danger: #C2453D;
    --radius: 12px;
}

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

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Atkinson Hyperlegible', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    min-height: 100vh;
}

a { color: var(--accent); }

/* ---------------- structure ---------------- */

.top {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    padding: 14px 26px;
    background: rgba(18, 18, 18, 0.95);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(6px);
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand .mark {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 9px;
    background: var(--accent-soft);
    border: 1px solid rgba(199, 163, 91, 0.4);
    color: var(--accent);
}
.brand .mark svg { width: 22px; height: 22px; }
.brand b { font-size: 17px; letter-spacing: 0.2px; }
.brand span { display: block; font-size: 12px; color: var(--dim); }

.nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav a {
    padding: 8px 13px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--dim);
    font-size: 14.5px;
    border: 1px solid transparent;
}
.nav a:hover { color: var(--ink); background: var(--card-2); }
.nav a.on { color: var(--accent); background: var(--accent-soft); border-color: rgba(199, 163, 91, 0.35); }

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

h1 { font-size: 26px; margin-bottom: 4px; }
h2 { font-size: 19px; margin: 30px 0 14px; }
.lead { color: var(--dim); font-size: 15px; margin-bottom: 22px; }

/* ---------------- cartes / panneaux ---------------- */

.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
}
.panel h2 { margin-top: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }

/* ---------------- boutons ---------------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--card-2);
    color: var(--ink);
    font-size: 15px;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { border-color: #4a4a4a; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #17130A; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: rgba(194, 69, 61, 0.5); color: #E98A83; }
.btn.danger:hover { background: rgba(194, 69, 61, 0.14); }
.btn.small { padding: 7px 12px; font-size: 13.5px; }
.btn svg { width: 16px; height: 16px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------------- formulaires ---------------- */

label { display: block; font-size: 14px; color: var(--dim); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=number], select, textarea {
    width: 100%;
    padding: 11px 13px;
    border-radius: 9px;
    border: 1px solid #3d3d3d;
    background: #161616;
    color: var(--ink);
    font-size: 15.5px;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(199, 163, 91, 0.18);
}
.field { margin-bottom: 16px; }
.field .help { font-size: 13px; color: #8A8A8A; margin-top: 5px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .row-2 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 10px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.check label { margin: 0; color: var(--ink); font-size: 15px; }

/* ---------------- listes ---------------- */

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border); font-size: 14.5px; vertical-align: middle; }
th { color: var(--dim); font-weight: 500; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
tr:last-child td { border-bottom: 0; }
td.t-right { text-align: right; white-space: nowrap; }

.thumb-mini {
    width: 76px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 5px;
    background: #0d0d0d;
    border: 1px solid var(--border);
}

/* ⚠️ un SVG sans dimensions explicites occupe 300 px de haut et casse les
   tableaux : on borne toujours sa taille ici. */
td svg { width: 20px; height: 20px; }

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 12.5px;
    white-space: nowrap;
    border: 1px solid var(--border);
    color: var(--dim);
}
.badge.ok { color: #7ED3A3; border-color: rgba(46, 158, 99, 0.5); background: rgba(46, 158, 99, 0.12); }
.badge.off { color: #C9A46A; border-color: rgba(208, 136, 58, 0.45); background: rgba(208, 136, 58, 0.12); }

/* ---------------- bandeau d'accès TV (le lien à mettre dans la télé) ---------------- */

.tvlink {
    background: linear-gradient(135deg, rgba(199, 163, 91, 0.16), rgba(199, 163, 91, 0.04));
    border: 1px solid rgba(199, 163, 91, 0.45);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 24px;
}
.tvlink h2 { margin: 0 0 8px; font-size: 17px; }
.tvlink .url {
    display: block;
    margin: 12px 0;
    padding: 13px 15px;
    border-radius: 9px;
    background: #0E0E0E;
    border: 1px dashed rgba(199, 163, 91, 0.5);
    color: var(--accent);
    font-size: 16px;
    word-break: break-all;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
.tvlink .note { font-size: 13.5px; color: var(--dim); }

/* ---------------- alertes ---------------- */

.alert {
    padding: 13px 16px;
    border-radius: 9px;
    margin-bottom: 18px;
    font-size: 15px;
    border: 1px solid;
}
.alert.ok { color: #9BE0B8; background: rgba(46, 158, 99, 0.12); border-color: rgba(46, 158, 99, 0.42); }
.alert.err { color: #F0A9A3; background: rgba(194, 69, 61, 0.12); border-color: rgba(194, 69, 61, 0.45); }

/* ---------------- page de connexion ----------------
   Fond : photo fournie par Laurent (.with-photo) ou dégradé sobre (.no-photo).
   Un voile sombre garantit la lisibilité et la discrétion de la photo. */

body.login-body {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background-color: #0c0e12;
    background-size: cover;
    background-position: center 32%;
    background-repeat: no-repeat;
}

body.login-body.with-photo { background-image: url('/assets/login-bg'); }

.login-veil {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(8, 9, 12, 0.62) 0%, rgba(8, 9, 12, 0.88) 100%);
}

body.login-body.no-photo .login-veil {
    background:
        radial-gradient(70% 55% at 50% 34%, rgba(199, 163, 91, 0.16) 0%, rgba(0, 0, 0, 0) 70%),
        radial-gradient(120% 110% at 50% 0%, #1b2330 0%, #0b0d11 62%);
}

.login-page {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 460px;
    padding: 0;
    min-height: 0;
}

.login-card {
    background: rgba(19, 19, 22, 0.84);
    border: 1px solid rgba(199, 163, 91, 0.34);
    border-radius: 20px;
    padding: 38px 34px 26px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.66);
    backdrop-filter: blur(14px);
    text-align: center;
}

.login-mark {
    width: 62px;
    height: 62px;
    margin: 0 auto 20px;
    display: grid;
    place-items: center;
    border-radius: 17px;
    background: rgba(199, 163, 91, 0.14);
    border: 1px solid rgba(199, 163, 91, 0.42);
    color: var(--accent);
}
.login-mark svg { width: 32px; height: 32px; }

.login-card h1 { font-size: 27px; letter-spacing: -0.3px; margin-bottom: 9px; }

.login-sub {
    color: var(--dim);
    font-size: 14.5px;
    line-height: 1.55;
    margin-bottom: 26px;
}

.login-card .field { text-align: left; }
.login-card .btn { justify-content: center; }

.login-submit {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    margin-top: 6px;
}

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 54px; }

.pw-eye {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--dim);
    cursor: pointer;
}
.pw-eye:hover { color: var(--ink); background: rgba(255, 255, 255, 0.07); }
.pw-eye.on { color: var(--accent); }
.pw-eye svg { width: 19px; height: 19px; }

.login-foot {
    margin-top: 22px;
    font-size: 12.5px;
    color: #6e6e6e;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

/* ---------------- résultats de recherche de films ---------------- */

.film-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    margin-top: 4px;
}

.film-card {
    background: var(--card-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.film-card.added { border-color: rgba(46, 158, 99, 0.5); }

.film-thumb {
    aspect-ratio: 16 / 9;
    background: #0d0d0d;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}
.film-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.film-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; }
.film-body .ft { font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.film-body .fm { font-size: 12.5px; color: var(--dim); }
.film-body form { margin-top: auto; }
/* le libellé doit tenir sur une ligne : sinon il déborde et se fait couper */
.film-body .btn {
    width: 100%;
    justify-content: center;
    white-space: nowrap;
    font-size: 13px;
    padding: 9px 8px;
}

/* ---------------- photos : description + voix ---------------- */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.photo-item {
    background: var(--card-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.photo-shot { position: relative; background: #0d0d0d; }
.photo-shot img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }

.photo-del {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 0;
    background: rgba(0, 0, 0, 0.72);
    color: #F0A9A3;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}
.photo-del:hover { background: rgba(194, 69, 61, 0.9); color: #fff; }

.photo-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 7px; }
.photo-body label { font-size: 12.5px; margin: 0; }
.photo-body textarea { font-size: 14px; min-height: 74px; resize: vertical; }
.photo-badge { font-size: 12.5px; }

/* ---------------- vignettes photos (album) ---------------- */

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo-item { position: relative; border-radius: 9px; overflow: hidden; border: 1px solid var(--border); background: #0d0d0d; }
.photo-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photo-item form { position: absolute; top: 6px; right: 6px; }
.photo-item button {
    width: 30px; height: 30px;
    border-radius: 7px;
    border: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #F0A9A3;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}
.photo-item button:hover { background: rgba(194, 69, 61, 0.85); color: #fff; }

.dropzone {
    border: 2px dashed rgba(199, 163, 91, 0.45);
    border-radius: var(--radius);
    padding: 26px;
    text-align: center;
    background: rgba(199, 163, 91, 0.05);
    margin-bottom: 18px;
}
.dropzone p { color: var(--dim); font-size: 14px; margin-top: 8px; }
.dropzone.hot { border-color: var(--accent); background: rgba(199, 163, 91, 0.13); }

/* ---------------- divers ---------------- */

.hint-box {
    background: #171717;
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 14.5px;
    color: var(--dim);
    margin-bottom: 20px;
}
.hint-box b { color: var(--ink); }
.muted { color: var(--dim); font-size: 14px; }
.empty { padding: 30px; text-align: center; color: var(--dim); border: 1px dashed var(--border); border-radius: var(--radius); }
code { background: #0e0e0e; padding: 2px 6px; border-radius: 5px; font-size: 13.5px; color: var(--accent); }
