/* ag2mdo */
/* =========================================
   Nukunu Mofiala - Styles principaux
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

body {
    font-family: 'Inter', sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* Navbar : voir la section « Barre de navigation HORIZONTALE » en fin de fichier (ag2mdo) */

/* Hero */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 2rem;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero-image {
    text-align: center;
    padding: 1.5rem 1rem;
    background: #f7fafc;
}
.hero-image img {
    max-width: 200px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.06);
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.btn-primary {
    display: inline-block;
    background: white;
    color: #667eea;
    padding: 0.75rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.3s, box-shadow 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* Stats */
.stats {
    padding: 3rem 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card i {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.stat-card h3 {
    font-size: 2rem;
    color: #333;
}

.stat-card p {
    color: #666;
    font-weight: 500;
}

/* Footer */
.footer {
    background: #2d3748;
    color: white;
    text-align: center;
    padding: 2rem;
}
.footer-visitors-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.fv-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
}
.fv-item i {
    font-size: 1.1rem;
    color: #667eea;
    margin-bottom: .3rem;
}
.fv-nb {
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
}
.fv-lb {
    font-size: .78rem;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    position: relative;
    background: white;
    padding: 3rem;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #667eea;
}

/* ── Bouton « Se connecter » (et vérification 2FA) ───────────────────────── */
@keyframes btnLoginGradientFlow {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes btnLoginShineSweep {
    0%, 55%  { transform: translateX(-260%) skewX(-18deg); }
    90%, 100% { transform: translateX(320%) skewX(-18deg); }
}
.btn-login {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    width: 100%;
    padding: .9rem 1.25rem;
    margin-top: .5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    background-size: 220% 220%;
    animation: btnLoginGradientFlow 6s ease-in-out infinite;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: .02em;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(102, 126, 234, .35);
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.btn-login::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 45%;
    height: 100%;
    background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, .45) 50%, transparent 100%);
    transform: translateX(-260%) skewX(-18deg);
    animation: btnLoginShineSweep 4.5s ease-in-out infinite;
    pointer-events: none;
}
.btn-login i { font-size: 1.05rem; transition: transform .18s ease; }
@media (prefers-reduced-motion: reduce) {
    .btn-login { animation: none; background-position: 50% 50%; }
    .btn-login::after { animation: none; content: none; }
}
.btn-login:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(102, 126, 234, .45);
    filter: brightness(1.06);
}
.btn-login:hover:not(:disabled) i.fa-sign-in-alt { transform: translateX(3px); }
.btn-login:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(102, 126, 234, .35);
    filter: brightness(.97);
}
.btn-login:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, .35), 0 4px 14px rgba(102, 126, 234, .35);
}
.btn-login:disabled {
    opacity: .65;
    cursor: not-allowed;
}

/* Variante secondaire (ex. « Recevoir un code par email ») */
.btn-login.btn-login-secondary {
    background: #fff;
    color: #4a5568;
    border: 2px solid #e2e8f0;
    box-shadow: none;
    animation: none;
}
.btn-login.btn-login-secondary::after { content: none; }
.btn-login.btn-login-secondary:hover:not(:disabled) {
    background: #f7fafc;
    border-color: #cbd5e0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .06);
    filter: none;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.btn-submit {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.3s;
}

.btn-submit:hover {
    opacity: 0.9;
}

.error-message {
    background: #fed7d7;
    color: #c53030;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: center;
}

.success-message {
    background: #c6f6d5;
    color: #22543d;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: center;
}

/* Dashboard */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* ═══ Sidebar ═══ */
.sidebar {
    width: 250px;
    background: #2d3748;
    color: white;
    padding: 2rem 0 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 50;
}

.sidebar-brand {
    padding: 0 1.5rem 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    font-weight: 700;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
    flex: 1;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left: 3px solid #667eea;
}

/* Élément actif : mise en évidence forte (fond accentué) */
.sidebar-menu li a.active {
    background: linear-gradient(90deg, rgba(102,126,234,.35), rgba(102,126,234,.12));
    font-weight: 600;
}
/* Parent dont un enfant est actif */
.sidebar-menu li.menu-parent.active-parent > a {
    background: rgba(102,126,234,.15);
    color: #fff;
    border-left: 3px solid #667eea;
    font-weight: 600;
}

.sidebar-menu li.menu-parent>a{display:flex;align-items:center;gap:.75rem;padding:.75rem 1.5rem;color:rgba(255,255,255,0.7);text-decoration:none;transition:all .3s;cursor:pointer}
.sidebar-menu li.menu-parent>a:hover,.sidebar-menu li.menu-parent>a.active{background:rgba(255,255,255,0.1);color:#fff;border-left:3px solid #667eea}
.sidebar-menu li.menu-parent .sub-toggle{margin-left:auto;transition:transform .3s}
.sidebar-menu li.menu-parent.open .sub-toggle{transform:rotate(90deg)}
.sidebar-menu .sub-menu{list-style:none;padding:0;max-height:0;overflow:hidden;transition:max-height .35s ease}
.sidebar-menu li.menu-parent.open > .sub-menu{max-height:1000px}
.sidebar-menu .sub-menu li a{display:flex;align-items:center;gap:.75rem;padding:.6rem 1.5rem .6rem 2.8rem;color:rgba(255,255,255,0.6);text-decoration:none;font-size:.9rem;transition:all .3s}
.sidebar-menu .sub-menu li a:hover,.sidebar-menu .sub-menu li a.active{background:rgba(255,255,255,0.08);color:#fff}
/* Troisième niveau */
.sidebar-menu .sub-menu .sub-menu li a{padding:.5rem 1.5rem .5rem 3.8rem;font-size:.85rem}
.sidebar-menu .sub-menu .sub-menu li.menu-parent > a{padding:.5rem 1.5rem .5rem 2.8rem;font-size:.85rem}

/* Sidebar footer */
.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: .85rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: #252d3d;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
    color: white;
    flex-shrink: 0;
}
.sidebar-user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar-user-name {
    color: white;
    font-weight: 600;
    font-size: .85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    color: rgba(255,255,255,0.45);
    font-size: .72rem;
}

/* Logo de l'école dans le sidebar */
.sidebar-school-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 6px;
    background: white;
    padding: 2px;
    flex-shrink: 0;
}

/* ── Styles pour l'upload de logo (schools.php) ── */

/* Zone drag & drop */
.logo-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 1.5rem;
    border: 2px dashed #cbd5e0;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #f7fafc;
    text-align: center;
    color: #718096;
    position: relative;
}

