/* GuideTVPlus — feuille de styles principale (site public + administration)
   Identité : média clair, en-tête sombre. Couleurs centralisées dans :root. */

:root {
    --c-ink: #0b1220;
    --c-ink-2: #1c2638;
    --c-text: #1d2433;
    --c-muted: #5b6577;
    --c-line: #e3e7ee;
    --c-bg: #f6f7fa;
    --c-surface: #ffffff;
    --c-accent: #2f5bff;
    --c-accent-dark: #1d3fd1;
    --c-accent-soft: #e8eeff;
    --c-success: #0f7a4a;
    --c-success-soft: #e3f5ec;
    --c-warning: #8a5a00;
    --c-warning-soft: #fff4dc;
    --c-danger: #b42318;
    --c-danger-soft: #fdecea;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(11, 18, 32, .06), 0 4px 16px rgba(11, 18, 32, .05);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --container: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body { margin: 0; font-family: var(--font); font-size: 1.0625rem; line-height: 1.6; color: var(--c-text); background: var(--c-bg); }
img { max-width: 100%; height: auto; }
a { color: var(--c-accent-dark); text-underline-offset: 2px; }
a:hover { color: var(--c-accent); }
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { line-height: 1.25; color: var(--c-ink); margin: 0 0 .6em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.6rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--c-surface); color: var(--c-ink); padding: 10px 14px; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { top: 12px; }
main:focus { outline: none; }

/* ------------------------------------------------------------- En-tête */
.site-header { background: var(--c-ink); color: #fff; position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; padding: 0 8px; height: 30px; border-radius: 7px; background: var(--c-accent); font-weight: 800; font-size: .85rem; letter-spacing: .02em; }
.brand-mark span { color: #ffd166; }
.brand-name { font-size: 1.2rem; font-weight: 400; }
.brand-name strong { font-weight: 800; }
.nav-toggle { display: none; align-items: center; gap: 8px; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: var(--radius-sm); padding: 8px 12px; font: inherit; font-size: .95rem; cursor: pointer; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { display: block; width: 18px; height: 2px; background: currentColor; position: relative; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.main-nav { background: var(--c-ink-2); border-top: 1px solid rgba(255,255,255,.06); }
.main-nav ul { list-style: none; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 2px; }
.main-nav a { display: block; padding: 11px 12px; color: #d7dceb; text-decoration: none; font-size: .93rem; font-weight: 500; border-bottom: 2px solid transparent; }
.main-nav a:hover { color: #fff; }
.main-nav a[aria-current="page"] { color: #fff; border-bottom-color: var(--c-accent); }

@media (max-width: 960px) {
    .nav-toggle { display: inline-flex; }
    .main-nav { display: none; }
    .main-nav.is-open { display: block; }
    .main-nav ul { flex-direction: column; padding: 8px 20px 16px; }
    .main-nav a { padding: 12px 4px; border-bottom: 1px solid rgba(255,255,255,.06); }
    .main-nav a[aria-current="page"] { border-bottom-color: rgba(255,255,255,.06); box-shadow: inset 3px 0 0 var(--c-accent); padding-left: 12px; }
}
/* Sans JavaScript, le menu reste visible */
.no-js .main-nav { display: block; }

/* ------------------------------------------------------------- Accueil */
.hero { background: linear-gradient(160deg, var(--c-ink) 0%, #17264d 100%); color: #e8ecf6; padding: 64px 0 72px; }
.hero h1 { color: #fff; max-width: 18ch; }
.hero h1 span { color: #9fb6ff; }
.hero .lead { color: #c5cde0; max-width: 62ch; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; color: #9fb6ff; margin-bottom: 14px; }
.lead { font-size: 1.15rem; color: var(--c-muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero .btn-ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }

.block { padding: 44px 20px 0; }
.block:last-child { padding-bottom: 56px; }
.section-title { margin-bottom: 20px; }

.status-panel { display: flex; justify-content: space-between; align-items: center; gap: 20px; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 24px 28px; box-shadow: var(--shadow); }
.status-panel p { color: var(--c-muted); margin: 0; max-width: 70ch; }
@media (max-width: 700px) { .status-panel { flex-direction: column; align-items: flex-start; } }

.card-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); transition: border-color .15s, transform .15s, box-shadow .15s; }
.card:hover { border-color: #c4cfff; transform: translateY(-2px); box-shadow: var(--shadow); }
.card-link { display: flex; flex-direction: column; gap: 6px; padding: 22px; color: inherit; text-decoration: none; height: 100%; }
.card-link:hover { color: inherit; }
.card-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--c-accent-soft); color: var(--c-accent-dark); margin-bottom: 6px; }
.card-title { font-weight: 700; font-size: 1.07rem; color: var(--c-ink); }
.card-text { color: var(--c-muted); font-size: .95rem; }

.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.pillar { background: var(--c-surface); border-left: 4px solid var(--c-accent); border-radius: var(--radius-sm); padding: 20px 22px; }
.pillar p { color: var(--c-muted); margin: 0; }

/* ------------------------------------------------------------- Pages */
.breadcrumbs { padding-top: 18px; font-size: .9rem; }
.breadcrumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; color: var(--c-muted); }
.breadcrumbs li + li::before { content: "›"; margin-right: 6px; color: #9aa3b5; }
.page-narrow { max-width: 820px; }
.page-header { padding: 36px 0 12px; }
.page-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 12px; background: var(--c-accent-soft); color: var(--c-accent-dark); margin-bottom: 14px; }
.page-dates { font-size: .9rem; color: var(--c-muted); }
article.container { padding-bottom: 56px; }

.prose { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 28px 32px; margin-bottom: 20px; }
.prose > :last-child { margin-bottom: 0; }
.prose h2 { margin-top: 1.6em; }
.prose h2:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--c-line); padding: 10px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--c-bg); }
.prose blockquote { margin: 1em 0; padding: 4px 18px; border-left: 4px solid var(--c-line); color: var(--c-muted); }
@media (max-width: 600px) { .prose { padding: 20px; } .prose table { display: block; overflow-x: auto; } }
.legal-list { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0 0 1em; }
.legal-list dt { font-weight: 600; color: var(--c-ink); }
.legal-list dd { margin: 0; }
@media (max-width: 600px) { .legal-list { grid-template-columns: 1fr; } .legal-list dd { margin-bottom: 8px; } }

.empty-state { background: var(--c-surface); border: 1px dashed #c6cdda; border-radius: var(--radius); padding: 32px; }
.empty-state p { color: var(--c-muted); }
.empty-label { font-weight: 700; color: var(--c-ink) !important; margin-bottom: .4em; }
.check-list { list-style: none; padding: 0; margin: 0 0 1.4em; }
.check-list li { padding-left: 28px; position: relative; margin-bottom: 8px; }
.check-list li::before { content: ""; position: absolute; left: 4px; top: .5em; width: 12px; height: 7px; border-left: 2px solid var(--c-accent); border-bottom: 2px solid var(--c-accent); transform: rotate(-45deg); }

.error-page { text-align: center; padding: 72px 20px; }
.error-code { font-size: 4rem; font-weight: 800; color: var(--c-accent); margin: 0; line-height: 1; }

/* ------------------------------------------------------------- Données */
.data-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; background: var(--c-line); border: 1px solid var(--c-line); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
.data-meta > div { background: var(--c-surface); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.data-meta-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--c-muted); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge-official { background: var(--c-success-soft); color: var(--c-success); }
.badge-partner { background: var(--c-accent-soft); color: var(--c-accent-dark); }
.badge-estimate { background: var(--c-warning-soft); color: var(--c-warning); }
.badge-unavailable { background: #eef0f4; color: #4a5366; }
.badge-draft { background: #eef0f4; color: #4a5366; }
.badge-review { background: var(--c-warning-soft); color: var(--c-warning); }
.badge-published { background: var(--c-success-soft); color: var(--c-success); }
.badge-archived { background: var(--c-danger-soft); color: var(--c-danger); }

.table-wrap { overflow-x: auto; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.data-table caption { text-align: left; padding: 14px 16px; font-weight: 700; color: var(--c-ink); }
.data-table th, .data-table td { padding: 12px 16px; border-top: 1px solid var(--c-line); text-align: left; vertical-align: middle; }
.data-table thead th { background: var(--c-bg); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted); }
.data-table tbody tr:hover { background: #fafbfd; }
@media (max-width: 700px) {
    .data-table.responsive thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .data-table.responsive tr { display: block; border-top: 1px solid var(--c-line); padding: 8px 0; }
    .data-table.responsive td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 6px 16px; }
    .data-table.responsive td::before { content: attr(data-label); font-weight: 600; color: var(--c-muted); }
}

/* ------------------------------------------------------------- Boutons, alertes, formulaires */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: var(--radius-sm); font: inherit; font-weight: 600; font-size: .98rem; text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.btn-primary { background: var(--c-accent); color: #fff; }
.btn-primary:hover { background: var(--c-accent-dark); color: #fff; }
.btn-ghost { background: transparent; color: var(--c-accent-dark); border-color: #c4cfff; }
.btn-ghost:hover { background: var(--c-accent-soft); }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #8f1c13; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .88rem; }
.btn-link { background: none; border: 0; padding: 0; color: var(--c-accent-dark); font: inherit; cursor: pointer; text-decoration: underline; }

.alert { padding: 14px 18px; border-radius: var(--radius-sm); margin: 18px 0; border: 1px solid transparent; }
.alert-success { background: var(--c-success-soft); color: #0b5a37; border-color: #b9e3cc; }
.alert-error { background: var(--c-danger-soft); color: #8f1c13; border-color: #f5c2bd; }
.alert-info { background: var(--c-accent-soft); color: #1b3196; border-color: #cbd6ff; }
.alert-warning { background: var(--c-warning-soft); color: #6b4600; border-color: #f2dba6; }
.alert ul { margin: 6px 0 0; padding-left: 1.2em; }

.form { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 28px; }
.form-row { margin-bottom: 18px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--c-ink); }
.form input[type="text"], .form input[type="email"], .form input[type="password"], .form input[type="url"], .form input[type="datetime-local"], .form select, .form textarea {
    width: 100%; padding: 11px 13px; font: inherit; font-size: 1rem; color: var(--c-text); background: #fff; border: 1px solid #c9cfda; border-radius: var(--radius-sm);
}
.form textarea { resize: vertical; min-height: 120px; }
.form textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; min-height: 360px; }
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--c-accent); outline: 3px solid rgba(47, 91, 255, .18); outline-offset: 0; }
.form [aria-invalid="true"] { border-color: var(--c-danger); }
.field-error { color: var(--c-danger); font-size: .9rem; margin: 6px 0 0; }
.field-help { color: var(--c-muted); font-size: .88rem; margin: 6px 0 0; }
.form-check { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
.form-check label { font-weight: 400; margin: 0; }
.form-check input { margin-top: 5px; width: 18px; height: 18px; }
.form-check .field-error { grid-column: 2; }
.form-note { font-size: .88rem; color: var(--c-muted); }
.form-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 20px; }
.char-count { float: right; font-weight: 400; font-size: .85rem; color: var(--c-muted); }

/* ------------------------------------------------------------- Pied de page */
.site-footer { background: var(--c-ink); color: #b6bed0; padding: 44px 0 0; font-size: .95rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 28px; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > div:first-child { grid-column: 1 / -1; } }
.footer-brand { color: #fff; font-size: 1.2rem; margin-bottom: 8px; }
.footer-note { max-width: 46ch; }
.footer-title { color: #fff; font-weight: 700; margin-bottom: 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: #d7dceb; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); margin-top: 32px; padding: 18px 20px; font-size: .88rem; }
.footer-bottom p { margin: 0; }

/* ================================================================ Administration */
.admin-body { background: #f1f3f7; }
.admin-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.admin-sidebar { background: var(--c-ink); color: #c9d0e0; padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-sidebar .brand { margin: 0 8px 24px; }
.admin-nav ul { list-style: none; margin: 0; padding: 0; }
.admin-nav-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: #7d879c; margin: 18px 10px 6px; }
.admin-nav a { display: flex; justify-content: space-between; align-items: center; padding: 9px 10px; border-radius: var(--radius-sm); color: #d7dceb; text-decoration: none; font-size: .95rem; }
.admin-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.admin-nav a[aria-current="page"] { background: var(--c-accent); color: #fff; }
.admin-nav .count { background: #ffd166; color: var(--c-ink); font-size: .75rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.admin-main { min-width: 0; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--c-surface); border-bottom: 1px solid var(--c-line); padding: 12px 28px; }
.admin-topbar .user { font-size: .92rem; color: var(--c-muted); }
.admin-topbar .user strong { color: var(--c-ink); }
.admin-topbar form { display: inline; }
.admin-content { padding: 24px 28px 48px; max-width: 1200px; }
.admin-content h1 { font-size: 1.6rem; }
.admin-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-header h1 { margin: 0; }
.panel { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; }
.panel h2 { font-size: 1.1rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 16px 18px; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--c-ink); line-height: 1.1; }
.stat-label { color: var(--c-muted); font-size: .88rem; }
.admin-cols { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .admin-cols { grid-template-columns: 1fr; } }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--c-line); background: var(--c-surface); text-decoration: none; font-size: .88rem; color: var(--c-text); }
.filters a[aria-current="true"] { background: var(--c-ink); color: #fff; border-color: var(--c-ink); }
.pagination { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border: 1px solid var(--c-line); border-radius: var(--radius-sm); background: var(--c-surface); text-decoration: none; font-size: .9rem; }
.pagination span[aria-current] { background: var(--c-ink); color: #fff; }
.inline-form { display: inline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--c-muted); }
.small { font-size: .88rem; }
.message-body { white-space: pre-wrap; background: var(--c-bg); padding: 16px; border-radius: var(--radius-sm); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, var(--c-ink) 0%, #17264d 100%); }
.login-card { width: 100%; max-width: 420px; }
.login-card .brand { margin-bottom: 20px; }
.login-card .form { box-shadow: 0 20px 60px rgba(0,0,0,.25); }
@media (max-width: 860px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; height: auto; }
    .admin-content, .admin-topbar { padding-left: 16px; padding-right: 16px; }
}

/* Utilitaires (pas d'attribut style : la CSP interdit les styles en ligne) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[data-w="sm"] { max-width: 560px; }
[data-w="md"] { max-width: 640px; }
[data-w="lg"] { max-width: 760px; }
[data-w="full"] { width: 100%; }
.stat-value-text { font-size: 1.1rem; padding-top: 8px; }
.brand-light { color: #fff; }
.login-title { font-size: 1.4rem; }
.form h2 { margin-top: 8px; }
.panel + .panel, .table-wrap + .panel { margin-top: 18px; }
fieldset.panel { margin: 8px 0 18px; }
