/* ==========================================================================
   EASYTRACK — CSS UNIFIÉ
   ========================================================================== */

/* ==========================================================================
   1. VARIABLES & CONFIGURATION
   ========================================================================== */
:root {
    --bg-start: #06091a;
    --bg-end: #0d1530;
    --surface: rgba(12, 18, 38, 0.82);
    --surface-strong: rgba(12, 18, 38, 0.95);
    --surface-hover: rgba(255, 255, 255, 0.05);
    --text: #e2e8f0;
    --muted: #7a8ba8;
    --muted-light: #94a3b8;
    --accent: #6d28d9;
    --accent-hover: #7c3aed;
    --accent-soft: #22d3ee;
    --accent-gradient: linear-gradient(135deg, #6d28d9, #22d3ee);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: rgba(255, 255, 255, 0.07);
    --border-focus: rgba(34, 211, 238, 0.5);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-pill: 999px;
    --shadow-card: 0 20px 60px rgba(0, 0, 0, 0.4);
    --shadow-btn: 0 8px 20px rgba(109, 40, 217, 0.35);
    --mouse-x: 50;
    --mouse-y: 50;
    --nav-height: 72px;
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
    margin-top: var(--nav-height);
    font-family: 'Roboto', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background:
        radial-gradient(circle at calc(var(--mouse-x) * 1%) calc(var(--mouse-y) * 1%), rgba(109, 40, 217, 0.15), transparent 30%),
        linear-gradient(180deg, var(--bg-start) 0%, var(--bg-end) 100%);
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(circle at 15% 10%, rgba(109, 40, 217, 0.12), transparent 20%),
        radial-gradient(circle at 85% 85%, rgba(34, 211, 238, 0.08), transparent 20%);
}

a { color: inherit; text-decoration: none; transition: all 0.2s ease; }
img { display: block; max-width: 100%; }

/* ==========================================================================
   3. NAVIGATION
   ========================================================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    z-index: 1000;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    background: rgba(6, 9, 26, 0.88);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 28px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

/* Logo */
.logo {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #fff;
    flex-shrink: 0;
}

.logo span {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Nav Menu */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin-left: auto;
}

.nav-menu li a,
.nav-menu li span {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-sm);
    color: var(--muted-light);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-menu li a:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav-menu li a.active { color: #fff; }

/* Bouton déconnexion dans le nav */
.logoutButton {
    padding: 0.45rem 1rem !important;
    border-radius: var(--radius-pill) !important;
    background: rgba(239, 68, 68, 0.1) !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    color: #fca5a5 !important;
    font-size: 0.85rem !important;
}

.logoutButton:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #fff !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
}

/* Info utilisateur */
.nav-user-info span {
    color: var(--muted-light) !important;
    font-size: 0.85rem !important;
    cursor: default;
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}
.hamburger:hover { background: rgba(255,255,255,0.06); }

.bar {
    width: 22px;
    height: 2px;
    background: var(--muted-light);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active .bar:nth-child(2) { opacity: 0; }
.hamburger.active .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ==========================================================================
   4. LAYOUT
   ========================================================================== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2.5rem 28px;
}

main.container {
    padding-top: 3rem;
    padding-bottom: 4rem;
}

/* ==========================================================================
   5. TYPOGRAPHIE
   ========================================================================== */
h1 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #ffffff 0%, var(--muted-light) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.25rem;
}

h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}

/* ==========================================================================
   6. CARTES (surfaces glassmorphism)
   ========================================================================== */
