/* ==========================================================================
   Design System & UX 3.0 - ISET de Nabeul (Département TI)
   Charte : Indigo / Violet Tech (#4F46E5, #7C3AED), Noir d'Encre (#09090B), Blanc Pur (#FFFFFF)
   Univers : Linear / Raycast / Supabase High-Tech
   Police : Aptos / Plus Jakarta Sans / Inter
   ========================================================================== */

@font-face {
    font-family: 'Aptos';
    src: local('Aptos'), local('Aptos Display'), local('Segoe UI');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Aptos';
    src: local('Aptos Semibold'), local('Aptos Display Semibold'), local('Segoe UI Semibold');
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: 'Aptos';
    src: local('Aptos Bold'), local('Aptos Display Bold'), local('Segoe UI Bold');
    font-weight: 700;
    font-style: normal;
}

:root {
    /* Palette Indigo / Violet Tech (Linear / Supabase Inspired) */
    --indigo-950: #0d0c22;
    --indigo-900: #1e1b4b;
    --indigo-800: #312e81;
    --indigo-700: #3730a3;
    --indigo-600: #4338ca;
    --indigo-500: #4f46e5;
    --indigo-400: #6366f1;
    --indigo-300: #818cf8;
    --indigo-200: #c7d2fe;
    --indigo-100: #e0e7ff;
    --indigo-50:  #eef2ff;

    --violet-600: #7c3aed;
    --violet-500: #8b5cf6;
    --violet-400: #a78bfa;

    /* Palette Sombres d'Encre */
    --dark-950: #09090b;
    --dark-900: #121216;
    --dark-850: #18181b;
    --dark-800: #27272a;
    --dark-700: #3f3f46;

    /* Couleurs de Surface */
    --bg-page: #fafafa;
    --bg-surface: #ffffff;
    --bg-surface-alt: #f4f4f5;
    --text-primary: #09090b;
    --text-secondary: #52525b;
    --text-muted: #71717a;
    --text-light: #a1a1aa;

    /* Thème Principal */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #7c3aed 100%);
    --primary-gradient-glow: linear-gradient(135deg, rgba(79, 70, 229, 0.25) 0%, rgba(124, 58, 237, 0.15) 100%);
    --dark: var(--dark-950);
    --dark-gradient: linear-gradient(145deg, #09090b 0%, #121216 55%, #1e1b4b 100%);

    /* Bordures & Ombres High-Tech */
    --border-subtle: #e4e4e7;
    --border-strong: #d4d4d8;
    --border-focus: #6366f1;

    --shadow-xs: 0 1px 2px rgba(9, 9, 11, 0.04);
    --shadow-sm: 0 2px 4px rgba(9, 9, 11, 0.05), 0 1px 2px rgba(9, 9, 11, 0.03);
    --shadow-md: 0 8px 24px -4px rgba(9, 9, 11, 0.06), 0 4px 8px -2px rgba(9, 9, 11, 0.03);
    --shadow-lg: 0 16px 36px -6px rgba(79, 70, 229, 0.12), 0 6px 14px -3px rgba(9, 9, 11, 0.04);
    --shadow-xl: 0 24px 52px -10px rgba(9, 9, 11, 0.22);
    --shadow-indigo: 0 10px 25px -3px rgba(79, 70, 229, 0.35);

    /* États & Statuts */
    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-border: #fde68a;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;

    /* Formes */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    --transition: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   RESET & TYPOGRAPHIE
   ========================================================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Aptos', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-page);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.06) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(124, 58, 237, 0.05) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(79, 70, 229, 0.03) 0px, transparent 60%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

main.main-content {
    flex: 1;
    padding: 36px 0 70px 0;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.025em;
}

p {
    color: var(--text-secondary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--violet-600);
}

/* ==========================================================================
   NAVBAR 3.0 (LINEAR GLASS STYLE)
   ========================================================================== */

.navbar {
    background: rgba(9, 9, 11, 0.88);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 74px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #FFFFFF;
    font-weight: 700;
    font-size: 1.22rem;
    letter-spacing: -0.03em;
}

.navbar-brand .logo-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-size: 1.25rem;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition: var(--transition);
}

.navbar-brand:hover .logo-icon {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
}

.nav-link {
    color: #a1a1aa;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.92rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
    color: #ffffff;
    background: var(--primary-gradient);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.06);
    padding: 6px 16px 6px 8px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

.user-badge:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(99, 102, 241, 0.4);
}

