* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4CAF50;
    --primary-dark: #45a049;
    --secondary: #2196F3;
    --secondary-dark: #0b7dda;
    --danger: #f44336;
    --warning: #ff9800;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --border: #ddd;
    --shadow: rgba(0, 0, 0, 0.1);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--gradient-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ========================================
   LANDING PAGE
======================================== */
.landing-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.landing-content {
    background: white;
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 500px;
    width: 100%;
    animation: fadeInUp 0.6s ease;
}

.landing-content h1 {
    font-size: 2.5em;
    color: var(--dark);
    margin-bottom: 20px;
}

.landing-content p {
    color: #666;
    margin-bottom: 40px;
    font-size: 1.1em;
}

.landing-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ========================================
   LOGIN PAGE
======================================== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.6s ease;
}

.login-box h2 {
    margin-bottom: 30px;
    color: var(--dark);
    text-align: center;
    font-size: 1.8em;
}

/* ========================================
   DASHBOARD LAYOUT
======================================== */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    background: var(--light);
}

.sidebar {
    width: 280px;
    background: var(--dark);
    color: white;
    padding: 0;
    box-shadow: 2px 0 10px var(--shadow);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    padding: 30px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar h2 {
    font-size: 1.4em;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.8em;
    cursor: pointer;
    padding: 5px;
}

.sidebar ul {
    list-style: none;
    padding: 20px 0;
}

.sidebar ul li a {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 1.05em;
}

.sidebar ul li a:hover,
.sidebar ul li a.active {
    background: rgba(255,255,255,0.15);
    border-left: 4px solid var(--primary);
    padding-left: 21px;
}

.sidebar ul li a::before {
    content: '▸';
    margin-right: 10px;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar ul li a:hover::before,
.sidebar ul li a.active::before {
    opacity: 1;
}

.main-content {
    flex: 1;
    padding: 30px;
    margin-left: 280px;
    background: var(--light);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.main-content h1 {
    margin-bottom: 30px;
    color: var(--dark);
    font-size: 2em;
}

/* ========================================
   MOBILE HEADER
======================================== */
.mobile-header {
    display: none;
    background: var(--dark);
    padding: 15px 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    box-shadow: 0 2px 10px var(--shadow);
}

.mobile-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.mobile-header h2 {
    font-size: 1.3em;
}

/* ========================================
   CARDS
======================================== */
.card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 15px var(--shadow);
    margin-bottom: 25px;
    animation: fadeIn 0.5s ease;
}

.card h2, .card h3 {
    color: var(--dark);
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--gradient-success);
    color: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card h3 {
    font-size: 1.1em;
    margin-bottom: 10px;
    opacity: 0.95;
}

.stat-number {
    font-size: 3em;
    font-weight: bold;
    margin-top: 10px;
}

/* ========================================
   PROFILE CARD
======================================== */
.profile-card {
    background: white;
    border-left: 5px solid var(--primary);
}

.profile-info {
    display: flex;
    gap: 25px;
    align-items: center;
    flex-wrap: wrap;
}

.profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid var(--primary);
    box-shadow: 0 4px 15px var(--shadow);
}

.profile-photo-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5em;
    color: white;
    box-shadow: 0 4px 15px var(--shadow);
}

.profile-info > div h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.profile-info > div p {
    margin: 8px 0;
    color: #555;
}

/* ========================================
   FORMS
======================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.95em;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.85em;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ========================================
   BUTTONS
======================================== */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(76,175,80,0.4);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(33,150,243,0.4);
}

.btn-sm {
    padding: 8px 20px;
    font-size: 14px;
}

.btn-block {
    width: 100%;
    display: block;
}