.logo-upload-zone:hover,
.logo-upload-zone.dragover {
    border-color: #667eea;
    background: #ebf4ff;
    color: #667eea;
}

.logo-upload-zone i {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.logo-upload-zone small {
    font-size: 0.78rem;
    color: #a0aec0;
}

/* Cacher l'input file réel (on utilise la zone cliquable) */
.logo-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

/* Aperçu du logo (actuel ou nouveau) */
.logo-preview-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.logo-preview {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: white;
    padding: 4px;
}

.logo-preview-label {
    font-size: 0.85rem;
    color: #718096;
}

#newLogoPreview {
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: #f0fff4;
    border: 1px solid #c6f6d5;
    border-radius: 8px;
}

/* Miniature dans la liste des écoles */
.school-logo-thumb {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f7fafc;
    padding: 3px;
    display: block;
}

.school-logo-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #edf2f7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a0aec0;
    font-size: 1.3rem;
}

.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 0 2rem 2rem;
    display: flex;
    flex-direction: column;
}

/* ── Topbar (barre du haut) ─────────────────────────── */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    /* Défile normalement avec la page (non figée) — ag2mdo */
    position: static;
    background: transparent;
    z-index: 10;
}
.topbar-left {
    flex: 1;
}
.topbar-title {
    font-size: 1.4rem;
    color: #2d3748;
    font-weight: 700;
    margin: 0;
}
.topbar-center {
    flex: 1;
    text-align: center;
}
.topbar-school {
    font-size: .95rem;
    font-weight: 600;
    color: #4a5568;
}
.topbar-school i {
    color: #667eea;
    margin-right: .4rem;
}
.topbar-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .4rem .8rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 40px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
    color: white;
    flex-shrink: 0;
}
.user-photo-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.user-photo-initial {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
    color: white;
    flex-shrink: 0;
}
.user-photo-img.large, .user-photo-initial.large {
    width: 80px;
    height: 80px;
    font-size: 1.8rem;
}
.user-photo-img.small, .user-photo-initial.small {
    width: 28px;
    height: 28px;
    font-size: .75rem;
}
.topbar-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.topbar-user-name {
    font-weight: 600;
    font-size: .85rem;
    color: #2d3748;
    white-space: nowrap;
}
.topbar-user-role {
    font-size: .72rem;
    color: #718096;
}
.topbar-logout {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .5rem 1rem;
    background: linear-gradient(135deg, #e53e3e, #c53030);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 600;
    transition: opacity .2s, transform .15s;
    box-shadow: 0 2px 8px rgba(197,48,48,.25);
}
.topbar-logout:hover {
    opacity: .9;
    transform: translateY(-1px);
}

/* Cards */
.card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.data-table th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
}

