:root {
    /* === Couleurs de fond === */
    --bg-color: #05070a;
    --app-radial: radial-gradient(circle at 50% -20%, #1e293b 0%, #05070a 70%);
    --sidebar-bg: rgba(13, 17, 23, 0.95);
    --card-bg: rgba(22, 27, 34, 0.4);
    --panel-bg: #1e293b;
    --glass-border: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(255, 255, 255, 0.05);

    /* === Couleurs d'accentuation === */
    --accent-emerald: #10b981;
    --accent-violet: #8b5cf6;
    --accent-blue: #3b82f6;
    --accent-primary: #10b981;        /* Couleur dynamique — changée par les thèmes */
    --accent-primary-rgb: 16, 185, 129; /* Version RGB pour rgba() */
    --super-admin-accent: #10b981;    /* Couleur dynamique — changée par les thèmes */

    /* === Couleurs de texte === */
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;

    /* === Statuts === */
    --status-success: #238636;
    --status-warning: #d29922;
    --status-danger: #f85149;

    /* === Police === */
    --font-main: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
    background: var(--app-radial);
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 20px 12px 12px 16px;
    position: fixed;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;             /* cache le débord horizontal */
    overflow-y: hidden;             /* le scroll est géré par sidebar-nav */
}

/* Expanded state (Default) */
.sidebar span,
.sidebar .nav-text,
.sidebar .logo-text {
    display: inline-block;
}

/* Collapsed state */
.sidebar.collapsed,
.sidebar-collapsed-init .sidebar {
    width: 80px !important;
    padding: 20px 10px;
}

.sidebar.collapsed span,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .logo-text,
.sidebar-collapsed-init .sidebar span,
.sidebar-collapsed-init .sidebar .nav-text,
.sidebar-collapsed-init .sidebar .logo-text {
    display: none !important;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding-left: 0;
}

.sidebar.collapsed .sidebar-nav a {
    justify-content: center;
    padding: 12px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 14px;
    padding-left: 6px;
    flex-shrink: 0;
}

.menu-toggle {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    transition: background 0.3s;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--super-admin-accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
}

.logo-text {
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* Sidebar Navigation Styles */
.sidebar .sidebar-nav {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    flex: 1;
    margin-top: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;          /* scroll quand les sous-menus dépassent */
    overflow-x: hidden;
    padding-right: 3px;
    padding-bottom: 12px;      /* espace en bas pour ne pas coller au footer */
    min-height: 0;             /* indispensable pour que flex:1 + overflow auto fonctionne */
    -webkit-overflow-scrolling: touch;  /* scroll fluide sur iOS */
}

/* Scrollbar Personnalisée */
.sidebar .sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar .sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.sidebar .sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

.sidebar .sidebar-nav a {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
    padding: 12px 20px !important;
    color: var(--text-secondary) !important;
    text-decoration: none !important;
    border-radius: 14px;
    transition: all 0.3s ease;
    font-weight: 500;
    width: 100%;
    white-space: nowrap;
    border-left: 3px solid transparent;
}

.sidebar .sidebar-nav a i {
    width: 24px;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar .sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: white !important;
    transform: translateX(4px);
}

.sidebar .sidebar-nav a.active {
    background: rgba(99, 102, 241, 0.15) !important;
    color: #6366f1 !important;
    font-weight: 700;
    border-left: 3px solid #6366f1;
}

.sidebar .sidebar-nav a.active i {
    color: #6366f1 !important;
}

.nav-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 15px 0;
}


.sidebar-nav a.active i {
    color: var(--super-admin-accent);
}

.sidebar-nav a.cta-link {
    background: rgba(16, 185, 129, 0.05);
    color: #10b981;
    border: 1px dashed rgba(16, 185, 129, 0.3);
    margin-top: 10px;
    border-left: none;
}

.sidebar-nav a.cta-link:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
}

.sidebar-nav a.cta-link.active {
    background: #10b981;
    color: white;
    border-style: solid;
}

.sidebar-nav a.cta-link.active i {
    color: white;
}

.nav-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 15px 10px;
}

.sidebar.collapsed .nav-divider {
    margin: 15px 0;
}

/* On mobile */
@media (max-width: 768px) {
    .sidebar {
        left: -280px;
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .mobile-nav-trigger {
        display: block !important;
    }
}

.mobile-nav-trigger {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: var(--super-admin-accent);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.4);
}

/* Main Content Adjustment */
.main-content {
    margin-left: 280px;
    width: calc(100% - 280px);
    padding: 40px;
    min-height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed+.main-content {
    margin-left: 80px;
    width: calc(100% - 80px);
}



.logout:hover {
    color: var(--status-danger) !important;
    background: rgba(248, 81, 73, 0.1) !important;
}

.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}



.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-color, #0a1628);
    padding-top: 10px;
    padding-bottom: 10px;
}

.header-search {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    padding: 10px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 400px;
}