.form-card,
.dashboard-card,
.feature-card,
.devoir-detail-card,
.admin-section,
.section-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-card);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.dashboard-card h2 {
    font-size: 1.1rem;
    color: var(--muted-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.dashboard-card p { color: var(--muted); margin-bottom: 1.25rem; }

/* ==========================================================================
   7. BOUTONS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.6rem;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: 'Roboto', sans-serif;
    transition: all 0.22s ease;
    text-decoration: none;
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: var(--shadow-btn);
}

.btn-primary:hover {
    box-shadow: 0 12px 28px rgba(109, 40, 217, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255,255,255,0.15);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.22);
    color: #fff;
}

/* Petit bouton */
.btn-small {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.4rem 1rem;
    background: rgba(109, 40, 217, 0.15);
    color: var(--accent-soft);
    border: 1px solid rgba(109, 40, 217, 0.25);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-small:hover {
    background: rgba(109, 40, 217, 0.28);
    border-color: rgba(34, 211, 238, 0.35);
    color: #fff;
    transform: none;
}

/* Bouton modifier (distinct du voir) */
.btn-edit {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.4rem 1rem;
    background: rgba(34, 211, 238, 0.1);
    color: var(--accent-soft);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-edit:hover {
    background: rgba(34, 211, 238, 0.2);
    color: #fff;
}

/* ==========================================================================
   8. BADGES
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 8px;
    /* On garde les propriétés de structure */
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    border: 1px solid; /* La couleur sera gérée par le style inline */
}

/* ==========================================================================
   9. ALERTES
   ========================================================================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
}
.alert-success::before { background: #10b981; }

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}
.alert-error::before { background: #ef4444; }

/* ==========================================================================
   10. FORMULAIRES
   ========================================================================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted-light);
    letter-spacing: 0.02em;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-family: 'Roboto', sans-serif;
    font-size: 0.9rem;
    transition: all 0.25s ease;
    appearance: none;
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
}

.form-control.error {
    border-color: rgba(239, 68, 68, 0.5);
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a8ba8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 2.5rem;
    cursor: pointer;
}

select[multiple].form-control {
    background-image: none;
    padding-right: 1.1rem;
    cursor: pointer;
}

select[multiple].form-control option {
    background: #111c44;
    padding: 6px 8px;
}

textarea.form-control { resize: vertical; min-height: 110px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-note {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.88rem;
    color: var(--muted);
}

.form-note a {
    color: var(--accent-soft);
    font-weight: 600;
}
.form-note a:hover { text-decoration: underline; }

/* Bouton submit dans les forms */
.form-card .btn { margin-top: 0.5rem; }
.form-card .btn + .btn { margin-left: 0.75rem; }

/* ==========================================================================
   11. TABLEAU DES DEVOIRS
   ========================================================================== */
.devoirs-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.devoirs-table thead th {
    padding: 0 1rem 0.75rem;
    text-align: left;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border);
}

.devoirs-table tbody tr td {
    padding: 1.1rem 1rem;
    background: rgba(255, 255, 255, 0.025);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    transition: background 0.15s;
}

.devoirs-table tbody tr td:first-child {
    border-left: 1px solid var(--border);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    padding-left: 1.25rem;
}

.devoirs-table tbody tr td:last-child {
    border-right: 1px solid var(--border);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding-right: 1.25rem;
}

.devoirs-table tbody tr:hover td {
    background: var(--surface-hover);
}

/* Groupe de boutons dans le tableau */
.devoirs-table td .btn-small,
.devoirs-table td .btn-edit {
    margin-right: 6px;
}

/* ==========================================================================
   10b. FORM PICKER — select custom pour ajouter/modifier
   ========================================================================== */

.form-picker {
    position: relative;
    width: 100%;
}

.form-picker-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-family: 'Roboto', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
}

.form-picker-trigger:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
}

.form-picker.open .form-picker-trigger {
    border-color: var(--border-focus);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
}

.form-picker-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-picker-arrow {
    font-size: 0.65rem;
    color: var(--muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.form-picker.open .form-picker-arrow {
    transform: rotate(180deg);
}

.form-picker-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 400;
    background: rgba(10, 15, 40, 0.98);
    border: 1px solid var(--border-focus);
    border-radius: var(--radius-md);
    padding: 6px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
    max-height: 260px;
    overflow-y: auto;
    animation: dropIn 0.15s ease;
}

.form-picker.open .form-picker-dropdown { display: block; }

.form-picker-dropdown::-webkit-scrollbar { width: 4px; }
.form-picker-dropdown::-webkit-scrollbar-track { background: transparent; }
.form-picker-dropdown::-webkit-scrollbar-thumb { background: var(--border-focus); border-radius: 2px; }

.form-picker-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--muted-light);
    transition: background 0.15s, color 0.15s;
    user-select: none;
}

.form-picker-option:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.form-picker-option.selected {
    color: var(--text);
    background: rgba(34, 211, 238, 0.06);
}

