/* IAlecole — feuille de style du hub (layout, sidebar, cartes, formulaires…).
 *
 * Sortie de core/templates/core/base.html le 2026-10-06 (carnet #36 : 524
 * lignes de CSS recopiées dans CHAQUE page, jamais mises en cache). Les
 * variables (--lfis-blue…) restent déclarées dans core/_tokens.html, inclus
 * inline par base.html : une seule source pour les tokens, qui sert aussi aux
 * écrans plein écran (Lego, Ariane) sans passer par cette feuille.
 *
 * Cache : base.html ajoute ?v=<empreinte du fichier> (core.context.version_statique),
 * donc toute modification ici est vue au prochain chargement, sans vider le cache.
 * Déploiement : `collectstatic`, comme pour tout fichier statique.
 */
@keyframes ia-spin {
    to { transform: rotate(360deg); }
}
@keyframes ia-fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}
@keyframes ia-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes ia-scale-in {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: none; }
}

.ia-animate-fade-up  { animation: ia-fade-up  var(--dur-slow) var(--ease) both; }
.ia-animate-fade-in  { animation: ia-fade-in  var(--dur-slow) var(--ease) both; }
.ia-animate-scale-in { animation: ia-scale-in var(--dur-slow) var(--ease) both; }
.ia-stagger > * { animation: ia-fade-up var(--dur-slow) var(--ease) both; }

/* Jusqu'à 12 : les hubs de catégorie vont jusqu'à 10 tuiles,
   au-delà de la 6e elles apparaissaient toutes d'un bloc. */
.ia-stagger > *:nth-child(1) { animation-delay:  40ms; }
.ia-stagger > *:nth-child(2) { animation-delay:  90ms; }
.ia-stagger > *:nth-child(3) { animation-delay: 140ms; }
.ia-stagger > *:nth-child(4) { animation-delay: 190ms; }
.ia-stagger > *:nth-child(5) { animation-delay: 240ms; }
.ia-stagger > *:nth-child(6) { animation-delay: 290ms; }
.ia-stagger > *:nth-child(7) { animation-delay: 340ms; }
.ia-stagger > *:nth-child(8) { animation-delay: 390ms; }
.ia-stagger > *:nth-child(9) { animation-delay: 440ms; }
.ia-stagger > *:nth-child(10) { animation-delay: 490ms; }
.ia-stagger > *:nth-child(11) { animation-delay: 540ms; }
.ia-stagger > *:nth-child(12) { animation-delay: 590ms; }
.ia-stagger > *:nth-child(n+13) { animation-delay: 590ms; }

.ia-page-out {
    opacity: 0 !important;
    transform: translateY(6px) !important;
    pointer-events: none;
}
.ia-page-in {
    animation: ia-fade-up var(--dur-slow) var(--ease) both;
}

.ia-spinner {
    display: inline-block;
    width: 13px; height: 13px;
    border: 1.5px solid rgba(255,255,255,0.35);
    border-top-color: rgba(255,255,255,0.9);
    border-radius: 50%;
    animation: ia-spin 0.65s linear infinite;
    vertical-align: -2px;
}

@media (prefers-reduced-motion: reduce) {
    *, .ia-animate-fade-up, .ia-animate-fade-in,
    .ia-animate-scale-in, .ia-page-in {
        animation: none !important;
        transition: none !important;
    }
}

body {
    font-family: var(--font-texte);
    margin: 0;
    background-color: var(--bg-light);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
}

/* Les titres passent au serif : c'est ce qui distingue un outil
   soigné d'un back-office. `opsz` de Fraunces est variable — on la
   laisse suivre la taille, d'où le rendu plus dessiné en gros. */
h1, h2, h3, .titre-display {
    font-family: var(--font-titre);
    font-optical-sizing: auto;
    letter-spacing: -0.01em;
}

/* Sidebar Navigation — bandeau navy LFIS (même palette que le tiroir mobile) */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--lfis-blue-dark);
    color: rgba(255,255,255,.72);
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 16px rgba(0,0,0,0.08);
    z-index: 1000;
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-header h1 {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #fff;
}

.sidebar-header span {
    color: var(--lfis-red);
}

.sidebar-header small {
    color: rgba(255,255,255,.55);
}

.nav-links {
    flex-grow: 1;
    min-height: 0;          /* autorise le rétrécissement sous le contenu */
    overflow-y: auto;       /* le menu défile quand il dépasse la fenêtre */
    padding: 20px 0;
}