.header-search input {
    background: transparent;
    border: none;
    color: white;
    outline: none;
    width: 100%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-badge {
    position: relative;
    font-size: 1.2rem;
    cursor: pointer;
}

.dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--status-danger);
    border-radius: 50%;
    border: 2px solid var(--bg-color);
}

.btn-primary {
    background: var(--accent-primary);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--accent-primary);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr) 300px;
    grid-template-rows: auto auto;
    gap: 24px;
}

.glass {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    transition: transform 0.3s ease;
}

.glass:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.kpi-card {
    display: flex;
    flex-direction: column;
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.kpi-title {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
}

.icon-emerald {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-emerald);
}

.icon-violet {
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-violet);
}

.icon-blue {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.kpi-trend {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 16px;
}

.trend.up {
    color: var(--accent-emerald);
}

.mini-chart-container {
    height: 60px;
    margin-top: auto;
}

/* Main Chart Card */
.main-chart-card {
    grid-column: span 3;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.card-header h3 {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.card-header p {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

#themePanel {
    position: fixed;
    top: 90px;
    right: 30px;
    width: 320px;
    z-index: 2000;
    padding: 24px;
    border-radius: 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    background: var(--panel-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform-origin: top right;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#themePanel.hidden {
    display: block !important;
    opacity: 0;
    transform: scale(0.8) translateY(-20px);
    pointer-events: none;
    visibility: hidden;
}

.theme-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.theme-panel-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.theme-option {
    cursor: pointer;
    text-align: center;
    transition: all 0.3s;
    padding: 10px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
}

.theme-option:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-3px);
}

.theme-option.active {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.theme-swatch {
    width: 100%;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.theme-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.5;
    transition: 0.3s;
}

.close-btn:hover {
    opacity: 1;
}

.ai-badge {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.2));
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chart-container {
    height: 300px;
    width: 100%;
}

/* Sidebar Alerts Card */
.sidebar-card {
    grid-row: span 2;
    display: flex;
    flex-direction: column;
}

.alerts-list {
    margin-top: 20px;
    flex: 1;
}

.alert-item {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--glass-border);
}

.alert-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.high .alert-icon {
    background: rgba(248, 81, 73, 0.1);
    color: var(--status-danger);
}

.medium .alert-icon {
    background: rgba(210, 153, 34, 0.1);
    color: var(--status-warning);
}

.success .alert-icon {
    background: rgba(35, 134, 54, 0.1);
    color: var(--status-success);
}

.alert-content strong {
    font-size: 0.85rem;
    display: block;
    margin-bottom: 2px;
}

.alert-content p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.alert-content .time {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 4px;
    display: block;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--accent-blue);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Class Table Card */
.class-performance-card {
    grid-column: span 3;
}

.table-container {
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 12px 8px;
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--card-bg, rgba(15,23,42,.95));
}

td {
    padding: 16px 8px;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9rem;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.success {
    background: rgba(35, 134, 54, 0.15);
    color: #3fb950;
}

.status-badge.warning {
    background: rgba(210, 153, 34, 0.15);
    color: #d29922;
}

.ai-bar {
    width: 100px;
    height: 6px;
    background: var(--input-bg);
    border-radius: 3px;
    overflow: hidden;
}

.ai-bar .fill {
    height: 100%;
    background: var(--accent-primary);
}

.ai-bar .fill.yellow {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.custom-select {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 8px;
    outline: none;
}

/* ====================================================================
   CONTEXT SELECTORS (WinDev Style)
   ==================================================================== */
.sidebar-context-selectors {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.context-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.context-group label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-primary);
    font-weight: 700;
    opacity: 0.8;
}

.context-group select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 8px 10px;
    color: white;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s;
}

.context-group select:focus {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.sidebar.collapsed .sidebar-context-selectors {
    display: none;
}

/* Divider personnalisé */
.nav-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--glass-border), transparent);
    margin: 10px 15px;
}

/* ====================================================================
   SIDEBAR — Combos contextuels (en haut du nav)
   ==================================================================== */
.sidebar-context-filters {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 4px 10px;
    flex-shrink: 0;             /* ne se compresse pas quand le nav déborde */
}

.sidebar.collapsed .sidebar-context-filters {
    display: none !important;
}

.combo-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.combo-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.sidebar-combo {
    width: 100%;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.sidebar-combo:focus {
    border-color: var(--accent-primary);
}

/* ====================================================================
   SIDEBAR — Bouton Tableau de Bord
   ==================================================================== */
.tdb-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--accent-primary);
    color: white !important;
    padding: 11px 18px;
    border-radius: 12px;
    text-decoration: none !important;
    margin: 0 4px 8px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 4px 14px rgba(var(--accent-primary-rgb), 0.35);
    transition: all 0.25s ease;
}

.tdb-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--accent-primary-rgb), 0.5);
    background: var(--accent-primary) !important;
}

.sidebar.collapsed .tdb-btn {
    justify-content: center;
    padding: 11px;
    margin: 0 4px 14px;
}