.data-table tr:hover {
    background: #f7fafc;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ag2mdo : les couleurs par role sont definies plus bas (section badges par role) */

.btn-action {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: opacity 0.3s;
}

.btn-edit { background: #bee3f8; color: #2b6cb0; }
.btn-delete { background: #fed7d7; color: #c53030; }
.btn-view { background: #e2e8f0; color: #4a5568; }

.btn-action:hover { opacity: 0.8; }

/* ── Tri des colonnes ──────────────────────────────────────────────────────── */

/* Lien dans l'en-tête de colonne triable */
.sort-th {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #4a5568;
    text-decoration: none;
    font-weight: 600;
    font-size: inherit;
    white-space: nowrap;
    padding: 0.2rem 0.1rem;
    border-radius: 4px;
    transition: color 0.2s;
}

.sort-th:hover {
    color: #667eea;
}

/* Colonne actuellement triée */
.sort-th-active {
    color: #667eea;
}

/* Icône de tri */
.sort-icon {
    font-size: 0.75rem;
    transition: color 0.2s;
}

.sort-inactive {
    color: #cbd5e0;
    opacity: 0.7;
}

.sort-active {
    color: #667eea;
}

/* Légère surbrillance de la colonne triée */
.data-table th:has(.sort-th-active) {
    background: #ebf4ff;
}

@media (max-width: 640px) {
    /* ag2mdo : plus de regle .navbar ici, la barre haute gere son propre responsive */
    .hero {
        padding: 2.5rem 1rem;
    }
    .hero h1 {
        font-size: 1.5rem;
    }
    .hero p {
        font-size: .95rem;
    }
    .stats .container {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 0 1rem;
    }
    .stat-card {
        padding: 1.25rem;
    }
    .stat-card i {
        font-size: 1.8rem;
    }
    .stat-card h3 {
        font-size: 1.5rem;
    }
    .hero-image img {
        max-width: 140px;
    }
    .footer-visitors-bar {
        gap: .75rem;
    }
    .fv-item {
        min-width: 90px;
        padding: .4rem .6rem;
    }
    .fv-nb {
        font-size: 1rem;
    }
}

/* ══════════════════════════════════════════════════════
   NOUVELLES SECTIONS — Classes, Matières, Bulletins
   ══════════════════════════════════════════════════════ */

/* ── Badges nouveaux rôles ──────────────────────────── */
.badge-toggle-on  { background: #c6f6d5; color: #22543d; }
.badge-toggle-off { background: #fed7d7; color: #c53030; }
.btn-toggle-on    { background: #c6f6d5; color: #22543d; border: none; cursor: pointer; }
.btn-toggle-off   { background: #fed7d7; color: #c53030; border: none; cursor: pointer; }

/* ag2mdo : une couleur DISTINCTE par role (13 roles de l'ENUM users.role)
   Utilise partout via getRoleBadgeClass() ou badge-<role>. */
.badge-super_admin  { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.badge-school_admin { background: #DBEAFE; color: #1E40AF; border: 1px solid #93C5FD; }
.badge-principal    { background: #EDE9FE; color: #5B21B6; border: 1px solid #C4B5FD; }
.badge-deputy       { background: #E0E7FF; color: #3730A3; border: 1px solid #A5B4FC; }
.badge-director     { background: #CFFAFE; color: #155E75; border: 1px solid #67E8F9; }
.badge-censeur      { background: #FCE7F3; color: #9D174D; border: 1px solid #F9A8D4; }
.badge-surveillant  { background: #FFE4E6; color: #9F1239; border: 1px solid #FDA4AF; }
.badge-coordinator  { background: #F3E8FF; color: #6B21A8; border: 1px solid #D8B4FE; }
.badge-teacher      { background: #DCFCE7; color: #166534; border: 1px solid #86EFAC; }
.badge-accountant   { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }
.badge-nurse        { background: #CCFBF1; color: #115E59; border: 1px solid #5EEAD4; }
.badge-student      { background: #E0F2FE; color: #075985; border: 1px solid #7DD3FC; }
.badge-parent       { background: #FFEDD5; color: #9A3412; border: 1px solid #FDBA74; }

/* Couleurs de repli pour les roles personnalises (ag2mdo) */
.badge-role-x1 { background: #F3F4F6; color: #374151; border: 1px solid #D1D5DB; }
.badge-role-x2 { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.badge-role-x3 { background: #FFF7ED; color: #9A3412; border: 1px solid #FED7AA; }
.badge-role-x4 { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }
.badge-role-x5 { background: #FDF4FF; color: #86198F; border: 1px solid #F5D0FE; }
.badge-role-x6 { background: #F7FEE7; color: #3F6212; border: 1px solid #D9F99D; }

/* Anciennes classes generiques conservees pour compatibilite */
.badge-admin     { background: #fed7d7; color: #c53030; }
.badge-super     { background: #c6f6d5; color: #22543d; }
.badge-danger    { background: #FEE2E2; color: #991B1B; }
.badge-primary   { background: #DBEAFE; color: #1E40AF; }
.badge-success   { background: #DCFCE7; color: #166534; }
.badge-warning   { background: #FEF3C7; color: #92400E; }
.badge-info      { background: #CFFAFE; color: #155E75; }
.badge-secondary { background: #E5E7EB; color: #374151; }
.badge-light     { background: #F3F4F6; color: #374151; }

/* Statut actif/inactif */
.status-badge { display:inline-flex; align-items:center; gap:.3rem; padding:.2rem .6rem; border-radius:20px; font-size:.8rem; font-weight:600; }
.status-active   { background:#c6f6d5; color:#22543d; }
.status-inactive { background:#fed7d7; color:#c53030; }
.user-inactive td { opacity:.55; }

/* ── Onglets tab-nav ────────────────────────────────── */
.tab-nav {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: .5rem;
    flex-wrap: wrap;
}
.tab-btn {
    padding: .5rem 1.1rem;
    border-radius: 8px 8px 0 0;
    text-decoration: none;
    color: #718096;
    font-weight: 500;
    font-size: .9rem;
    transition: background .2s, color .2s;
    border: 1px solid transparent;
}
.tab-btn:hover { background: #edf2f7; color: #2d3748; }
.tab-btn.active {
    background: white;
    color: #667eea;
    border-color: #e2e8f0 #e2e8f0 white;
    font-weight: 700;
}

/* ── Accordéon écoles (classes.php) ─────────────────── */
.school-accordion {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    margin-bottom: 1rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}
.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    cursor: pointer;
    background: #f7fafc;
    transition: background .2s;
    user-select: none;
}
.accordion-header:hover { background: #edf2f7; }
.accordion-school-info {
    display: flex;
    align-items: center;
    gap: .9rem;
}
.accordion-logo {
    width: 42px; height: 42px;
    object-fit: contain;
    border-radius: 8px;
    background: white;
    border: 1px solid #e2e8f0;
    padding: 3px;
}
.accordion-logo-placeholder {
    width: 42px; height: 42px;
    border-radius: 8px;
    background: #e2e8f0;
    display: flex; align-items: center; justify-content: center;
    color: #a0aec0; font-size: 1.2rem;
}
.accordion-school-name { font-weight: 700; font-size: 1rem; color: #2d3748; display: block; }
.accordion-count       { font-size: .8rem; color: #718096; }
.accordion-arrow {
    color: #718096;
    transition: transform .3s;
    font-size: .9rem;
}
.school-accordion.open .accordion-arrow { transform: rotate(180deg); }
.accordion-body { display: none; padding: 1.25rem; border-top: 1px solid #e2e8f0; }
.school-accordion.open .accordion-body { display: block; }

/* Grille de cartes de classes */
.classes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.class-card {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    transition: box-shadow .2s, transform .2s;
}
.class-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); transform: translateY(-2px); }
.class-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.class-name { font-weight: 700; font-size: 1rem; color: #2d3748; }
.class-actions { display: flex; gap: .3rem; }
.class-card-body { display: flex; flex-wrap: wrap; gap: .35rem; }
.class-tag {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    background: #edf2f7;
    color: #4a5568;
    padding: .2rem .55rem;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 500;
}
.class-card-footer {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-top: .25rem;
    padding-top: .5rem;
    border-top: 1px solid #e2e8f0;
    font-size: .8rem;
    color: #718096;
    flex-wrap: wrap;
}
.class-card-footer i { margin-right: .2rem; }
.class-link { margin-left: auto; color: #667eea; text-decoration: none; font-size: .8rem; }
.class-link:hover { text-decoration: underline; }

/* Boutons icône ronds (edit/delete sur class-card) */
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    width: 28px; height: 28px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem;
    transition: background .2s;
    padding: 0;
}
.btn-icon-edit   { color: #2b6cb0; } .btn-icon-edit:hover   { background: #bee3f8; }
.btn-icon-delete { color: #c53030; } .btn-icon-delete:hover { background: #fed7d7; }

/* ── Modal (classes.php) ────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active, .modal-overlay.open { display: flex; }
.modal-box {
    background: white;
    border-radius: 14px;
    padding: 2rem;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
    animation: slideUp .25s ease;
}
@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.modal-header h3 { font-size: 1.1rem; color: #2d3748; }
.modal-close {
    background: none; border: none; cursor: pointer;
    color: #a0aec0; font-size: 1.1rem; padding: .2rem;
    border-radius: 6px; transition: background .2s;
}
.modal-close:hover { background: #fed7d7; color: #c53030; }

/* ── Matières : chips et coef ───────────────────────── */
.subjects-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    padding-top: .25rem;
}
.subject-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: #edf2f7;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: .4rem .75rem;
    font-size: .88rem;
    transition: box-shadow .15s;
}
.subject-chip:hover { box-shadow: 0 2px 6px rgba(0,0,0,.1); }
.subject-chip-code {
    background: #667eea;
    color: white;
    border-radius: 4px;
    padding: .1rem .4rem;
    font-size: .75rem;
    font-weight: 700;
    font-family: monospace;
}
.subject-chip-name { font-weight: 500; color: #2d3748; }
.subject-chip-actions { display: flex; gap: .2rem; margin-left: .3rem; }
.subject-chip-actions a,
.subject-chip-actions button {
    background: none; border: none; cursor: pointer;
    color: #a0aec0; font-size: .8rem; padding: .1rem .2rem;
    border-radius: 4px; transition: color .15s;
    text-decoration: none;
}
.subject-chip-actions a:hover     { color: #2b6cb0; }
.subject-chip-actions button:hover { color: #c53030; }

.coef-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 20px;
    padding: .15rem .6rem;
    font-weight: 700;
    font-size: .85rem;
}

/* ── Templates de bulletins ─────────────────────────── */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}
.template-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s;
    position: relative;
}
.template-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.template-card-default { border-color: #667eea; }
.template-default-badge {
    position: absolute;
    top: .6rem; right: .6rem;
    background: linear-gradient(135deg,#667eea,#764ba2);
    color: white;
    font-size: .72rem;
    font-weight: 700;
    padding: .2rem .6rem;
    border-radius: 20px;
}
.template-card-header {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1.1rem 1.25rem;
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
}
.template-card-header i { font-size: 1.8rem; color: #667eea; }
.template-name   { font-weight: 700; color: #2d3748; font-size: .95rem; }
.template-school { font-size: .78rem; color: #718096; }
.template-card-body { padding: 1rem 1.25rem; flex: 1; display: flex; flex-direction: column; gap: .5rem; }
.template-info-row { font-size: .82rem; color: #718096; display: flex; gap: .75rem; flex-wrap: wrap; }
.template-info-row i { color: #667eea; }
.mention-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .25rem; }
.mention-chip {
    border: 1px solid;
    border-radius: 20px;
    padding: .15rem .55rem;
    font-size: .75rem;
    font-weight: 600;
}
.template-card-footer {
    padding: .75rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    background: #fafafa;
}

/* Formulaire template : options toggles */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
}
.toggle-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    font-size: .9rem;
    color: #4a5568;
    padding: .4rem .5rem;
    border-radius: 6px;
    transition: background .15s;
}
.toggle-label:hover { background: #edf2f7; }
.toggle-label input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: #667eea; }
.toggle-label span i { color: #667eea; width: 14px; text-align: center; }

/* Mentions dynamiques */
.mention-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .5rem;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: .4rem .6rem;
}
.mention-row input[type="number"] { border: 1px solid #e2e8f0; border-radius: 6px; padding: .35rem .5rem; }
.mention-row input[type="text"]   { border: 1px solid #e2e8f0; border-radius: 6px; padding: .35rem .5rem; }

/* ── Matrice permissions ────────────────────────────── */
.perm-group { margin-bottom: 2rem; }
.perm-group-title {
    font-size: 1rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.perm-group-title i { color: #667eea; }
.perm-matrix-wrap { overflow-x: auto; }
.perm-matrix { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 700px; }
.perm-matrix th, .perm-matrix td { padding: .5rem .6rem; text-align: center; border: 1px solid #e2e8f0; }
.perm-matrix th { background: #f7fafc; font-size: .82rem; font-weight: 600; color: #4a5568; }
/* Colonne « Page / Module » figée lors du défilement horizontal (ag2mdo) */
.perm-page-col, .perm-page-label {
    text-align: left !important;
    min-width: 150px;
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
    box-shadow: 1px 0 0 #cbd5e0;
}
th.perm-page-col { background: #f7fafc; z-index: 3; }
.perm-page-label i { color: #a0aec0; margin-right: .3rem; }
.perm-action-col { font-size: .72rem; color: #718096; min-width: 58px; }
.perm-role-col   { font-size: .82rem; }
.perm-cell       { background: white; }
.perm-row:hover td { background: #f0f4ff; }
.perm-check { width: 16px; height: 16px; cursor: pointer; accent-color: #667eea; }

/* ── Tableau de saisie des notes (grades.php) ─────────── */
.grades-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
    min-width: 900px;
}
.grades-table th,
.grades-table td {
    border: 1px solid #e2e8f0;
    padding: .35rem .3rem;
    text-align: center;
    vertical-align: middle;
}
.grades-table thead th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
}
.grades-student-col {
    min-width: 160px;
    text-align: left;
    padding-left: .6rem;
}
.grades-group-header {
    background: #edf2f7;
    color: #2d3748;
    font-size: .85rem;
    letter-spacing: .03em;
}
.grades-subject-col {
    background: #f0f4ff;
    color: #2b6cb0;
    font-size: .78rem;
    font-weight: 700;
    min-width: 130px;
}
.grades-moy-classe-row td {
    background: #fffff0;
    font-size: .78rem;
}
.grades-moy-classe-row input {
    width: 52px;
}
.grades-student-name {
    font-weight: 600;
    color: #2d3748;
    white-space: nowrap;
    padding-left: .6rem;
}
.grades-student-row td {
    background: white;
}
.grades-student-row:nth-child(even) td {
    background: #fafafa;
}
.grade-input {
    width: 14ch;
    max-width: 140px;
    min-width: 65px;
    padding: .3rem .45rem;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    text-align: center;
    font-size: .82rem;
    color: #2d3748;
    transition: border-color .2s, box-shadow .2s, width .15s;
}
.grade-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102,126,234,.2);
}
.grade-input::placeholder {
    color: #cbd5e0;
}
.grade-input::-webkit-inner-spin-button,
.grade-input::-webkit-outer-spin-button {
    opacity: 1;
    height: 28px;
    width: 20px;
    cursor: pointer;
    margin: 0 0 0 2px;
}
.appr-select {
    padding: .2rem .15rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: .75rem;
    color: #4a5568;
    background: white;
    max-width: 95px;
    cursor: pointer;
}
.appr-select:focus {
    outline: none;
    border-color: #667eea;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Nukunu Mofiala
   ═══════════════════════════════════════════════════════════ */

img {
    max-width: 100%;
    height: auto;
}

.data-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

.dashboard-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: #4a5568;
    font-weight: 500;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 1.5rem;
    color: rgba(255,255,255,.7);
    text-decoration: none;
    transition: .2s;
    margin-top: auto;
    font-size: .85rem;
}
.sidebar-logout:hover {
    color: #fc8181;
    background: rgba(229,62,62,.15);
}

.detail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.child-selector {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}
.child-tab {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
    color: #4a5568;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    font-weight: 500;
    transition: all .2s;
}
.child-tab:hover,
.child-tab.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* ── Hamburger menu toggle ─────────────────────── */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #4a5568;
    font-size: 1.4rem;
    cursor: pointer;
    padding: .25rem;
    border-radius: 6px;
    transition: background .2s;
    flex-shrink: 0;
}
.menu-toggle:hover { background: #edf2f7; }

/* ── Résultats de recherche filtrés ─────────────── */
.search-highlight { background: #fefcbf; }

/* ── Boutons responsive ─────────────────────────── */
.btn-action, .btn-submit, .btn-primary, .topbar-logout {
    white-space: nowrap;
}
.btn-action { font-size: clamp(.75rem, 2vw, .85rem); }

/* ── Empêcher débordement des iframes/objets ────── */
iframe, object, embed { max-width: 100%; }

/* ═══ Breakpoints ═══ */

@media (max-width: 1100px) {
    .dashboard-grid-2 { gap: 1rem; }
    .classes-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

@media (max-width: 992px) and (min-width: 769px) {
    .sidebar { width: 200px; }
    .main-content { margin-left: 200px; padding: 0 1.25rem 1.5rem; }
    .grades-table { font-size: .75rem; }
    .grade-input { width: 12ch; font-size: .75rem; min-width: 65px; }
}

@media (max-width: 768px) {
    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        width: 260px;
        height: 100vh;
        z-index: 999;
        transition: left .3s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,.15);
    }
    .sidebar.active { left: 0; box-shadow: 4px 0 30px rgba(0,0,0,.3); }
    .sidebar.active::before {
        content:''; position:fixed; top:0; left:0; right:0; bottom:0;
        background:rgba(0,0,0,.4); z-index:-1;
    }
    .sidebar-footer { position: relative; bottom: auto; }

    .main-content { margin-left: 0; padding: 0 1rem 1.5rem; }

    .topbar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: .35rem;
        padding: .6rem 0;
    }
    .topbar-left { flex: 1; min-width: 0; }
    .topbar-center { flex: 0 0 100%; order: 0; text-align: left; font-size: .8rem; }
    .topbar-right { flex: none; width: auto; }
    .topbar-title { font-size: 1.1rem; }
    .topbar-user-info { display: none; }

    .dashboard-grid-2 { grid-template-columns: 1fr; }
    .form-grid-2 { grid-template-columns: 1fr; }
    .detail-layout { grid-template-columns: 1fr; }
    .header-bar { flex-direction: column; align-items: flex-start; gap: .75rem; }
    .options-grid { grid-template-columns: 1fr; }
    .templates-grid { grid-template-columns: 1fr; }
    .classes-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; }

    .card { padding: 1rem; }
    .card-header { flex-direction: column; align-items: flex-start; gap: .5rem; }

    .data-table { font-size: clamp(.7rem, 2vw, .82rem); }
    .data-table th,
    .data-table td { padding: .4rem .35rem; }

    .bulletin-wrapper { max-width: 100%; padding: .5rem; }
    .bulletin-header-left { width: 40%; }
    .bulletin-header-right { display: none; }
    .bulletin-school-info { font-size: .65rem; }
    .bulletin-title { font-size: 1rem; }
    .bulletin-subtitle { font-size: .85rem; }
    .bulletin-table { font-size: .65rem; }
    .bulletin-table th,
    .bulletin-table td { padding: .15rem .15rem; }
    .bl-col-appr { width: 14%; }
    .bl-col-matiere { width: 18%; }
    .students-bulletin-grid { grid-template-columns: 1fr; }
    .child-tab { flex: 1 1 auto; min-width: 0; font-size: .8rem; padding: .4rem .8rem; }

    .grades-table { font-size: .7rem; min-width: 0; }
    .grade-input { width: 11ch; font-size: .68rem; padding: .15rem .25rem; min-width: 60px; }
    .appr-select { max-width: 70px; font-size: .6rem; }
    .grades-student-col { min-width: 90px; font-size: .7rem; }
    .grades-student-name { font-size: .65rem; white-space: normal; }
    .grades-subject-col { min-width: 80px; font-size: .68rem; }

    .modal-box { max-width: 95%; margin: 1rem; padding: 1.25rem; }

    .subjects-chips { gap: .35rem; }
    .subject-chip { padding: .25rem .5rem; font-size: .78rem; }

    .perm-matrix { min-width: 0; font-size: .72rem; }
    .perm-matrix th,
    .perm-matrix td { padding: .3rem .25rem; }
    .perm-page-col { min-width: 100px; }

    .school-accordion .accordion-header { padding: .75rem 1rem; }
    .accordion-body { padding: .75rem; }
}

@media (max-width: 480px) {
    body { font-size: clamp(.8rem, 3vw, .9rem); }

    .sidebar { width: 240px; left: -260px; }

    .topbar-title { font-size: .95rem; }
    .topbar-logout span { display: none; }
    .topbar-user-info { display: none; }
    .topbar { gap: .25rem; padding: .4rem 0; }

    .card { padding: .75rem; border-radius: 8px; }
    .card-title { font-size: .9rem; }

    .stat-card { padding: .75rem; }
    .stat-card i { font-size: 1.5rem; }
    .stat-card h3 { font-size: 1.3rem; }

    .login-box { padding: 1.5rem; margin: 1rem; }
    .modal-box { padding: .85rem; margin: .35rem; }
    .modal-header h3 { font-size: .9rem; }
    .modal-header { margin-bottom: 1rem; }

    .btn-action { padding: .4rem .65rem; font-size: .72rem; }
    .btn-submit { padding: .6rem; font-size: .85rem; }

    .form-group { margin-bottom: .8rem; }
    .form-group input,
    .form-group select,
    .form-group textarea { padding: .55rem; font-size: .85rem; }

    .data-table th,
    .data-table td { padding: .3rem .25rem; }
    .data-table { font-size: .68rem; }

    .grade-input { width: 10ch; font-size: .6rem; padding: .1rem .2rem; min-width: 55px; }
    .appr-select { max-width: 60px; font-size: .55rem; padding: .1rem; }
    .grades-student-col { min-width: 75px; }
    .grades-student-name { font-size: .6rem; }
    .grades-subject-col { min-width: 60px; font-size: .6rem; }
    .grades-table th,
    .grades-table td { padding: .2rem .15rem; }

    .classes-grid { grid-template-columns: 1fr; }
    .class-card { padding: .75rem; }

    .hero { padding: 2rem 1rem; }
    .hero h1 { font-size: 1.3rem; }
    .hero p { font-size: .85rem; }

    .stats { padding: 1.5rem 1rem; }
    .stats .container { grid-template-columns: repeat(2, 1fr); gap: .75rem; }

    .footer { padding: 1.25rem; }
    .footer-visitors-bar { gap: .5rem; }
    .fv-item { min-width: 70px; padding: .3rem .5rem; }
    .fv-nb { font-size: .9rem; }

    .child-tab { font-size: .72rem; padding: .3rem .6rem; }

    .tab-btn { font-size: .78rem; padding: .35rem .7rem; }

    .topbar-school { font-size: .72rem; }
    .topbar-user { padding: .25rem .5rem; }

    .dashboard-grid-2 { gap: .75rem; }

    .school-logo-thumb { width: 36px; height: 36px; }
    .school-logo-placeholder { width: 36px; height: 36px; font-size: 1rem; }

    .logo-preview { width: 60px; height: 60px; }
}

@media (max-width: 360px) {
    .sidebar { width: 220px; left: -240px; }
    .grade-input { width: 9ch; font-size: .55rem; min-width: 48px; }
    .appr-select { max-width: 50px; font-size: .5rem; }
    .grades-student-col { min-width: 60px; }
    .card { padding: .5rem; }
    .btn-action { padding: .3rem .5rem; font-size: .65rem; }
    .topbar-title { font-size: .82rem; }
    .topbar-right { gap: .35rem; }
    .topbar-logout span { display: none; }
    .login-box { padding: 1rem; margin: .5rem; }
    .login-box h1 { font-size: 1rem; }
    .login-box .login-logo { width: 60px; height: 60px; }
}

@media print {
    .sidebar, .topbar, .no-print, .btn-action, .btn-submit,
    .btn-primary, form, .topbar-logout { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
    .data-table { font-size: .75rem; }
    body { font-size: 11pt; }
}

/* ─── Bouton Retour en haut ─── */
#backToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary, #1F4E79);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(0,0,0,.2);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity .3s, visibility .3s, transform .3s;
    z-index: 9999;
}
#backToTop.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
#backToTop:hover {
    background: #163a5c;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,.25);
}

/* ── Bouton « Retour » (page précédente) ─────────────────────────────────── */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .45rem .9rem;
    background: #fff;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s, box-shadow .2s;
    white-space: nowrap;
}
.btn-back i { font-size: .85rem; }
.btn-back:hover {
    background: var(--primary, #1F4E79);
    color: #fff;
    border-color: var(--primary, #1F4E79);
    box-shadow: 0 2px 8px rgba(31, 78, 121, .25);
}

/* Bouton retour dans la topbar (admin) */
.topbar-left { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.topbar-left .topbar-title { min-width: 0; }

/* Bouton retour dans les en-têtes portail */
.header-bar { gap: 1rem; flex-wrap: wrap; }

/* ── Accordéon (sections repliables) ─────────────────────────────────────── */
.acc-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 2.5rem;
}
.acc-header:focus-visible {
    outline: 2px solid var(--primary, #1F4E79);
    outline-offset: 2px;
    border-radius: 6px;
}
.acc-header .acc-chevron {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    transition: transform .25s ease;
    color: #718096;
    pointer-events: none;
}
.acc.collapsed > .acc-header .acc-chevron {
    transform: translateY(-50%) rotate(-90deg);
}
.acc-body {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows .3s ease;
}
.acc.collapsed > .acc-body { grid-template-rows: 0fr; }
.acc-body > * { overflow: hidden; min-height: 0; }

/* Lignes « Niveau » repliables dans les tableaux */
tr.level-toggle { cursor: pointer; user-select: none; }
tr.level-toggle .acc-chevron {
    display: inline-block;
    margin-left: .45rem;
    font-size: .7rem;
    color: #718096;
    transition: transform .2s ease;
}
tr.level-toggle.is-collapsed .acc-chevron { transform: rotate(-90deg); }
tr.level-toggle:hover td { background: #f0f4f8; }

/* ═══════════════════════════════════════════════════════════
   Barre de navigation HORIZONTALE (remplace le menu latéral)
   ag2mdo
   ═══════════════════════════════════════════════════════════ */

/* Le conteneur n'est plus en 2 colonnes : la barre est en haut */
.dashboard.dashboard-top {
    display: block;
    min-height: 100vh;
}
.dashboard.dashboard-top .main-content {
    margin-left: 0;
    padding: 0 2rem 2rem;
}

/* ── Barre principale ─────────────────────────────── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    padding: .5rem 1.5rem;
    background: #2d3748;
    color: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,.18);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-shrink: 0;
    max-width: 260px;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    padding-right: 1rem;
    border-right: 1px solid rgba(255,255,255,.15);
}
.navbar-brand:hover { color: #fff; opacity: .9; }
.navbar-brand > span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.navbar-brand > i { font-size: 1.35rem; color: #90cdf4; }
.navbar-logo {
    height: 34px;
    width: 34px;
    object-fit: contain;
    background: #fff;
    border-radius: 6px;
    padding: 2px;
}

/* ── Bouton hamburger (mobile / tablette) ─────────── */
.navbar-toggle {
    display: none;
    margin-left: auto;
    background: rgba(255,255,255,.12);
    color: #fff;
    border: 0;
    border-radius: 6px;
    padding: .5rem .75rem;
    font-size: 1.1rem;
    cursor: pointer;
}
.navbar-toggle:hover { background: rgba(255,255,255,.22); }

/* ── Bouton langue FR/EN ───────────────────────────── */
.navbar-lang {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .75rem;
    margin-left: .5rem;
    color: rgba(255,255,255,.85);
    font-size: .78rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 20px;
    transition: all .2s;
    white-space: nowrap;
}
.navbar-lang:hover {
    background: rgba(255,255,255,.15);
    color: #fff;
    border-color: rgba(255,255,255,.4);
}
.navbar-lang i { font-size: .85rem; }

/* ── Liste de 1er niveau ──────────────────────────── */
.navbar-nav { flex: 1; min-width: 0; }

.navbar-menu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .15rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar-menu .nav-link {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .55rem .7rem;
    color: rgba(255,255,255,.82);
    font-size: .85rem;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    border-radius: 6px;
    transition: background .2s, color .2s;
}
.navbar-menu .nav-link:hover,
.navbar-menu .nav-link:focus-visible {
    background: rgba(255,255,255,.12);
    color: #fff;
}
.navbar-menu > li > .nav-link.active,
.navbar-menu > li.active-parent > .nav-link {
    background: rgba(102,126,234,.35);
    color: #fff;
    font-weight: 600;
}
.navbar-menu > li.open > .nav-link { background: rgba(255,255,255,.16); color: #fff; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }

.nav-caret { font-size: .65rem; opacity: .7; transition: transform .2s; }
.nav-parent.open > .nav-link > .nav-caret { transform: rotate(180deg); }
.nav-parent-deep.open > .nav-link > .nav-caret { transform: rotate(180deg); }

.nav-badge {
    display: inline-block;
    margin-left: .35rem;
    padding: .05rem .4rem;
    background: #e53e3e;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    border-radius: 999px;
}

/* ── Sous-menus : panneau pleine largeur (style Win11 "All apps") ── */
.nav-parent { position: static; }

.nav-submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    min-width: 0;
    max-height: 0;
    overflow: hidden;
    list-style: none;
    margin: 0;
    padding: 0;
    background: #1e2a3a;
    border-top: 1px solid rgba(255,255,255,.1);
    border-bottom: 1px solid rgba(255,255,255,.1);
    border-radius: 0;
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
    z-index: 1100;
    transition: max-height .35s ease, padding .35s ease, opacity .4s ease;
    opacity: 0;
}
.nav-parent.open > .nav-submenu {
    display: block;
    max-height: 500px;
    padding: .6rem 0;
    opacity: .85;
    overflow-y: auto;
}
/* Items du sous-menu apparaissent un par un (effet cascade) */
.nav-parent.open > .nav-submenu > li {
    animation: subfadeIn .3s ease both;
}
.nav-parent.open > .nav-submenu > li:nth-child(1) { animation-delay: .04s; }
.nav-parent.open > .nav-submenu > li:nth-child(2) { animation-delay: .08s; }
.nav-parent.open > .nav-submenu > li:nth-child(3) { animation-delay: .12s; }
.nav-parent.open > .nav-submenu > li:nth-child(4) { animation-delay: .16s; }
.nav-parent.open > .nav-submenu > li:nth-child(5) { animation-delay: .20s; }
.nav-parent.open > .nav-submenu > li:nth-child(6) { animation-delay: .24s; }
.nav-parent.open > .nav-submenu > li:nth-child(7) { animation-delay: .28s; }
.nav-parent.open > .nav-submenu > li:nth-child(8) { animation-delay: .32s; }

@keyframes subfadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.nav-submenu .nav-link {
    padding: .5rem 1.2rem;
    font-size: .82rem;
    border-radius: 0;
    white-space: normal;
}
.nav-submenu .nav-link.active { background: rgba(102,126,234,.35); color: #fff; }

/* 3e niveau : même panneau, items imbriqués */
.nav-submenu .nav-parent-deep { position: static; }
.nav-submenu .nav-parent-deep > .nav-submenu {
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    position: relative;
    border-top: 0;
    border-bottom: 0;
    box-shadow: none;
    background: transparent;
}

/* Si la barre est trop à droite, pas de changement (plus de flottant) */
.navbar-menu > .nav-parent:last-child > .nav-submenu { right: auto; }

/* ── Tablette : barre plus compacte ───────────────── */
@media (max-width: 1200px) {
    .navbar-menu .nav-link { padding: .5rem .55rem; font-size: .8rem; }
    .navbar-brand { max-width: 190px; font-size: .9rem; }
}

/* ── Mobile / tablette : menu replié ──────────────── */
@media (max-width: 992px) {
    .navbar { flex-wrap: wrap; padding: .5rem 1rem; }
    .navbar-brand { border-right: 0; }
    .navbar-toggle { display: inline-flex; align-items: center; }

    .navbar-nav {
        display: none;
        flex: 0 0 100%;
        max-height: 75vh;
        overflow-y: auto;
        margin-top: .5rem;
        border-top: 1px solid rgba(255,255,255,.12);
    }
    .navbar-nav.open { display: block; }

    .navbar-menu { flex-direction: column; align-items: stretch; gap: 0; }
    .navbar-menu .nav-link { padding: .7rem .5rem; font-size: .9rem; }
    .navbar-menu > li > .nav-link > .nav-caret { margin-left: auto; }

    /* Sous-menus : panneau pleine largeur déjà actif par défaut */
    .nav-submenu .nav-parent-deep > .nav-submenu { margin-left: 0; }
    .navbar-menu > .nav-parent:last-child > .nav-submenu { right: auto; }
    .nav-submenu .nav-link { padding: .6rem .75rem; }
}

@media (max-width: 768px) {
    .dashboard.dashboard-top .main-content { padding: 0 1rem 1.5rem; }
}

/* ── Bloc utilisateur a droite de la barre (portail) ── */
.navbar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-left: auto;
    flex-shrink: 0;
}
.navbar-user-name {
    color: rgba(255,255,255,.85);
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
}
.navbar-logout {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .75rem;
    background: rgba(229,62,62,.85);
    color: #fff;
    font-size: .8rem;
    text-decoration: none;
    border-radius: 6px;
    transition: background .2s;
}
.navbar-logout:hover { background: #c53030; color: #fff; }

@media (max-width: 992px) {
    .navbar-user { order: 2; margin-left: .5rem; }
    .navbar-user-name { display: none; }
    .navbar-nav { order: 3; }
}

/* Impression : la barre disparait */
@media print {
    .navbar { display: none !important; }
}

/* ═══ Validation des formulaires ═══ */
.field-invalid {
    border-color: #E53E3E !important;
    box-shadow: 0 0 0 2px rgba(229,62,62,.15) !important;
}
.field-valid {
    border-color: #38A169 !important;
    box-shadow: 0 0 0 2px rgba(56,161,105,.1) !important;
}
.field-error {
    display: block;
    color: #E53E3E;
    font-size: .75rem;
    font-weight: 500;
    margin-top: .25rem;
    line-height: 1.3;
    animation: fieldErrorIn .2s ease;
}
.field-corrected {
    border-color: #059669 !important;
    box-shadow: 0 0 0 2px rgba(5,150,105,.1) !important;
}
.field-correction-hint {
    color: #059669;
    font-size: .72rem;
    font-style: italic;
    margin-top: .15rem;
    display: block;
}
@keyframes fieldErrorIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.field-success-msg {
    display: block;
    color: #38A169;
    font-size: .75rem;
    margin-top: .25rem;
}
form[data-validate] input,
form[data-validate] select,
form[data-validate] textarea {
    transition: border-color .2s, box-shadow .2s;
}
