/* ===========================================================
   EDUPILOT — Charte graphique
   Navy #00003C · Rouge #D2003C · Outfit + DM Sans
   =========================================================== */
:root {
    --navy:      #00003C;
    --navy-mid:  #000070;
    --navy-soft: #0A0A8A;
    --red:       #D2003C;
    --red-dk:    #A0002E;
    --teal:      #007A72;
    --teal-l:    #00897B;
    --violet:    #5C1B9E;
    --violet-l:  #7B2FBE;
    --amber:     #B45E00;
    --amber-l:   #D97706;
    --green:     #0D6B43;
    --green-l:   #0E9058;
    --white:     #FFFFFF;
    --bg:        #F4F5FB;
    --card:      #FFFFFF;
    --border:    #E3E6F4;
    --t1:        #00003C;
    --t2:        #4A4F7A;
    --t3:        #8890B0;

    /* alias historiques utilisés ailleurs dans les vues */
    --edupilot-navy: var(--navy);
    --edupilot-navy-dark: #000024;
    --edupilot-red: var(--red);
    --edupilot-red-dark: var(--red-dk);
    --edupilot-bg: var(--bg);

    /* Couleurs des sections de la fiche de séance EDUTECH CONGO, alignées sur la charte */
    --fiche-general: var(--navy);
    --fiche-objectifs: var(--red);
    --fiche-deroule: var(--green);
    --fiche-pratique: var(--amber);
    --fiche-ressources: var(--violet);
    --fiche-evaluation: var(--teal);
    --fiche-notes: var(--t2);
}

* , *::before, *::after { box-sizing: border-box; }

body {
    background-color: var(--bg);
    color: var(--t1);
    font-family: 'DM Sans', "Segoe UI", system-ui, -apple-system, sans-serif;
}

h1, h2, h3, h4, h5, h6, .btn, .fw-outfit {
    font-family: 'Outfit', 'DM Sans', sans-serif;
}

.text-muted { color: var(--t3) !important; }

/* ---------- Auth layout ---------- */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-soft) 55%, var(--red-dk) 130%);
}

.auth-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 1rem;
}

.auth-card {
    border: none;
    border-radius: 1rem;
}

.auth-logo {
    width: 100%;
    max-width: 320px;
    height: auto;
}

.brand-mark {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 10px;
    background: #fff;
    padding: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

/* ---------- App shell ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--navy) 0%, #000028 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.25rem 1.25rem 1rem;
}

.sidebar-nav {
    flex: 1;
    padding: .5rem .6rem;
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.sidebar-section-title {
    text-transform: uppercase;
    font-family: 'Outfit', sans-serif;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .1em;
    color: rgba(255,255,255,.45);
    padding: 1rem .65rem .35rem;
}

.app-sidebar .nav-link {
    color: rgba(255,255,255,.85);
    padding: .55rem .65rem;
    display: flex;
    align-items: center;
    gap: .65rem;
    font-size: .9rem;
    border-radius: .55rem;
    border-left: 3px solid transparent;
}

.app-sidebar .nav-link:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

.app-sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(210,0,60,.28), rgba(255,255,255,.06));
    color: #fff;
    border-left-color: var(--red);
    font-weight: 600;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,.1);
    padding: .5rem .6rem 1rem;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ---------- Topbar / bannière ---------- */
.app-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(110deg, var(--navy) 0%, var(--navy-soft) 55%, #12008A 100%);
    color: #fff;
    padding: 0 1.5rem;
    height: 62px;
    position: sticky;
    top: 0;
    z-index: 10;
    overflow: hidden;
}

.app-topbar::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--red), var(--navy-mid) 60%, transparent);
}

.topbar-date {
    font-size: .72rem;
    color: rgba(255,255,255,.6);
    display: flex;
    align-items: center;
    gap: .35rem;
}

.topbar-chip {
    background: rgba(210,0,60,.22);
    border: 1px solid rgba(210,0,60,.4);
    color: rgba(255,255,255,.9);
    font-family: 'Outfit', sans-serif;
    font-size: .72rem;
    font-weight: 600;
    padding: .2rem .65rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: .3rem;
    white-space: nowrap;
}

.app-topbar .btn-light { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); color: #fff; }
.app-topbar .btn-light:hover { background: rgba(255,255,255,.2); color: #fff; }
.app-topbar .text-dark { color: #fff !important; }
.app-topbar .bi-bell { color: #fff; }

.app-content {
    padding: 1.5rem;
    flex: 1;
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--red-dk), var(--red));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-size: .72rem;
    font-weight: 700;
}

/* ---------- Titres de page (bande colorée façon "sh") ---------- */
.app-content h1.h4 {
    position: relative;
    padding-left: 15px;
    font-weight: 700;
}

.app-content h1.h4::before {
    content: '';
    position: absolute;
    left: 0; top: 3px; bottom: 3px;
    width: 4px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--red), var(--navy-soft));
}