.sidebar.collapsed .tdb-btn .nav-text {
    display: none;
}

/* ====================================================================
   SIDEBAR — Lien simple (Finance, Paramètres)
   ==================================================================== */
.simple-nav-link {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
    padding: 12px 20px !important;
    color: var(--text-secondary) !important;
    text-decoration: none !important;
    border-radius: 14px;
    transition: all 0.25s ease;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.simple-nav-link i {
    width: 22px;
    font-size: 1.1rem;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.simple-nav-link:hover {
    background: rgba(255, 255, 255, 0.07) !important;
    color: white !important;
    transform: translateX(4px);
}

.simple-nav-link.active {
    background: rgba(var(--accent-primary-rgb), 0.15) !important;
    color: var(--accent-primary) !important;
    font-weight: 700;
    border-left-color: var(--accent-primary);
}

.sidebar.collapsed .simple-nav-link {
    justify-content: center;
    padding: 14px !important;
}

.sidebar.collapsed .simple-nav-link .nav-text {
    display: none;
}

/* ====================================================================
   SIDEBAR — Bouton dual (deux zones cliquables)
   ├── Zone GAUCHE (icône + texte) → active l'onglet du ruban horizontal
   └── Zone DROITE (flèche ›)      → déploie / replie les sous-menus
   ==================================================================== */

/* Conteneur principal : flex row, pas d'overflow hidden pour
   que le :hover sur chaque zone soit indépendant */
.dual-menu-item {
    display: flex;
    align-items: stretch;        /* ← les deux zones s'étendent sur toute la hauteur */
    border-radius: 12px;
    margin: 2px 4px;
    border: 1px solid transparent;
    transition: border-color 0.2s;
    cursor: default;
    position: relative;
}

/* ── ZONE GAUCHE ── icône + texte ─────────────────────── */
.dual-left {
    display: flex;
    align-items: center;
    gap: 13px;
    flex: 1;
    padding: 12px 14px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 11px 0 0 11px;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    min-width: 0;
    user-select: none;
}

.dual-left i {
    width: 20px;
    font-size: 1.05rem;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.18s;
}

.dual-left:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
}

/* ── ZONE DROITE ── flèche ────────────────────────────── */
.dual-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    flex-shrink: 0;
    cursor: pointer;
    border-left: 1px solid var(--glass-border);
    border-radius: 0 11px 11px 0;
    color: rgba(255, 255, 255, 0.25);
    transition: background 0.18s, color 0.18s, border-color 0.18s;
    user-select: none;
}

.dual-arrow i {
    font-size: 0.62rem;
    transition: transform 0.28s ease, color 0.18s;
}

.dual-arrow:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-left-color: rgba(255, 255, 255, 0.15);
}

/* ── ÉTAT : ruban actif (clic zone gauche) ────────────── */
.dual-menu-item.ribbon-active {
    border-color: rgba(var(--accent-primary-rgb), 0.25);
    background: rgba(var(--accent-primary-rgb), 0.06);
}

.dual-menu-item.ribbon-active .dual-left {
    color: var(--accent-primary);
    font-weight: 600;
}

.dual-menu-item.ribbon-active .dual-left i {
    color: var(--accent-primary);
}

.dual-menu-item.ribbon-active .dual-arrow {
    border-left-color: rgba(var(--accent-primary-rgb), 0.2);
    color: var(--accent-primary);
}

/* ── ÉTAT : sous-menu ouvert (clic zone droite) ───────── */
.dual-menu-item.open {
    border-color: var(--glass-border);
}