/* ========================================
   TABLES
======================================== */
.table-responsive {
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table thead {
    background: var(--dark);
    color: white;
}

table th,
table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

table th {
    font-weight: 600;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table tbody tr {
    transition: background 0.2s;
}

table tbody tr:hover {
    background: rgba(76, 175, 80, 0.05);
}

/* ========================================
   ALERTS
======================================== */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    font-size: 1em;
    animation: slideDown 0.4s ease;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert strong {
    font-weight: 700;
}

/* ========================================
   BADGES
======================================== */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

/* ========================================
   INFO CARD
======================================== */
.info-card {
    background: var(--gradient-primary);
    color: white;
    border: none;
}

.info-card h3 {
    margin-bottom: 20px;
    font-size: 1.3em;
    color: white;
}

.info-list {
    list-style: none;
    padding: 0;
}

.info-list li {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    font-size: 1em;
    line-height: 1.6;
}

.info-list li:last-child {
    border-bottom: none;
}

/* ========================================
   PHOTO UPLOAD
======================================== */
.photo-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.current-photo {
    max-width: 250px;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow);
}

.no-photo {
    width: 250px;
    height: 250px;
    background: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: #999;
    font-size: 1.2em;
    border: 2px dashed var(--border);
}

.profile-details p {
    margin: 12px 0;
    font-size: 1.05em;
}

.profile-details strong {
    color: var(--dark);
    display: inline-block;
    min-width: 180px;
}

/* ========================================
   EXAM PAGE
======================================== */
.exam-body {
    background: var(--light);
}

.exam-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 20px;
}

.exam-header {
    background: var(--gradient-success);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.3);
}

.exam-header h1 {
    color: white;
    margin-bottom: 15px;
    font-size: 1.8em;
}

.exam-info {
    display: flex;
    gap: 30px;
    margin-top: 15px;
    font-size: 1.1em;
    flex-wrap: wrap;
}

.exam-info span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-preview {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 200px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 25px rgba(0,0,0,0.5);
    z-index: 1000;
}

.video-preview video {
    width: 100%;
    display: block;
}

.recording-indicator {
    background: var(--danger);
    color: white;
    padding: 8px 10px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

.question-card {
    background: white;
    border: 2px solid var(--border);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px var(--shadow);
    transition: transform 0.2s;
}

.question-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--shadow);
}

.question-card h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.2em;
}

.question-text {
    font-size: 1.1em;
    margin-bottom: 20px;
    line-height: 1.8;
    color: var(--dark);
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.option:hover {
    background: rgba(76, 175, 80, 0.05);
    border-color: var(--primary);
    transform: translateX(5px);
}

.option input[type="radio"] {
    margin-right: 15px;
    transform: scale(1.4);
    cursor: pointer;
}

.option input[type="radio"]:checked + span {
    color: var(--primary);
    font-weight: 600;
}

/* ========================================
   UTILITY CLASSES
======================================== */
.text-muted {
    color: #999;
}

.no-data {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.1em;
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 20px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--primary-dark);
}

/* ========================================
   ANIMATIONS
======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* ========================================
   RESPONSIVE - TABLET
======================================== */
@media (max-width: 1024px) {
    .sidebar {
        width: 250px;
    }
    
    .main-content {
        margin-left: 250px;
    }
    
    .exam-info {
        gap: 20px;
        font-size: 1em;
    }
}