.user-badge img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--indigo-400);
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.user-name {
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 600;
}

.user-role-badge {
    font-size: 0.72rem;
    color: var(--indigo-300);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-top: 2px;
}

/* ==========================================================================
   PAGE HEADERS & HERO
   ========================================================================== */

.page-header {
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-subtle);
}

.page-title {
    font-size: 1.85rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 14px;
    letter-spacing: -0.03em;
}

.page-title i {
    color: var(--primary);
    background: var(--indigo-50);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    border: 1px solid var(--indigo-100);
}

/* ==========================================================================
   CARDS & CONTAINERS
   ========================================================================== */

.card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    padding: 26px;
    margin-bottom: 26px;
    transition: var(--transition);
    position: relative;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.card-title {
    font-size: 1.22rem;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.card-title span {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ==========================================================================
   BUTTONS (RAYCAST / LINEAR MICRO-RELIEF)
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    font-size: 0.94rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
    line-height: 1.4;
    user-select: none;
    position: relative;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary-gradient);
    color: #FFFFFF;
    box-shadow: var(--shadow-indigo);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 50%, #6d28d9 100%);
    color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px -4px rgba(79, 70, 229, 0.45);
}

.btn-secondary {
    background: var(--dark-850);
    color: #FFFFFF;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--dark-900);
    color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline-primary {
    background: transparent;
    border-color: var(--indigo-300);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.25);
}

.btn-success {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: #047857;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.28);
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.38);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
    border-radius: var(--radius-xs);
}

.btn-block {
    width: 100%;
}

.btn:disabled, .btn.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   FORMS & INPUTS 3.0
   ========================================================================== */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.92rem;
    letter-spacing: -0.01em;
}

.form-control, .form-select {
    width: 100%;
    padding: 11px 16px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-primary);
    background-color: #FFFFFF;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    box-shadow: var(--shadow-xs);
}

.form-control:hover, .form-select:hover {
    border-color: var(--border-strong);
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--border-focus);
    background-color: #FFFFFF;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.form-control::placeholder {
    color: #a1a1aa;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* ==========================================================================
   INTERACTIVE DRAG & DROP FILE UPLOAD ZONE
   ========================================================================== */

.dropzone-box {
    border: 2px dashed var(--indigo-300);
    background: #fafafa;
    border-radius: var(--radius-md);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.dropzone-box:hover, .dropzone-box.dragover {
    border-color: var(--primary);
    background: var(--indigo-50);
    transform: scale(1.01);
}

.dropzone-icon {
    font-size: 2.4rem;
    color: var(--primary);
    margin-bottom: 10px;
    display: inline-block;
    transition: var(--transition);
}

.dropzone-box:hover .dropzone-icon {
    transform: translateY(-4px) scale(1.1);
}

.dropzone-text {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 4px;
}

.dropzone-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.file-preview-card {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: #FFFFFF;
    border: 1px solid var(--indigo-200);
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-top: 14px;
    box-shadow: var(--shadow-sm);
}

.file-preview-card.active {
    display: flex;
    animation: fadeInTab 0.3s ease;
}

/* ==========================================================================
   LIVE SEARCH & FILTERS BAR
   ========================================================================== */

.live-filter-wrapper {
    position: relative;
    margin-bottom: 24px;
}

.live-filter-input {
    width: 100%;
    padding: 12px 18px 12px 44px;
    background: #FFFFFF;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: 0.94rem;
    font-family: inherit;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.live-filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.live-filter-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
}

/* ==========================================================================
   SÉLECTEUR MULTIPLE DE GROUPE (UX VIBRANTE)
   ========================================================================== */

.group-selector-box {
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px;
    background: #fafafa;
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.student-checkbox-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: #FFFFFF;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.student-checkbox-item:hover {
    border-color: var(--indigo-300);
    background: var(--indigo-50);
    transform: translateX(4px);
}

.student-checkbox-item.selected {
    border-color: var(--primary) !important;
    background: var(--indigo-50) !important;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
}

.student-checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.student-checkbox-item img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-subtle);
}