.dual-menu-item.open .dual-arrow {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.dual-menu-item.open .dual-arrow i {
    transform: rotate(90deg);
    color: var(--accent-primary);
}

/* ── SOUS-MENU DÉPLOYABLE ─────────────────────────────── */
.dual-submenu {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin: 0 4px;
    border-left: 2px solid transparent;
    margin-left: 30px;
}

.dual-submenu.open {
    max-height: 800px;   /* large pour la transition CSS */
    overflow-y: visible; /* le scroll est géré par le parent sidebar-nav */
    border-left-color: rgba(var(--accent-primary-rgb), 0.3);
    margin-bottom: 4px;
}

.dual-submenu .sub-link {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 8px 14px !important;
    font-size: 0.81rem !important;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 7px;
    transition: background 0.15s, color 0.15s, transform 0.15s;
    border-left: none !important;
    margin: 1px 0;
}

.dual-submenu .sub-link i {
    width: 15px;
    font-size: 0.82rem;
    flex-shrink: 0;
    opacity: 0.65;
    transition: opacity 0.15s;
}

.dual-submenu .sub-link:hover {
    color: var(--text-primary) !important;
    background: rgba(255, 255, 255, 0.07) !important;
    transform: translateX(4px);
}

.dual-submenu .sub-link:hover i {
    opacity: 1;
}

.dual-submenu .sub-link.active {
    color: var(--accent-primary) !important;
    background: rgba(var(--accent-primary-rgb), 0.12) !important;
    font-weight: 600;
}

.dual-submenu .sub-link.active i {
    opacity: 1;
    color: var(--accent-primary);
}

/* ── SIDEBAR RÉDUIT (collapsed) ───────────────────────── */
.sidebar.collapsed .dual-left .nav-text,
.sidebar.collapsed .dual-submenu,
.sidebar.collapsed .dual-arrow {
    display: none !important;
}

.sidebar.collapsed .dual-menu-item {
    justify-content: center;
}

.sidebar.collapsed .dual-left {
    padding: 13px;
    justify-content: center;
    border-radius: 11px;
    flex: none;
}

/* ====================================================================
   SIDEBAR TIROIRS legacy (gardés pour compatibilité)
   ==================================================================== */
.nav-folder {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.folder-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 12px;
    margin: 2px 10px;
}

.folder-header:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.folder-header .arrow {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.3s;
    opacity: 0.5;
}

.nav-folder.open .folder-header {
    background: rgba(255, 255, 255, 0.03);
    color: white;
}

.nav-folder.open .arrow {
    transform: rotate(90deg);
}

.folder-content {
    display: none;
    flex-direction: column;
    padding-left: 20px;
    margin-bottom: 10px;
}

.nav-folder.open .folder-content {
    display: flex;
}

.sub-link {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 10px 20px !important;
    font-size: 0.85rem !important;
    color: var(--text-secondary);
    border-left: 1px solid var(--glass-border);
    margin-left: 20px;
}

.sub-link:hover {
    color: var(--accent-primary) !important;
    border-left-color: var(--accent-primary);
    background: transparent !important;
}

.sub-link.active {
    color: white !important;
    border-left-color: var(--accent-primary);
    font-weight: 600;
}

.sidebar.collapsed .folder-header .arrow,
.sidebar.collapsed .folder-content {
    display: none !important;
}

.sidebar.collapsed .folder-header {
    justify-content: center;
    padding: 16px 0;
}



/* Responsive */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .main-chart-card,
    .class-performance-card {
        grid-column: span 2;
    }

    .sidebar-card {
        grid-column: span 2;
        grid-row: auto;
    }
}

/* =========================================
   LOGIN PAGE STYLES
   ========================================= */

.login-page {
    height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1e293b 0%, #020617 100%);
    position: relative;
    overflow: hidden;
}

/* Background Atmosphere */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.15;
}

.orb-1 {
    width: 300px;
    height: 300px;
    background: var(--accent-primary);
    top: -50px;
    left: -50px;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: var(--accent-violet);
    bottom: -100px;
    right: -100px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    z-index: 1;
    padding: 40px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon-large {
    width: 64px;
    height: 64px;
    background: var(--accent-primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 32px;
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.4);
    margin: 0 auto 20px;
    color: white;
}

.login-header h2 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    color: white;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Form Styles */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    position: relative;
}

.input-group input,
.input-group select {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 14px 16px 14px 45px;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    font-family: var(--font-main);
}

.input-group input:focus,
.input-group select:focus {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

/* Style spécifique pour les combos (Selects) */
select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
}

.input-group select {
    padding-right: 45px;
}

/* Correction du problème de visibilité des options (fond blanc / texte blanc) */
select option {
    background-color: #1e293b;
    color: white;
    padding: 12px;
}

select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.2) !important;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.input-group input:focus+.input-icon {
    color: var(--accent-primary);
    /* Note: This selector won't work because icon is before input in DOM usually 
       or we need to change DOM order. But let's keep it simple for now. 
       Actually in my DOM input is after icon. So I can't use + selector easily unless I use :focus-within on parent 
       or change order. Let's trust opacity for now. */
}

/* Fix for icon color on focus */
.input-group:focus-within .input-icon {
    color: var(--accent-primary);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    cursor: pointer;
}

.forgot-password {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s;
}