.form-picker-option .fp-check {
    margin-left: auto;
    font-size: 0.65rem;
    color: var(--accent-soft);
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.form-picker-option.selected .fp-check { opacity: 1; }

.fp-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.fp-dot-controle  { background: #D0021B; }
.fp-dot-tp        { background: #007AFF; }
.fp-dot-dm        { background: #6B7280; }
.fp-dot-projet    { background: #F5A623; }
.fp-dot-exercice  { background: #059669; }

/* ==========================================================================
   12. PAGE ACCUEIL (index.php)
   ========================================================================== */
.hero {
    display: flex;
    align-items: center;
    padding: 4rem 28px;
}

.hero-container {
    max-width: 680px;
    margin: 0 auto;
    text-align: center;
}

.hero h1 {
    font-size: clamp(2.2rem, 6vw, 3.5rem);
    font-weight: 900;
    margin-bottom: 1.25rem;
}

.hero p {
    font-size: 1.15rem;
    color: var(--muted-light);
    margin-bottom: 2.5rem;
    line-height: 1.7;
}

.hero .btn { margin: 0 0.5rem; }

.features > .container > h2,
.features > .container > h1 {
    text-align: center;
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    text-align: center;
    padding: 2.25rem 1.75rem;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 70px rgba(0,0,0,0.5);
}

.feature-card i {
    font-size: 2rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 1rem;
    display: block;
}

.feature-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    color: var(--text);
}

.feature-card p {
    font-size: 0.88rem;
    color: var(--muted);
    line-height: 1.6;
}

/* ==========================================================================
   13. PAGE CONNEXION / INSCRIPTION
   ========================================================================== */
.features .container .form-card {
    max-width: 480px;
    margin: 0 auto 1.5rem;
}

.features .container h1 {
    text-align: center;
    margin-bottom: 2rem;
}

/* Tabs de connexion */
.form-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 1.5rem;
}

.form-tabs .tab {
    flex: 1;
    padding: 0.6rem;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--muted);
    transition: all 0.2s;
}

.form-tabs .tab.active,
.form-tabs .tab:hover {
    background: rgba(109, 40, 217, 0.25);
    color: var(--text);
}

.hidden { display: none !important; }

/* ==========================================================================
   14. PAGE DASHBOARD (dashboard.php)
   ========================================================================== */
.no-data {
    text-align: center;
    color: var(--muted);
    padding: 3rem 0;
    font-size: 0.95rem;
}

/* ==========================================================================
   15. PAGE DEVOIR (devoir.php)
   ========================================================================== */
.devoir-detail-card {
    max-width: 820px;
    margin: 0 auto;
}

.detail-header {
    margin-bottom: 1.5rem;
}

.detail-header h1 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.matiere-tag {
    color: var(--muted-light);
    font-size: 0.9rem;
}

.matiere-tag strong {
    color: var(--text);
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

.detail-body { margin-bottom: 1.5rem; }

.description-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    color: var(--text);
    line-height: 1.8;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.detail-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.detail-info-grid p {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted-light);
    font-size: 0.9rem;
}

.detail-info-grid p i {
    color: var(--accent-soft);
    width: 16px;
    text-align: center;
}

.detail-info-grid p strong { color: var(--text); }

.devoir-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ==========================================================================
   16. PAGE ADMIN (admin.php)
   ========================================================================== */

/* Formulaire inline */
.admin-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

/* REMPLACER PAR : */
/* ── Role picker (même pattern que class-picker) ────── */
.role-picker {
    position: relative;
}

.role-picker-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: 38px;
    min-width: 115px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.82rem;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.role-picker-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.role-picker.open .role-picker-trigger {
    border-color: var(--border-focus);
    background: rgba(34, 211, 238, 0.05);
}

.role-picker-label {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
}

.role-picker-arrow {
    font-size: 0.62rem;
    color: var(--muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.role-picker.open .role-picker-arrow {
    transform: rotate(180deg);
}

.role-picker-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 300;
    min-width: 140px;
    background: rgba(10, 15, 40, 0.98);
    border: 1px solid var(--border-focus);
    border-radius: var(--radius-md);
    padding: 6px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
    animation: dropIn 0.15s ease;
}

.role-picker.open .role-picker-dropdown {
    display: block;
}

.role-picker-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--muted-light);
    transition: background 0.15s, color 0.15s;
    user-select: none;
}

.role-picker-option:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.role-picker-option.selected {
    color: var(--text);
}

.role-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.role-dot-visiteur { background: #6B7280; }
.role-dot-eleve    { background: #FFBB00; }
.role-dot-prof     { background: #8ED931; }
.role-dot-admin    { background: #D0021B; }

.role-picker-option .role-check {
    margin-left: auto;
    font-size: 0.65rem;
    color: var(--accent-soft);
    opacity: 0;
    transition: opacity 0.15s;
}

.role-picker-option.selected .role-check {
    opacity: 1;
}

/* Résumé des classes dans la colonne "Classes" */
.classes-summary {
    color: var(--muted-light);
    font-size: 0.82rem;
}

/* ── Class picker : bouton trigger ──────────────────── */
.class-picker {
    position: relative;
}

.class-picker-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: 38px;
    min-width: 140px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.82rem;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.class-picker-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.class-picker.open .class-picker-trigger {
    border-color: var(--border-focus);
    background: rgba(34, 211, 238, 0.05);
}

.class-picker-label {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
}

.class-picker-arrow {
    font-size: 0.62rem;
    color: var(--muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.class-picker.open .class-picker-arrow {
    transform: rotate(180deg);
}

/* ── Dropdown ───────────────────────────────────────── */
.class-picker-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 300;
    min-width: 180px;
    background: rgba(10, 15, 40, 0.98);
    border: 1px solid var(--border-focus);
    border-radius: var(--radius-md);
    padding: 6px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
    animation: dropIn 0.15s ease;
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.class-picker.open .class-picker-dropdown {
    display: block;
}

/* ── Options checkboxes ─────────────────────────────── */
.class-picker-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--muted-light);
    transition: background 0.15s, color 0.15s;
    user-select: none;
}

.class-picker-option:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.class-picker-option input[type="checkbox"] {
    display: none;
}

/* Case custom */
.class-picker-check {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border-radius: 5px;
    border: 1.5px solid var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-size: 0.6rem;
    color: transparent;
}

.class-picker-option input:checked ~ .class-picker-check {
    background: var(--accent-gradient);
    border-color: transparent;
    color: #fff;
}

.class-picker-option input:checked ~ .class-picker-check ~ * {
    color: var(--text);
}

/* ── Bouton sauvegarder ─────────────────────────────── */
.btn-save-admin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-save-admin:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.5);
}

/* ==========================================================================
   17. FOOTER
   ========================================================================== */
footer {
    margin-top: 4rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.8;
}

footer a { color: var(--accent-soft); }
footer a:hover { text-decoration: underline; }

/* ==========================================================================
   18. ANIMATIONS
   ========================================================================== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.form-card,
.dashboard-card,
.devoir-detail-card,
.admin-section,
.feature-card {
    animation: fadeInUp 0.45s ease both;
}

.feature-card:nth-child(1) { animation-delay: 0.05s; }
.feature-card:nth-child(2) { animation-delay: 0.12s; }
.feature-card:nth-child(3) { animation-delay: 0.19s; }

/* ==========================================================================
   19. RESPONSIVE
   ========================================================================== */

/* Tablette */
@media (max-width: 900px) {
    .hamburger { display: flex; }

    .nav-menu {
        position: fixed;
        top: var(--nav-height);
        right: -100%;
        width: 260px;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 1rem;
        background: rgba(6, 9, 26, 0.98);
        backdrop-filter: blur(20px);
        border-left: 1px solid var(--border);
        min-height: calc(100vh - var(--nav-height));
        transition: right 0.3s ease;
    }

    .nav-menu.active { right: 0; }

    .nav-menu li a,
    .nav-menu li span {
        padding: 0.75rem 1rem;
    }

    .logoutButton {
        margin-top: 0.5rem;
    }
}

/* Mobile */
@media (max-width: 640px) {
    .container { padding: 1.5rem 16px; }
    main.container { padding-top: 2rem; }
    h1 { font-size: 1.6rem; }

    .form-row { grid-template-columns: 1fr; }

    .hero { padding: 3rem 16px; }
    .hero h1 { font-size: 2rem; }

    .form-card,
    .dashboard-card,
    .feature-card,
    .devoir-detail-card,
    .admin-section,
    .section-card {
        padding: 1rem;
    }

    /* ══════════════════════════════════════════
       DASHBOARD — cartes devoirs
    ══════════════════════════════════════════ */
    .devoirs-table thead { display: none; }

    .devoirs-table tbody tr {
        display: grid;
        grid-template-columns: 1fr auto;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        margin-bottom: 10px;
        overflow: hidden;
        position: relative;
    }

    .devoirs-table tbody tr:hover { background: rgba(255, 255, 255, 0.055); }

    /* Supprimer les pseudo-éléments data-label sur le dashboard */
    .devoirs-table tbody tr td::before { display: none; }

    /* Reset commun à tous les td */
    .devoirs-table tbody tr td {
        border: none !important;
        border-radius: 0 !important;
        background: transparent !important;
    }

    /* Matière — petit label cyan en haut à gauche */
    .devoirs-table tbody tr td:nth-child(1) {
        grid-column: 1; grid-row: 1;
        display: block !important;
        padding: 0.85rem 1rem 0.15rem;
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.07em;
        color: var(--accent-soft);
    }

    /* Titre — sous la matière */
    .devoirs-table tbody tr td:nth-child(2) {
        grid-column: 1; grid-row: 2;
        display: block !important;
        padding: 0.1rem 1rem 0.5rem;
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--text);
    }

    /* Date — en bas à gauche avec icône */
    .devoirs-table tbody tr td:nth-child(3) {
        grid-column: 1; grid-row: 3;
        display: flex !important;
        align-items: center;
        gap: 6px;
        padding: 0 1rem 0.85rem;
        font-size: 0.8rem;
        color: var(--muted);
    }

    /* Badge type — ancré en haut à droite sur toutes les lignes */
    .devoirs-table tbody tr td:nth-child(4) {
        grid-column: 2; grid-row: 1 / 4;
        display: flex !important;
        align-items: flex-start;
        justify-content: flex-end;
        padding: 0.85rem 1rem 0;
    }

    /* Bouton(s) action — barre pleine largeur en bas */
    .devoirs-table tbody tr td:nth-child(5) {
        grid-column: 1 / -1; grid-row: 4;
        display: flex !important;
        gap: 8px;
        padding: 0.65rem 1rem;
        border-top: 1px solid var(--border) !important;
        background: rgba(0, 0, 0, 0.1) !important;
    }

    .devoirs-table tbody tr td:nth-child(5) .btn-small,
    .devoirs-table tbody tr td:nth-child(5) .btn-edit {
        flex: 1;
        justify-content: center;
        text-align: center;
    }

    /* ══════════════════════════════════════════
       ADMIN — cartes utilisateurs
    ══════════════════════════════════════════ */
    .admin-section .devoirs-table tbody tr {
        display: block;
        overflow: visible;
    }

    /* Coins arrondis via premier/dernier td */
    .admin-section .devoirs-table tbody tr td:first-child {
        border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
    }

    .admin-section .devoirs-table tbody tr td:last-child {
        border-radius: 0 0 var(--radius-md) var(--radius-md) !important;
    }

    /* Rétablit les data-label pour l'admin */
    .admin-section .devoirs-table tbody tr td::before {
        display: block;
        content: attr(data-label);
        color: var(--muted);
        font-size: 0.78rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .admin-section .devoirs-table tbody tr td {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 0.7rem 1rem;
        font-size: 0.88rem;
    }

    /* Cellule formulaire admin */
    .admin-section .devoirs-table tbody tr td.td-actions {
        display: block !important;
        padding: 1rem;
        border-top: 1px solid rgba(255,255,255,0.05) !important;
        overflow: visible;
        background: rgba(0, 0, 0, 0.1) !important;
    }

    .admin-section .devoirs-table tbody tr td.td-actions::before {
        display: none;
    }

    /* Formulaire admin en colonne */
    .admin-form {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
    }

    .role-picker { width: 100%; }

    .role-picker-trigger {
        width: 100%;
        height: 42px;
        min-width: unset;
    }

    .role-picker-dropdown {
        width: 100%;
        left: 0;
        right: 0;
    }

    .class-picker {
        width: 100%;
        position: relative;
    }

    .class-picker-trigger {
        width: 100%;
        height: 42px;
        min-width: unset;
    }

    .class-picker-dropdown {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 300;
        background: rgba(10, 15, 40, 0.98);
        border: 1px solid var(--border-focus);
        border-radius: var(--radius-sm);
        margin-top: 4px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
        max-height: 250px;
        overflow-y: auto;
    }

    .btn-save-admin {
        width: 100%;
        height: 42px;
        border-radius: var(--radius-sm);
        font-size: 0.9rem;
    }

    /* ══════════════════════════════════════════
       PAGE DEVOIR DETAIL
    ══════════════════════════════════════════ */
    .devoir-actions { flex-direction: column; }
    .devoir-actions .btn { width: 100%; justify-content: center; }
}