/*
 * Nysux Playbook : thème provisoire bâti sur les logos Nysux (bleu nuit, bleu vif, jaune, blanc),
 * en attendant la DA. Toutes les couleurs passent par les variables ci-dessous.
 * Polices système uniquement : aucune police chargée depuis un service tiers.
 */
:root {
    --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
    --radius: 10px;
    --space: 1rem;
}

:root,
[data-theme="dark"] {
    --bg: #0b0d2e;
    --surface: #14185a;
    --surface-2: #1c2170;
    --border: #2b3190;
    --text: #f4f2ef;
    --muted: #b9bce0;
    --accent: #2f3bff;
    --accent-text: #ffffff;
    --accent-2: #f5d10a;
    --danger: #ff6b6b;
    --success: #4ade80;
    color-scheme: dark;
}

[data-theme="light"] {
    --bg: #f6f6fb;
    --surface: #ffffff;
    --surface-2: #eceefa;
    --border: #d4d7ee;
    --text: #14163a;
    --muted: #4a4e7a;
    --accent: #1f27c9;
    --accent-text: #ffffff;
    --accent-2: #b89a00;
    --danger: #c0262d;
    --success: #1c7c3b;
    color-scheme: light;
}

@media (prefers-color-scheme: light) {
    [data-theme="system"] {
        --bg: #f6f6fb;
        --surface: #ffffff;
        --surface-2: #eceefa;
        --border: #d4d7ee;
        --text: #14163a;
        --muted: #4a4e7a;
        --accent: #1f27c9;
        --accent-text: #ffffff;
        --accent-2: #b89a00;
        --danger: #c0262d;
        --success: #1c7c3b;
        color-scheme: light;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.5;
}

a { color: var(--accent-2); }
[data-theme="light"] a { color: var(--accent); }
@media (prefers-color-scheme: light) { [data-theme="system"] a { color: var(--accent); } }

h1, h2, h3 { line-height: 1.2; }

/* Mise en page */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: var(--space); }
.sidebar-brand { display: block; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; margin-bottom: var(--space); }
.sidebar ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.sidebar a[data-nav] { display: block; padding: .5rem .75rem; border-radius: var(--radius); color: var(--text); text-decoration: none; }
.sidebar a[data-nav]:hover, .sidebar a[data-nav]:focus-visible { background: var(--surface-2); outline: none; }
.app-main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: var(--space); padding: .75rem var(--space); border-bottom: 1px solid var(--border); }
#content { padding: calc(var(--space) * 1.5); max-width: 1100px; width: 100%; }
.roster-switcher { display: flex; gap: .75rem; }

@media (max-width: 760px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
}

/* Pages d'authentification */
.auth { max-width: 420px; margin: 8vh auto 0; padding: calc(var(--space) * 1.5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.auth form { display: grid; gap: .5rem; }

/* Formulaires */
label { font-weight: 600; }
input[type=text], input[type=email], input[type=password], select, textarea {
    width: 100%; padding: .6rem .75rem; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text); font: inherit;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
    outline: 3px solid var(--accent-2); outline-offset: 2px;
}
button {
    padding: .6rem 1rem; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-text);
    font: inherit; font-weight: 600; cursor: pointer;
}
button.link { background: none; color: inherit; padding: 0; text-decoration: underline; font-weight: 400; }
button.danger { background: var(--danger); }
form > div { display: grid; gap: .35rem; margin-bottom: .5rem; }
ul:has(> li) { padding-left: 1.25rem; }

/* Tableaux */
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
th, td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); }

/* Blocs */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space); margin-bottom: var(--space); }
.alert { padding: .75rem 1rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); }
.alert-error { border-color: var(--danger); }
.alert-success { border-color: var(--success); }
.totp-secret code { font-size: 1.25rem; letter-spacing: .1em; }

/* Pied de page */
.site-footer { padding: var(--space); color: var(--muted); font-size: .9rem; border-top: 1px solid var(--border); }
.footer-controls { display: flex; flex-wrap: wrap; gap: var(--space); align-items: center; }
.theme-toggle, .locale-switcher { display: flex; gap: .5rem; align-items: center; }
.theme-toggle button { background: var(--surface-2); color: var(--text); padding: .3rem .6rem; }
.locale-switcher form { display: inline; }
.sidebar-brand { display: flex; align-items: center; gap: .6rem; }
.brand-logo { border-radius: 8px; }

/* Maps et playbooks */
.muted { color: var(--text-muted, inherit); opacity: .8; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.map-card { display: block; border-radius: 10px; overflow: hidden; background: var(--surface); color: inherit; text-decoration: none; border: 1px solid transparent; }
.map-card:hover, .map-card:focus-visible { border-color: var(--accent); }
.map-card img, .map-card-placeholder { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--accent); }
.map-card h2 { margin: .6rem .8rem .2rem; font-size: 1.1rem; }
.map-card p { margin: 0 .8rem .8rem; font-size: .9rem; }
.map-card-off { opacity: .65; }
.playbook-header { margin-bottom: 1rem; }
.playbook-banner { width: 100%; height: 180px; object-fit: cover; border-radius: 10px; }
.playbook-toc { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.5rem; }
.tier > h2 { border-bottom: 2px solid var(--accent-2, var(--accent)); padding-bottom: .3rem; }
.section { margin-bottom: 1rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.section-head h3 { margin: 0; }
.section-number { display: inline-block; min-width: 2ch; color: var(--accent-2, var(--accent)); }
.section-hidden { opacity: .55; }
.section-content table { border-collapse: collapse; }
.section-content th, .section-content td { border: 1px solid currentColor; padding: .25rem .5rem; }
.section-content img { max-width: 100%; height: auto; }
.badge { display: inline-block; font-size: .8rem; padding: .1rem .5rem; border-radius: 999px; border: 1px solid var(--accent-2, var(--accent)); }
.link-button { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; text-decoration: underline; }
.button-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