.forgot-password:hover {
    color: #60a5fa;
    text-decoration: underline;
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 1rem;
    margin-top: 10px;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 30px 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

.divider span {
    padding: 0 15px;
    opacity: 0.6;
}

/* QR Button */
.btn-qr-login {
    width: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-qr-login:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.qr-icon-wrapper {
    width: 48px;
    height: 48px;
    background: rgba(16, 185, 129, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--accent-primary);
}

.qr-text {
    text-align: left;
    display: flex;
    flex-direction: column;
}

.qr-title {
    color: white;
    font-weight: 600;
    font-size: 1rem;
    display: block;
}

.qr-subtitle {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 2px;
}

.login-footer {
    text-align: center;
    margin-top: 32px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.2);
}


/* =========================================
   PUBLIC PORTAL STYLES (index_public.html)
   ========================================= */

body.public-portal {
    background: radial-gradient(circle at top center, #1e293b 0%, #020617 80%);
    overflow-x: hidden;
    overflow-y: auto;
    /* Allow scrolling */
    height: auto;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
}

.glass-nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(13, 17, 23, 0.7);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    color: white;
}

.btn-primary-small {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary-small:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Hero Section */
.hero-section {
    padding: 160px 24px 80px;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 60px;
}

.hero-content {
    max-width: 600px;
}

.hero-badge {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 24px;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.hero-section h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 24px;
    font-weight: 700;
}

.text-gradient {
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-section p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 40px;
}

/* Search Bar */
.search-bar-container {
    display: flex;
    padding: 8px;
    border-radius: 16px;
    gap: 10px;
    align-items: center;
}

.search-input {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
}

.search-input i {
    color: var(--text-secondary);
}

.search-input input,
.search-input select {
    background: transparent;
    border: none;
    color: white;
    width: 100%;
    outline: none;
    font-size: 1rem;
    padding: 12px 0;
}

.search-input select option {
    background: var(--bg-color);
}

.search-divider {
    width: 1px;
    height: 30px;
    background: var(--glass-border);
}

.btn-search {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s;
}

.btn-search:hover {
    transform: translateY(-2px);
}

.geolocation-hint a {
    color: var(--accent-blue);
    font-size: 0.85rem;
    margin-top: 12px;
    display: inline-block;
    text-decoration: none;
}

/* Hero Visuals */
.hero-visuals {
    position: relative;
    width: 400px;
    height: 400px;
    display: none;
    /* Hidden on small screens */
}

@media (min-width: 1024px) {
    .hero-visuals {
        display: block;
    }
}

.floating-card {
    position: absolute;
    width: 260px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: float 6s ease-in-out infinite;
    z-index: 2;
}

.card-1 {
    top: 50px;
    right: 0;
    animation-delay: 0s;
}

.card-2 {
    bottom: 50px;
    left: 0;
    animation-delay: 3s;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-20px);
    }

    100% {
        transform: translateY(0px);
    }
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 215, 0, 0.15);
    color: #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.card-icon.blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.card-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-text strong {
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.card-text span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.card-stat {
    font-weight: 700;
    color: var(--accent-emerald);
}

/* Ranking Section */
.ranking-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.gold-crown {
    color: #ffd700;
}

.ranking-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.school-card {
    position: relative;
    padding: 30px;
    transition: transform 0.3s;
}

.school-card:hover {
    transform: translateY(-10px);
    border-color: rgba(255, 255, 255, 0.2);
}