.nav-item {
    padding: 12px 25px;
    display: flex;
    align-items: center;
    color: rgba(255,255,255,.72);
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-item:hover {
    background-color: rgba(255,255,255,.07);
    color: #fff;
}

.nav-item.active {
    background-color: rgba(255,255,255,.1);
    color: #fff;
    border-left: 4px solid var(--lfis-red);
    font-weight: 600;
}

details.nav-group > summary {
    list-style: none;
    padding: 14px 25px 3px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: rgba(255,255,255,.38);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}
details.nav-group > summary::-webkit-details-marker { display: none; }
details.nav-group > summary::after {
    content: '›';
    font-size: 1rem;
    opacity: 0.28;
    display: inline-block;
    transition: transform 0.18s;
}
details.nav-group[open] > summary::after { transform: rotate(90deg); }
/* Pastille « il y a du neuf » : posée par le script de fin de page à
   partir de la dernière version en ligne et de ce qui a été lu sur
   CET appareil. ⚠️ `[hidden]` ne masque rien si un display est posé
   par ailleurs — d'où la règle explicite (cf. mémoire du projet). */
.nav-puce {
    display: inline-block; width: 7px; height: 7px; margin-left: 7px;
    border-radius: 50%; background: var(--lfis-red, #e4002b);
    vertical-align: middle;
}
.nav-puce[hidden] { display: none; }

/* ── Bandeau « du neuf sur cet outil » ── */
.nouveaute-bandeau {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin: 0 0 22px; padding: 11px 16px;
    background: var(--blue-wash, #eaeefc);
    border: 1px solid rgba(0,51,160,.18);
    border-radius: var(--radius-s, 10px);
    font-size: 0.86rem; color: var(--ink, #2a2620);
}
.nouveaute-bandeau[hidden] { display: none; }
.nb-txt { flex: 1; min-width: 180px; line-height: 1.45; }
.nb-txt strong { font-weight: 800; }
.nb-voir {
    font-weight: 700; color: var(--lfis-blue, #0033a0);
    text-decoration: none; white-space: nowrap;
}
.nb-voir:hover { text-decoration: underline; }
.nb-fermer {
    background: none; border: none; cursor: pointer; padding: 2px 6px;
    font: inherit; font-size: 1.1rem; line-height: 1;
    color: var(--ink-3, #9a9183);
}
.nb-fermer:hover { color: var(--ink, #2a2620); }
@media print { .nouveaute-bandeau { display: none !important; } }

.nav-sep {
    border: none;
    border-top: 1px solid rgba(255,255,255,.1);
    margin: 6px 20px;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 40px;
    transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
    will-change: opacity, transform;
}

/* Global UI Elements */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid var(--line);
}

.btn-premium {
    background-color: var(--lfis-red);
    color: white;
    padding: 14px 28px;
    border-radius: var(--radius-s);
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease);
    display: inline-block;
    text-align: center;
}

.btn-premium:hover {
    background-color: var(--lfis-red-hover);
    transform: var(--lift);
}

.btn-premium:active {
    transform: scale(.97);
}

.btn-premium:focus-visible {
    outline: 2px solid var(--lfis-blue);
    outline-offset: 2px;
}

/* Les cartes cliquables se soulèvent : le survol doit annoncer
   qu'on peut cliquer, sinon la carte reste un décor. */
a.card, button.card, .card-cliquable {
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
a.card:hover, button.card:hover, .card-cliquable:hover {
    transform: var(--lift);
    box-shadow: var(--shadow-l);
}

/* ── Tablette : rail d'icônes (768–1023 px) ── */
@media (min-width: 768px) and (max-width: 1023px) {
    :root { --sidebar-width: 88px; }
    .sidebar { overflow: hidden; }
    .sidebar-header { padding: 16px 6px; }
    .sidebar-header .brand-suf { display: none; }
    .sidebar-header h1 { font-size: 1rem; letter-spacing: 0; }
    .sidebar-header small { display: none; }
    details.nav-group > summary { display: none; }
    details.nav-group > a.nav-item { display: flex !important; }
    .nav-sep { display: none; }
    .nav-item {
        padding: 10px 4px;
        justify-content: center;
        font-size: 20px;
        gap: 0;
    }
    .nav-lbl { display: none; }
    .nav-sub { display: none !important; }
    .sidebar > div:last-child { display: none; }
}

/* ── Mobile : chrome global ── */
.mob-topbar,
.mob-bottombar,
.mob-overlay,
.mob-drawer { display: none; }

@media (max-width: 767px) {
    .sidebar { display: none !important; }
    .main-content {
        margin-left: 0 !important;
        padding: 72px 16px 74px;
    }

    /* Barre du haut */
    .mob-topbar {
        display: flex;
        position: fixed; top: 0; left: 0; right: 0; z-index: 1100;
        height: 56px;
        background: var(--lfis-blue-dark);
        align-items: center; justify-content: space-between;
        padding: 0 18px;
        box-shadow: 0 2px 14px rgba(0,0,0,.28);
    }
    .mob-brand {
        font: 700 21px/1 'Inter', sans-serif;
        color: #fff; text-decoration: none;
    }
    .mob-brand span { color: var(--lfis-red); }
    .mob-avatar {
        width: 36px; height: 36px; border-radius: 50%;
        background: rgba(255,255,255,.12);
        display: flex; align-items: center; justify-content: center;
        font: 600 14px/1 'Inter', sans-serif; color: #fff;
        text-decoration: none; user-select: none;
    }

    /* Barre du bas */
    .mob-bottombar {
        display: flex;
        position: fixed; bottom: 0; left: 0; right: 0; z-index: 1100;
        height: 58px;
        background: var(--surface-hi);
        border-top: 1px solid var(--line);
    }
    .mob-tab {
        flex: 1; display: flex; flex-direction: column;
        align-items: center; justify-content: center; gap: 3px;
        text-decoration: none; color: var(--ink-3);
        border: none; background: none; cursor: pointer;
        font-family: inherit;
        border-top: 2px solid transparent;
        -webkit-tap-highlight-color: transparent;
    }
    .mob-tab.active { color: var(--lfis-red); border-top-color: var(--lfis-red); }
    .mob-tab-ico { font-size: 21px; line-height: 1; }
    .mob-tab-lbl { font: 700 10px/1 'Inter', sans-serif; }

    /* Overlay */
    .mob-overlay {
        position: fixed; inset: 0; z-index: 1200;
        background: rgba(10,37,64,.5);
    }
    .mob-overlay.open { display: block; animation: ia-fade-in .2s ease; }

    /* Tiroir */
    .mob-drawer {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 1300;
        width: min(280px, 85vw);
        background: var(--lfis-blue-dark);
        overflow-y: auto;
    }
    .mob-drawer.open { display: flex; flex-direction: column; animation: mob-slide-in .26s cubic-bezier(.22,1,.36,1); }
    @keyframes mob-slide-in {
        from { transform: translateX(-100%); }
        to   { transform: translateX(0); }
    }
    .mob-drawer-head {
        padding: 16px 18px 14px;
        border-bottom: 1px solid rgba(255,255,255,.1);
        display: flex; align-items: center; justify-content: space-between;
        flex-shrink: 0;
    }
    .mob-drawer-title { font: 700 18px/1 'Inter', sans-serif; color: #fff; }
    .mob-drawer-title span { color: var(--lfis-red); }
    .mob-drawer-close {
        background: none; border: none; color: rgba(255,255,255,.55);
        font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 4px 8px;
        -webkit-tap-highlight-color: transparent;
    }

    /* Éléments nav clonés dans le tiroir : couleurs héritées de .nav-item
       (sidebar desktop en navy depuis 2026-07) — seul le layout diffère ici. */
    #mob-drawer-nav .nav-item { padding: 12px 20px; }
    #mob-drawer-nav details.nav-group > summary { padding-left: 20px; }
    #mob-drawer-nav .nav-sep { margin: 6px 18px; }

    .mob-drawer-auth {
        padding: 14px 20px; flex-shrink: 0;
        border-top: 1px solid rgba(255,255,255,.1);
        font-size: 0.85rem; color: rgba(255,255,255,.5);
        margin-top: auto;
    }
    .mob-drawer-auth a { color: rgba(255,255,255,.5); text-decoration: none; }
    .mob-drawer-auth button {
        background: none; border: none; color: rgba(255,255,255,.5);
        cursor: pointer; font-family: inherit; font-size: 0.85rem; padding: 0;
    }
}

/* ── Barre de recherche header (accueil uniquement) ── */
@media (max-width: 767px) {
    .mob-search-bar {
        display: none;
        position: fixed; top: 56px; left: 0; right: 0; z-index: 1099;
        background: var(--lfis-blue-dark);
        padding: 6px 14px 10px;
    }
    .mob-search-bar-wrap {
        position: relative; display: flex; align-items: center;
    }
    .mob-search-bar-ico {
        position: absolute; left: 12px;
        color: rgba(255,255,255,.45); font-size: 14px;
        pointer-events: none;
    }
    .mob-search-bar-input {
        width: 100%; background: rgba(255,255,255,.12);
        border: none; border-radius: 20px;
        padding: 8px 16px 8px 34px;
        font: 14px 'Inter', sans-serif; color: #fff;
        outline: none; box-sizing: border-box;
    }
    .mob-search-bar-input::placeholder { color: rgba(255,255,255,.45); }

    /* Activer la search bar uniquement sur l'accueil */
    body.page-home .mob-search-bar { display: flex; }

    /* Compenser la hauteur du header étendu (56px topbar + 46px search) */
    body.page-home .main-content { padding-top: 116px !important; }
}