/* ---------- KPI cards (tableau de bord) ---------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .75rem;
}
@media (max-width: 991.98px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card {
    border-radius: 13px;
    padding: 18px 18px 14px;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    transition: transform .18s, box-shadow .18s;
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: -25px; right: -25px;
    width: 90px; height: 90px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
}
.kpi-card:hover { transform: translateY(-3px); color: #fff; }

.kc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.kc-icon { width: 36px; height: 36px; border-radius: 9px; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.kc-pill { font-size: .65rem; font-weight: 700; font-family: 'Outfit', sans-serif; background: rgba(255,255,255,.16); padding: 2px 8px; border-radius: 9px; letter-spacing: .02em; }
.kc-val { font-family: 'Outfit', sans-serif; font-size: 1.9rem; font-weight: 700; line-height: 1; margin-bottom: 4px; }
.kc-lbl { font-size: .68rem; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; opacity: .78; }
.kc-bar { height: 3px; border-radius: 2px; background: rgba(255,255,255,.18); margin-top: 12px; overflow: hidden; }
.kc-fill { height: 100%; border-radius: 2px; background: rgba(255,255,255,.55); }

.k-navy  { background: linear-gradient(135deg,#00003C,#000075); box-shadow: 0 4px 16px rgba(0,0,80,.22); }
.k-teal  { background: linear-gradient(135deg,#005A52,#007A72); box-shadow: 0 4px 16px rgba(0,122,114,.22); }
.k-amber { background: linear-gradient(135deg,#7A3E00,#B45E00); box-shadow: 0 4px 16px rgba(180,94,0,.22); }
.k-red   { background: linear-gradient(135deg,#8A0020,#D2003C); box-shadow: 0 4px 16px rgba(210,0,60,.22); }
.k-violet{ background: linear-gradient(135deg,#3D0070,#6B1BB3); box-shadow: 0 4px 16px rgba(107,27,179,.22); }
.k-green { background: linear-gradient(135deg,#084E30,#0D6B43); box-shadow: 0 4px 16px rgba(13,107,67,.22); }

/* ---------- Cartes générales ---------- */
.card {
    border: 1px solid var(--border);
    border-radius: 13px;
    box-shadow: 0 2px 10px rgba(0,0,50,.06);
    transition: box-shadow .2s;
}
.card:hover { box-shadow: 0 5px 22px rgba(0,0,50,.08); }

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: .85rem;
    padding: .85rem 1.1rem;
}

.stat-card { border-radius: 13px; }
.stat-card .stat-value { font-family: 'Outfit', sans-serif; font-size: 1.75rem; font-weight: 700; }
.stat-icon { width: 44px; height: 44px; border-radius: .65rem; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }

/* ---------- Sections colorées façon fiche de séance ---------- */
.fiche-header {
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: .02em;
}