.rank-badge {
    position: absolute;
    top: -15px;
    left: 30px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.rank-1 {
    background: linear-gradient(135deg, #ffd700, #f59e0b);
}

.rank-2 {
    background: linear-gradient(135deg, #c0c0c0, #9ca3af);
}

.rank-3 {
    background: linear-gradient(135deg, #cd7f32, #a0522d);
}

.school-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    margin-top: 10px;
}

.school-header img {
    width: 56px;
    height: 56px;
    border-radius: 12px;
}

.school-header h3 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.location {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.school-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
}

.stat {
    text-align: center;
}

.stat-val {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.school-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.tag {
    font-size: 0.75rem;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-outline {
    width: 100%;
    background: transparent;
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-outline:hover {
    background: var(--accent-primary);
    color: white;
}

/* Map Teaser */
.map-section {
    max-width: 1200px;
    margin: 0 auto 80px;
    display: flex;
    overflow: hidden;
    padding: 0;
}

.map-content {
    flex: 1;
    padding: 60px;
}

.map-visual {
    flex: 1;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.1);
    font-size: 5rem;
}

.public-footer {
    text-align: center;
    padding: 40px;
    border-top: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ====================================================================
   PAGE ANNÉE SCOLAIRE (Styles WinDev)
   ==================================================================== */
.upload-circle-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.photo-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.3s;
    cursor: pointer;
}

.photo-circle:hover {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    border: 1px solid var(--glass-border);
}

/* Formulaire en deux colonnes compactes */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 25px;
}

.form-grid-2 .input-group label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-grid-2 .input-group input {
    padding: 10px 12px;
    font-size: 0.9rem;
}

#btnValider {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.selected-row {
    background: rgba(16, 185, 129, 0.15) !important;
    border-left: 4px solid var(--accent-primary) !important;
}

.selected-row td {
    color: white !important;
}

/* ====================================================================
   MODALS (Popups)
   ==================================================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    padding: 30px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 15px;
}

.modal-header h3 {
    font-size: 1.4rem;
    color: white;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    transition: color 0.3s;
}

.close-btn:hover {
    color: var(--status-danger);
}

.modal-footer {
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

/* === STYLES FILTRES SIDEBAR (Style WinDev) === */
.sidebar-filters {
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    margin: 10px 15px;
}

.filter-group {
    margin-bottom: 12px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    color: #10b981;
    /* Vert WinDev pour tous les labels */
}

.filter-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Outfit', sans-serif;
}

.filter-select:focus {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.1);
}

.filter-select option {
    background: #1a1c23;
    color: white;
}

/* === NAVIGATION GROUPES (Drop-down Sidebar) === */
.nav-group {
    margin-bottom: 5px;
}

.nav-group-header {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    border-radius: 12px;
    margin: 0 10px;
}

.nav-group-header:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-group-header i:first-child {
    width: 20px;
    margin-right: 15px;
}

.arrow-mini {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    opacity: 0.5;
}

.nav-group.active .nav-group-header {
    color: var(--accent-primary);
    background: rgba(var(--accent-primary-rgb), 0.1);
}

.nav-group.active .arrow-mini {
    transform: rotate(180deg);
}

.nav-group-content {
    display: none;
    padding-left: 45px;
    margin-top: 5px;
}

.nav-group.active .nav-group-content {
    display: block;
}

.nav-group-content a {
    padding: 10px 15px !important;
    font-size: 0.85rem !important;
    margin: 2px 0 !important;
}

/* Masquer les filtres quand le sidebar est replié */
.sidebar.collapsed .sidebar-filters,
.sidebar.collapsed .arrow-mini,
.sidebar.collapsed .nav-group-content {
    display: none !important;
}

/* ====================================================================
   RUBAN WINDEV COMPLET
   ==================================================================== */

.windev-ribbon {
    background: #c3dae9;
    /* Bleu ciel WinDev */
    border-bottom: 1px solid #7a96a9;
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

.ribbon-tabs {
    display: flex;
    padding: 2px 10px 0;
    gap: 2px;
}

.ribbon-tab {
    padding: 6px 15px;
    font-size: 0.85rem;
    color: #000;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
}

.ribbon-tab.active {
    background: #f0f2f5;
    border: 1px solid #7a96a9;
    border-bottom: 2px solid #f0f2f5;
    margin-bottom: -1px;
    font-weight: 600;
}

.ribbon-content {
    background: #f0f2f5;
    display: flex;
    height: 95px;
    border-top: 1px solid #7a96a9;
    padding: 0 5px;
    transition: height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}

/* ═══ MODE RIBBON DYNAMIQUE ═══ */
.windev-ribbon.ribbon-dynamic .ribbon-content {
    height: 0;
    padding: 0 5px;
    opacity: 0;
    border-top: none;
    overflow: hidden;
    transition: height .2s ease, opacity .2s ease;
}
.windev-ribbon.ribbon-dynamic .ribbon-content.ribbon-open {
    height: 95px;
    opacity: 1;
    padding: 0 5px;
    border-top: 1px solid #7a96a9;
    overflow: visible;
}

/* Bouton toggle ribbon fixe/dynamique */
.ribbon-toggle-btn {
    position: absolute;
    right: 8px;
    top: 3px;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Segoe UI', sans-serif;
}
.ribbon-toggle-btn:hover { color: #1e293b; background: rgba(0,0,0,.06); }
.windev-ribbon { position: relative; }

.ribbon-group {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #cbd5e1;
    padding: 5px 10px;
    min-width: 80px;
}

.group-buttons,
.group-buttons-col,
.group-buttons-mixed {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-buttons-col {
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.group-buttons-mixed {
    display: flex;
    align-items: center;
    gap: 12px;
}

.group-label {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    padding: 3px 0;
    background: #cbd5e1;
    margin: 0 -10px -5px;
    border-top: 1px solid #94a3b8;
}

/* Bouton Large avec Caractère Géant */
.large-char {
    font-size: 3.5rem;
    font-family: 'Times New Roman', serif;
    color: #64748b;
    line-height: 0.8;
    margin-bottom: 5px;
}

/* Boutons Large (Icon + Text) */
.ribbon-btn-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    padding: 5px;
    cursor: pointer;
    min-width: 80px;
}

.ribbon-btn-large i {
    font-size: 1.8rem;
    color: #2563eb;
    margin-bottom: 5px;
}

.ribbon-btn-large span {
    font-size: 0.75rem;
    color: #1e293b;
    text-align: center;
    line-height: 1;
}

/* Version Icon with Date */
.btn-icon {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.btn-date {
    font-size: 0.65rem;
    font-weight: 700;
    position: absolute;
    top: 50%;
    transform: translateY(-20%);
    color: #000;
}

/* Boutons Stacked (Icon + Text side by side) */
.ribbon-btn-stacked {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid transparent;
    padding: 3px 8px;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.ribbon-btn-stacked i {
    font-size: 1.2rem;
    color: #2563eb;
    width: 20px;
}

.ribbon-btn-stacked span {
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Group Matières Row/Col */
.group-row {
    display: flex;
    gap: 10px;
    height: 100%;
}

.group-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.ribbon-btn-mini {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: 1px solid transparent;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
}

.ribbon-btn-mini i {
    background: white;
    border: 1px solid #7a96a9;
    padding: 2px;
    font-size: 0.6rem;
    width: 15px;
    height: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ribbon-btn-large-icon {
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ribbon-btn-large-icon i {
    font-size: 2.5rem;
    color: #64748b;
}

/* Bannière de contact */
.windev-banner {
    background: #000080;
    color: white;
    padding: 8px 20px;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
}

/* Zone de contenu principal sous le ruban+bannière */
.page-content-area {
    padding: 24px 30px;
    background: var(--bg-color);
    min-height: calc(100vh - 165px);
}

/* TROMBINOSCOPE VIEWPORT */
.photos-viewport {
    background: var(--bg-color);
    padding: 20px;
    min-height: calc(100vh - 160px);
}

.photo-grid-premium {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

.photo-card-windev {
    background: white;
    border: 1px solid #7a96a9;
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.2s;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
}

.photo-card-windev:hover {
    transform: scale(1.02);
}

.photo-card-windev img {
    flex: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-card-windev .student-label {
    background: #d9f99d;
    /* Couleur herbe du screenshot */
    color: #000;
    padding: 8px 5px;
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    border-top: 1px solid #7a96a9;
}

.ribbon-tab,
.ribbon-btn-large,
.ribbon-btn-stacked,
.ribbon-btn-mini,
.ribbon-btn-large-icon {
    cursor: pointer !important;
}

.ribbon-tab:hover {
    background: #cbd5e1;
}

.ribbon-btn-large:hover,
.ribbon-btn-stacked:hover,
.ribbon-btn-mini:hover,
.ribbon-btn-large-icon:hover {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

/* Onglets du Sidebar liés au Ruban */
.ribbon-sidebar-tab {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    margin: 2px 0;
}

.ribbon-sidebar-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.ribbon-sidebar-tab.active {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    font-weight: 600;
}

.photo-card-windev.selected {
    border: 3px solid #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}
/* ====================================================================
   COMPOSANT PHOTO CAPTURE — photo-capture.js
   ==================================================================== */

.photo-capture-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 130px;
    flex-shrink: 0;
}

/* Zone aperçu / caméra */
.photo-capture-area {
    position: relative;
    width: 130px;
    height: 160px;
    background: rgba(0, 74, 124, 0.15);
    border: 2px dashed #62b1d0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
}

.photo-capture-area:hover {
    border-color: var(--accent-primary);
    background: rgba(var(--accent-primary-rgb), 0.08);
}

/* Placeholder */
.pc-placeholder-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #62b1d0;
    font-size: 0.75rem;
    text-align: center;
    padding: 10px;
    pointer-events: none;
}

/* Image aperçu */
.pc-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

/* Flux vidéo */
.pc-video-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

/* Overlay guide cadrage */
.pc-camera-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: none;
    z-index: 10;
}

.pc-guide-frame {
    width: 60%;
    height: 70%;
    border: 2px dashed rgba(255,255,255,0.8);
    border-radius: 50% 50% 40% 40%;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.45);
}

.pc-guide-text {
    position: absolute;
    bottom: 8%;
    width: 100%;
    text-align: center;
    color: white;
    font-size: 0.72rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Bouton capture (shutter) */
.pc-snap-btn {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    border: 3px solid white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 12px rgba(0,0,0,0.35);
    z-index: 20;
    transition: transform 0.15s;
}

.pc-snap-btn:active { transform: translateX(-50%) scale(0.9); }

/* Boutons d'action */
.pc-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pc-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    width: 100%;
    justify-content: center;
}

.pc-btn i { font-size: 0.85rem; }

.pc-btn-camera:hover {
    background: rgba(16, 185, 129, 0.12);
    border-color: #10b981;
    color: #10b981;
}

.pc-btn-upload:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: #3b82f6;
    color: #3b82f6;
}

.pc-btn-reset {
    display: none;
}

.pc-btn-reset:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: #ef4444;
    color: #ef4444;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — DÉTECTION AUTOMATIQUE MOBILE/TABLETTE
   Appliqué à TOUTES les pages via style.css
═══════════════════════════════════════════════════════ */

/* ── TABLETTE (769px - 1024px) ── */
@media (max-width: 1024px) {
    .main-content {
        padding: 20px !important;
    }
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .dashboard-grid .sidebar-card {
        grid-column: span 2;
    }
    .ribbon-content {
        height: auto !important;
        min-height: 75px;
    }
    .ribbon-group {
        min-width: 60px;
        padding: 3px 6px;
    }
    .ribbon-btn-large span,
    .ribbon-btn-stacked span {
        font-size: 0.6rem;
    }
    .config-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ── MOBILE (≤768px) ── */
@media (max-width: 768px) {
    /* --- Layout principal --- */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 12px !important;
        min-height: 100vh;
    }
    
    /* --- Dashboard grid → 1 colonne --- */
    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .dashboard-grid .main-chart-card,
    .dashboard-grid .class-performance-card,
    .dashboard-grid .sidebar-card {
        grid-column: span 1 !important;
    }
    
    /* --- Cards glass --- */
    .glass {
        padding: 16px !important;
        border-radius: 14px !important;
    }
    
    /* --- Stat cards / KPI → 2 colonnes --- */
    .kpi-card, .stat-card {
        padding: 14px !important;
    }
    
    /* --- Ribbon (barre d'outils) → scrollable --- */
    .windev-ribbon {
        position: sticky;
        top: 0;
        z-index: 100;
    }
    .ribbon-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 2px 5px 0;
        gap: 0;
    }
    .ribbon-tab {
        padding: 5px 10px;
        font-size: 0.75rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .ribbon-content {
        height: auto !important;
        min-height: 60px;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        padding: 2px !important;
    }
    .ribbon-content.ribbon-open {
        height: auto !important;
        min-height: 60px;
    }
    .ribbon-group {
        min-width: 50px;
        padding: 2px 5px;
    }
    .ribbon-btn-large {
        width: 50px;
        height: 50px;
        padding: 4px;
    }
    .ribbon-btn-large i {
        font-size: 1rem;
    }
    .ribbon-btn-large span {
        font-size: 0.55rem;
    }
    .ribbon-btn-stacked {
        padding: 3px 5px;
    }
    .ribbon-btn-stacked i {
        font-size: 0.85rem;
    }
    .ribbon-btn-stacked span {
        font-size: 0.55rem;
    }
    .group-label {
        font-size: 0.55rem !important;
    }
    
    /* --- Tables → scroll horizontal --- */
    .data-table,
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        font-size: 0.8rem;
    }
    .data-table th, .data-table td,
    table th, table td {
        padding: 8px 10px !important;
        font-size: 0.78rem;
    }
    
    /* --- Formulaires → pleine largeur --- */
    input, select, textarea {
        width: 100% !important;
        max-width: 100% !important;
        font-size: 16px !important; /* empêche le zoom auto iOS */
    }
    .form-field, .form-group {
        width: 100% !important;
    }
    
    /* --- Modals --- */
    .modal-content,
    [class*="modal"] > div {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px auto !important;
        max-height: 85vh;
        overflow-y: auto;
    }
    
    /* --- Config grid (SuperAdmin paramètres) --- */
    .config-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .config-nav {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        padding: 10px !important;
    }
    .config-nav .nav-item {
        flex: 0 0 auto;
        font-size: 0.75rem;
        padding: 6px 10px !important;
    }
    .config-nav h4 {
        width: 100%;
        margin: 5px 0 !important;
    }
    .config-panel {
        padding: 16px !important;
    }
    
    /* --- Titres --- */
    h1 { font-size: 1.3rem !important; }
    h2 { font-size: 1.1rem !important; }
    h3 { font-size: 0.95rem !important; }
    
    /* --- Boutons action (grilles de boutons) --- */
    .action-grid,
    .card-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    /* --- Bouton flottant mobile nav --- */
    .mobile-nav-trigger {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    
    /* --- Header page --- */
    .page-header, .section-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }
    
    /* --- Grilles flexibles --- */
    [style*="display: flex"][style*="gap"],
    [style*="display:flex"][style*="gap"] {
        flex-wrap: wrap !important;
    }
    
    /* --- Sticky headers de table --- */
    .sticky-header {
        position: static !important;
    }
    
    /* --- Padding/margin réduits --- */
    .p-30 { padding: 16px !important; }
    .p-20 { padding: 12px !important; }
    .p-15 { padding: 10px !important; }
}

/* ── PETIT MOBILE (≤480px) ── */
@media (max-width: 480px) {
    .main-content {
        padding: 8px !important;
    }
    .glass {
        padding: 12px !important;
        border-radius: 12px !important;
    }
    .dashboard-grid {
        gap: 8px !important;
    }
    .action-grid,
    .card-grid {
        grid-template-columns: 1fr !important;
    }
    .ribbon-btn-large {
        width: 42px;
        height: 42px;
    }
    .ribbon-btn-large span {
        display: none; /* Cacher les labels, garder les icônes */
    }
    h1 { font-size: 1.1rem !important; }
    h2 { font-size: 1rem !important; }
    
    /* Login page mobile */
    .login-card {
        width: 95% !important;
        max-width: 95% !important;
        padding: 20px !important;
        margin: 10px !important;
    }
}

/* ── LOGIN PAGE RESPONSIVE ── */
@media (max-width: 768px) {
    .login-page {
        padding: 16px;
    }
    .login-card, .mi-card {
        width: 100% !important;
        max-width: 100% !important;
        padding: 24px !important;
        border-radius: 16px !important;
    }
    .mi-card h2 {
        font-size: 1.2rem !important;
    }
    .mi-tabs {
        flex-wrap: wrap;
    }
    .mi-tab {
        flex: 1;
        text-align: center;
        font-size: 0.8rem;
    }
}

/* ── IMPRESSION ── */
@media print {
    .sidebar, .ribbon-tabs, .ribbon-content, .windev-ribbon,
    .mobile-nav-trigger, .header-actions, .action-grid {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 0 !important;
    }
    .glass {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }
    table { page-break-inside: avoid; }
}

/* ── SAFE AREA (pour iPhone avec encoche) ── */
@supports (padding: max(0px)) {
    .main-content {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    .chat-input-zone {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}