.student-checkbox-name {
    font-weight: 600;
    font-size: 0.94rem;
    color: var(--text-primary);
}

/* ==========================================================================
   BADGES & PILLS HIGH-TECH
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.badge-primary {
    background: var(--indigo-50);
    color: var(--indigo-700);
    border: 1px solid var(--indigo-200);
}

.badge-success {
    background: var(--success-bg);
    color: #065f46;
    border: 1px solid var(--success-border);
}

.badge-warning {
    background: var(--warning-bg);
    color: #92400e;
    border: 1px solid var(--warning-border);
}

.badge-danger {
    background: var(--danger-bg);
    color: #991b1b;
    border: 1px solid var(--danger-border);
}

.badge-dark {
    background: #f4f4f5;
    color: var(--dark-850);
    border: 1px solid var(--border-subtle);
}

/* Pulsing dot */
.pulse-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-green 1.8s infinite;
}

@keyframes pulse-green {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ==========================================================================
   TABS (SEGMENTED CONTROL 3.0)
   ========================================================================== */

.tabs-header {
    display: flex;
    gap: 8px;
    background: #f1f2f6;
    padding: 6px;
    border-radius: var(--radius-md);
    margin-bottom: 28px;
    overflow-x: auto;
    border: 1px solid var(--border-subtle);
}

.tab-btn {
    flex: 1;
    min-width: fit-content;
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.94rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.6);
}

.tab-btn.active {
    color: var(--primary);
    background: #FFFFFF;
    box-shadow: var(--shadow-sm);
    font-weight: 700;
}

.tabs-ready .tab-content {
    display: none;
    animation: fadeInTab 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.tabs-ready .tab-content.active {
    display: block;
}

@keyframes fadeInTab {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   TOAST NOTIFICATIONS (LINEAR-STYLE FLOATING TOASTS)
   ========================================================================== */

#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: rgba(9, 9, 11, 0.95);
    backdrop-filter: blur(12px);
    color: #FFFFFF;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    max-width: 420px;
    transform: translateY(20px);
    opacity: 0;
    animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
    overflow: hidden;
}

.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-danger { border-left: 4px solid var(--danger); }
.toast.toast-warning { border-left: 4px solid var(--warning); }
.toast.toast-info { border-left: 4px solid var(--primary); }

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    width: 100%;
    animation: toastTimer 4s linear forwards;
}

@keyframes toastIn {
    to { transform: translateY(0); opacity: 1; }
}

@keyframes toastTimer {
    from { width: 100%; }
    to { width: 0%; }
}

/* ==========================================================================
   MODAL DIALOGS (INTERACTIVE POPUPS)
   ========================================================================== */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 9, 11, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeInTab 0.25s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: #FFFFFF;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-subtle);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    position: relative;
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--bg-surface-alt);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close-btn:hover {
    color: var(--text-primary);
    background: #e4e4e7;
}

/* ==========================================================================
   VIDEO EMBED
   ========================================================================== */

.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 ratio */
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: #000000;
    margin-top: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ==========================================================================
   TABLES MODERNISÉES
   ========================================================================== */

.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #FFFFFF;
}

.table th {
    background-color: #fafafa;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 14px 18px;
    border-bottom: 1.5px solid var(--border-subtle);
    white-space: nowrap;
}

.table td {
    padding: 16px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
    font-size: 0.94rem;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: #fafafa;
}

/* ==========================================================================
   ALERTS
   ========================================================================== */

.alert {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 500;
    font-size: 0.95rem;
    box-shadow: var(--shadow-xs);
    border: 1px solid transparent;
}