/* ---------- Tables ---------- */
.table thead th {
    font-family: 'Outfit', sans-serif;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--t3);
    background: #F7F8FC;
    border-bottom: 1px solid var(--border);
}
.table td { vertical-align: middle; font-size: .85rem; }
.table-hover tbody tr:hover { background-color: #F7F8FC; }

/* ---------- Badges pilules ---------- */
.bd {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
}
.bd-ok     { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.bd-warn   { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.bd-danger { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.bd-info   { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }
.bd-muted  { background: #ECEEF8; color: var(--t2); border: 1px solid var(--border); }

/* ---------- Boutons ---------- */
.btn { font-family: 'Outfit', sans-serif; font-weight: 600; border-radius: .55rem; }
.btn-primary { background: var(--navy); border-color: var(--navy); }
.btn-primary:hover, .btn-primary:focus { background: var(--navy-soft); border-color: var(--navy-soft); }
.btn-outline-primary { color: var(--navy); border-color: var(--navy); }
.btn-outline-primary:hover { background: var(--navy); border-color: var(--navy); }
.btn-success { background: var(--green-l); border-color: var(--green-l); }
.btn-outline-danger { color: var(--red); border-color: var(--red); }
.btn-outline-danger:hover { background: var(--red); border-color: var(--red); }

/* ---------- Widget messagerie flottant ---------- */
.chat-widget-btn {
    position: fixed; right: 24px; bottom: 24px; z-index: 1055;
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, var(--navy), var(--navy-soft));
    color: #fff; border: none; box-shadow: 0 6px 20px rgba(0,0,60,.35);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; cursor: pointer; transition: transform .15s;
}
.chat-widget-btn:hover { transform: scale(1.06); }
.chat-widget-btn .badge {
    position: absolute; top: -4px; right: -4px; background: var(--red);
    color: #fff; border-radius: 50%; font-size: .68rem; font-weight: 700;
    min-width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
    padding: 0 4px; border: 2px solid #fff;
}
.chat-widget-panel {
    position: fixed; right: 24px; bottom: 92px; z-index: 1055;
    width: 340px; max-width: calc(100vw - 32px); height: 460px; max-height: calc(100vh - 140px);
    background: var(--card); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,60,.25);
    display: flex; flex-direction: column; overflow: hidden;
    font-family: 'DM Sans', sans-serif;
}
.chat-widget-panel[hidden] { display: none; }
.chat-widget-header {
    background: linear-gradient(135deg, var(--navy), var(--navy-soft)); color: #fff;
    padding: .7rem 1rem; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.chat-widget-header .title { font-family: 'Outfit', sans-serif; font-weight: 600; font-size: .95rem; }
.chat-widget-header a, .chat-widget-header button {
    color: #fff; background: none; border: none; opacity: .85; padding: 2px 6px;
}
.chat-widget-header a:hover, .chat-widget-header button:hover { opacity: 1; }
.chat-widget-body { flex: 1; overflow-y: auto; }
.cw-item {
    display: block; width: 100%; text-align: left; background: none; border: none;
    padding: .6rem .9rem; border-bottom: 1px solid var(--border); cursor: pointer;
}
.cw-item:hover { background: var(--bg); }
.cw-item.unread .cw-sujet, .cw-item.unread .cw-exp { font-weight: 700; color: var(--t1); }
.cw-item .cw-exp { font-size: .78rem; color: var(--t2); display: flex; justify-content: space-between; }
.cw-item .cw-sujet { font-size: .84rem; color: var(--t1); margin-top: 1px; }
.cw-item .cw-extrait { font-size: .76rem; color: var(--t3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-empty, .cw-loading { text-align: center; color: var(--t3); font-size: .82rem; padding: 2rem 1rem; }
.cw-detail { display: flex; flex-direction: column; height: 100%; }
.cw-detail-head { padding: .7rem .9rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.cw-detail-head .back { background: none; border: none; color: var(--navy); font-weight: 600; font-size: .82rem; padding: 0 0 .3rem; }
.cw-detail-head .cw-d-sujet { font-family: 'Outfit', sans-serif; font-weight: 600; font-size: .9rem; }
.cw-detail-head .cw-d-meta { font-size: .74rem; color: var(--t3); }
.cw-detail-corps { flex: 1; overflow-y: auto; padding: .8rem .9rem; font-size: .85rem; white-space: pre-wrap; }
.cw-detail-attach { padding: 0 .9rem .5rem; font-size: .8rem; }
.cw-reply { border-top: 1px solid var(--border); padding: .6rem; display: flex; gap: .4rem; flex-shrink: 0; }
.cw-reply textarea { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 8px; padding: .4rem .6rem; font-size: .82rem; height: 38px; }
.cw-reply button { background: var(--navy); color: #fff; border: none; border-radius: 8px; width: 38px; flex-shrink: 0; }
@media (max-width: 420px) {
    .chat-widget-panel { right: 16px; bottom: 84px; width: calc(100vw - 32px); }
    .chat-widget-btn { right: 16px; bottom: 16px; }
}
.btn-link { color: var(--navy-soft); }

/* ---------- Alertes d'école (tableau de bord) ---------- */
.alerte-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.alerte-a_jour { background-color: var(--green-l); }
.alerte-en_retard { background-color: var(--amber-l); }
.alerte-en_difficulte { background-color: var(--red); }

/* ---------- Mini-stats (barres de progression compactes) ---------- */
.ms-row { display: flex; align-items: center; gap: 11px; padding: 8px 0; border-bottom: 1px solid #F0F2FA; }
.ms-row:last-child { border-bottom: none; }
.ms-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ms-lbl { font-size: .78rem; color: var(--t2); flex: 1; }
.ms-bar { width: 72px; height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.ms-fill { height: 100%; border-radius: 3px; }
.ms-val { font-family: 'Outfit', sans-serif; font-size: .85rem; font-weight: 700; color: var(--t1); }

/* ---------- Animations d'apparition ---------- */
.anim { animation-fill-mode: both; animation-duration: .45s; }
.fd { animation-name: fadeDown; }
.fu { animation-name: fadeUp; }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.app-content > .card,
.app-content > .row > div > .card,
.app-content > div.row > div > .card {
    animation: fadeUp .4s both;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        left: -280px;
        z-index: 1050;
        transition: left .2s ease;
    }
    .app-sidebar.show {
        left: 0;
    }
}