/* ========================================
   RESPONSIVE - MOBILE
======================================== */
@media (max-width: 768px) {
    /* Mobile Header */
    .mobile-header {
        display: block;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    /* Sidebar Mobile */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-header {
        padding: 20px;
    }
    
    /* Main Content */
    .main-content {
        margin-left: 0;
        padding: 20px 15px;
        padding-top: 80px;
    }
    
    .main-content h1 {
        font-size: 1.6em;
    }
    
    /* Cards */
    .card {
        padding: 20px 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    /* Profile */
    .profile-info {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-photo,
    .profile-photo-placeholder {
        width: 100px;
        height: 100px;
    }
    
    .profile-details strong {
        display: block;
        margin-bottom: 5px;
    }
    
    /* Forms */
    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }
    
    table th,
    table td {
        padding: 10px;
        font-size: 0.9em;
    }
    
    /* Buttons */
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .landing-buttons {
        gap: 12px;
    }
    
    /* Exam */
    .exam-container {
        padding: 20px 15px;
    }
    
    .exam-header {
        padding: 20px;
    }
    
    .exam-header h1 {
        font-size: 1.4em;
    }
    
    .exam-info {
        flex-direction: column;
        gap: 10px;
        font-size: 0.95em;
    }
    
    .video-preview {
        width: 120px;
        top: 10px;
        right: 10px;
    }
    
    .question-card {
        padding: 20px 15px;
    }
    
    .question-text {
        font-size: 1em;
    }
    
    .option {
        padding: 12px;
    }
    
    .option input[type="radio"] {
        transform: scale(1.2);
    }
    
    /* Login */
    .login-box {
        padding: 30px 20px;
    }
    
    .landing-content {
        padding: 40px 25px;
    }
    
    .landing-content h1 {
        font-size: 2em;
    }
}

/* ========================================
   RESPONSIVE - SMALL MOBILE
======================================== */
@media (max-width: 480px) {
    .main-content {
        padding: 15px 10px;
        padding-top: 70px;
    }
    
    .main-content h1 {
        font-size: 1.4em;
        margin-bottom: 20px;
    }
    
    .card {
        padding: 15px;
    }
    
    .exam-header h1 {
        font-size: 1.2em;
    }
    
    .question-card {
        padding: 15px;
    }
    
    .stat-number {
        font-size: 2.5em;
    }
    
    .video-preview {
        width: 100px;
        top: 5px;
        right: 5px;
    }
    
    .profile-photo,
    .profile-photo-placeholder {
        width: 80px;
        height: 80px;
        font-size: 2.5em;
    }
    
    .landing-content h1 {
        font-size: 1.6em;
    }
    
    .landing-content p {
        font-size: 1em;
    }
}

/* ========================================
   SIDEBAR OVERLAY (Mobile)
======================================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

body.menu-open {
    overflow: hidden;
}

/* ========================================
   MOBILE STATS
======================================== */
.stats-grid-mobile {
    display: none;
}

/* ========================================
   RESPONSIVE AMÉLIORATIONS
======================================== */
@media (max-width: 768px) {
    /* Afficher les stats mobile */
    .stats-grid-mobile {
        display: grid;
    }
    
    /* Cacher les stats desktop */
    .stats-grid {
        display: none;
    }
    
    /* Sidebar mobile amélioré */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }
    
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.3);
    }
    
    /* Profile card mobile */
    .profile-card .profile-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .profile-card .profile-info > div {
        width: 100%;
    }
    
    .profile-card .profile-info > div p {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid var(--border);
    }
    
    .profile-card .profile-info > div p:last-child {
        border-bottom: none;
    }
    
    .profile-card .profile-info > div strong {
        font-size: 0.9em;
        color: #666;
    }
    
    /* Cards mobile */
    .card {
        border-radius: 12px;
    }
    
    .card h2 {
        font-size: 1.3em;
    }
    
    /* Info list mobile */
    .info-list li {
        font-size: 0.95em;
        line-height: 1.7;
    }
    
    /* Badges mobile */
    .badge {
        font-size: 0.75em;
        padding: 5px 10px;
        white-space: nowrap;
    }
    
    /* Alerts mobile */
    .alert {
        font-size: 0.95em;
        padding: 12px 15px;
    }
    
    /* No data mobile */
    .no-data {
        padding: 40px 20px;
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    /* Très petits écrans */
    .profile-photo,
    .profile-photo-placeholder {
        width: 80px;
        height: 80px;
        font-size: 2.5em;
    }
    
    .main-content h1 {
        font-size: 1.3em;
    }
    
    .card h2 {
        font-size: 1.1em;
    }
    
    .exam-item {
        padding: 15px;
    }
    
    .exam-item-title {
        font-size: 1em;
    }
    
    .stat-card-mobile .number {
        font-size: 2em;
    }
    
    .stat-card-mobile h4 {
        font-size: 0.85em;
    }
}

/* ========================================
   ANIMATIONS AMÉLIORÉES
======================================== */
@keyframes slideInRight {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.sidebar.active {
    animation: slideInRight 0.3s ease;
}

.exam-item {
    animation: fadeInUp 0.4s ease;
}

.exam-item:nth-child(1) { animation-delay: 0.1s; }
.exam-item:nth-child(2) { animation-delay: 0.2s; }
.exam-item:nth-child(3) { animation-delay: 0.3s; }
.exam-item:nth-child(4) { animation-delay: 0.4s; }
.exam-item:nth-child(5) { animation-delay: 0.5s; }

/* ========================================
   PRINT STYLES
======================================== */
@media print {
    .sidebar,
    .mobile-header,
    .video-preview,
    .btn {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
        padding: 0;
    }
}