.alert-success { background: var(--success-bg); color: #065f46; border-color: var(--success-border); }
.alert-danger { background: var(--danger-bg); color: #991b1b; border-color: var(--danger-border); }
.alert-warning { background: var(--warning-bg); color: #92400e; border-color: var(--warning-border); }
.alert-info { background: var(--indigo-50); color: var(--indigo-900); border-color: var(--indigo-200); }

/* ==========================================================================
   AUTH PAGES (LOGIN & REGISTER 3.0)
   ========================================================================== */

.auth-wrapper {
    max-width: 480px;
    margin: 40px auto 60px auto;
}

.auth-card {
    background: #FFFFFF;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 42px 36px;
    border: 1px solid var(--border-subtle);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header .auth-logo {
    width: 62px;
    height: 62px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-size: 1.75rem;
    margin-bottom: 14px;
    box-shadow: var(--shadow-indigo);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.auth-header h2 {
    font-size: 1.55rem;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

/* ==========================================================================
   PROFILE CARD 3.0
   ========================================================================== */

.profile-header-card {
    background: var(--dark-gradient);
    color: #FFFFFF;
    border-radius: var(--radius-lg);
    padding: 34px;
    display: flex;
    align-items: center;
    gap: 26px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-header-card::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, transparent 70%);
    pointer-events: none;
}

.profile-avatar-wrapper {
    position: relative;
}

.profile-avatar-wrapper img {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--indigo-400);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.profile-details h2 {
    color: #FFFFFF;
    font-size: 1.65rem;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.profile-details p {
    color: #cbd5e1;
    font-size: 0.95rem;
}

/* ==========================================================================
   GRIDS & UTILS
   ========================================================================== */

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

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.grid-1-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 28px;
}

/* Footer 3.0 */
footer {
    background: var(--dark-950);
    color: #a1a1aa;
    padding: 30px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.92rem;
    margin-top: auto;
}

footer .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

footer a {
    color: #d4d4d8;
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    color: #ffffff;
}

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

@media (max-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .navbar .container {
        height: auto;
        padding: 16px 20px;
        flex-direction: column;
        gap: 14px;
    }
    
    .navbar-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .profile-header-card {
        flex-direction: column;
        text-align: center;
    }

    .tabs-header {
        flex-direction: column;
    }

    #toast-container {
        left: 20px;
        right: 20px;
        bottom: 20px;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }
}

:root {
    --bg-page: #f3f6fa;
    --bg-surface-alt: #f0f4f8;
    --text-primary: #17283c;
    --text-secondary: #374b63;
    --text-muted: #485d74;
    --text-light: #586b83;
    --border-subtle: #d7e1eb;
    --border-focus: #1849a9;
    --primary: #1849a9;
    --primary-hover: #113780;
    --primary-gradient: linear-gradient(135deg, #1947a2, #193a73);
    --indigo-50: #ecf3ff;
    --indigo-100: #dbe8fb;
    --secondary: #573c92;
    --success: #087357;
    --warning: #86510c;
    --danger: #b42318;
}

body { font-family: 'Instrument Sans', system-ui, sans-serif; }
* { min-inline-size: 0; }
img { max-inline-size: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #a8400b; outline-offset: 3px; }
a:focus-visible, summary:focus-visible { border-radius: 3px; }
.sr-only, .skip-link:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.skip-link:focus {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1200;
    padding: 10px 16px;
    background: #fff;
}

.navbar {
    position: static;
    background: #10253f;
    border-bottom: 3px solid #2c65b7;
    backdrop-filter: none;
}
.navbar .container { min-height: 68px; height: auto; gap: 14px; padding-block: 12px; }
.navbar-brand .logo-icon { box-shadow: none; font-size: 0.88rem; }
.navbar-nav { flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.nav-link { color: #e4edf8; border-radius: 8px; min-height: 42px; padding: 8px 12px; }
.nav-link.active { background: #254a7b; box-shadow: inset 0 -3px #a8cdff; }
.navbar :focus-visible { outline-color: #ffcb75; }
.page-header { padding: clamp(16px, 4vw, 32px); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: linear-gradient(120deg, #fff, #eaf2fd); }
.page-title { font-size: clamp(1.45rem, 4vw, 2rem); line-height: 1.2; overflow-wrap: anywhere; }
.page-title i { flex-shrink: 0; }
.card { overflow-wrap: anywhere; }
.dashboard-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); gap: 16px; margin-bottom: 28px; }
.tabs-header { align-items: stretch; flex-wrap: wrap; gap: 6px; }
.tab-btn { min-height: 42px; white-space: normal; text-align: left; }
.form-control, .form-select { border-color: #879bb3; }
.form-group:has(> input[type="file"]) { overflow-wrap: anywhere; }
input[type="file"] { cursor: pointer; }
.dropzone-box input[type="file"] { max-width: 100%; margin-top: 12px; }
.auth-header h1 { font-size: clamp(1.4rem, 4vw, 1.8rem); line-height: 1.2; }
.field-hint { display: block; color: var(--text-muted); font-size: 0.94rem; margin: 5px 0 10px; }
.narrow-card { max-width: 720px; }
.back-link { display: inline-block; margin-bottom: 8px; }

.tp-documents { margin: 14px 0; }
.tp-documents ul { display: grid; gap: 10px; list-style: none; margin-top: 8px; }
.tp-documents li, .add-tp-documents { border: 1px solid var(--border-subtle); border-radius: 8px; padding: 10px 14px; background: #f7faff; }
.document-link { font-weight: 600; overflow-wrap: anywhere; }
summary { cursor: pointer; font-weight: 650; padding-block: 6px; }
.add-tp-documents form, .exam-create form { margin-top: 14px; }
.add-tp-documents button { margin-top: 10px; }
.pdf-frame iframe { display: block; border: 1px solid var(--border-subtle); width: 100%; height: clamp(320px, 65vh, 720px); background: #fff; margin-bottom: 6px; }

.exam-create > summary { font-size: 1.2rem; }
.exam-create .alert { margin-top: 12px; }
#manual-questions, .exam-option + button { margin-bottom: 16px; }
.exam-list-item { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.exam-list-item h2 { font-size: 1.2rem; }
.exam-list-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.exam-question { padding: 18px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); margin-bottom: 20px; background: var(--bg-surface); min-inline-size: 0; }
.exam-question legend { max-width: 100%; padding-inline: 6px; font-weight: 700; }
.exam-question label.form-group { display: block; }
.exam-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px; margin-block: 6px; border-radius: 8px; background: var(--bg-surface-alt); cursor: pointer; }
.exam-option input { margin-top: 4px; flex-shrink: 0; width: 18px; height: 18px; accent-color: var(--primary); }
.exam-option:has(:checked) { background: #e4efff; box-shadow: inset 0 0 0 1px var(--primary); }
.exam-rules, .exam-correction ol { padding-inline-start: 24px; margin-block: 8px 18px; }
.exam-rules li, .exam-correction li { margin-bottom: 6px; }
.exam-progress { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 4px 18px; justify-content: space-between; padding: 12px 18px; border-top: 4px solid var(--primary); }
.exam-progress strong { font-variant-numeric: tabular-nums; }
.exam-copy input { scroll-margin-block-start: 110px; }
.exam-grade { color: var(--primary); font-weight: 700; margin-block: 10px; }
.preserve-lines { white-space: pre-wrap; }
.portal-actions, .portal-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.portal-row { justify-content: space-between; }
.portal-section { margin-block: 24px; }
.portal-section > h2 { margin-bottom: 12px; }
.portal-inset { margin-block: 14px; padding: 14px; border-radius: var(--radius-sm); background: var(--bg-surface-alt); }
#questions, #annonces, #poser-question, [id^="question-"], [id^="rendu-"] { scroll-margin-top: 1rem; }
@media (max-width: 768px) {
    .navbar .container { align-items: flex-start; }
    .navbar-nav { justify-content: flex-start; }
    .tabs-header { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
    .exam-list-item { display: block; }
    .exam-list-actions { margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
