/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366F1;
    --primary-dark: #4F46E5;
    --primary-light: #A5B4FC;
    --secondary: #8B5CF6;
    --secondary-light: #C4B5FD;
    --success: #10B981;
    --success-light: #6EE7B7;
    --danger: #EF4444;
    --danger-light: #FCA5A5;
    --warning: #F59E0B;
    --warning-light: #FCD34D;
    --info: #3B82F6;
    --info-light: #93C5FD;
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;
    --white: #FFFFFF;
    --gradient-primary: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    --gradient-secondary: linear-gradient(135deg, #F1F5F9 0%, #E2E8F0 100%);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--gradient-primary);
    background-attachment: fixed;
    color: var(--gray-800);
    min-height: 100vh;
    line-height: 1.6;
    font-weight: 400;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 119, 198, 0.2) 0%, transparent 50%);
    z-index: -1;
}

/* ===== PAGE SYSTEM ===== */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* ===== LOGIN PAGE ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: 24px;
    box-shadow: var(--shadow-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.login-header i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 15px;
}

.login-header h1 {
    color: var(--gray-900);
    font-size: 28px;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--gray-600);
    font-size: 14px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--gray-700);
    font-weight: 500;
    font-size: 14px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    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(79, 70, 229, 0.1);
}

.error-message {
    background: #FEE2E2;
    color: var(--danger);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    display: none;
}

.error-message.active {
    display: block;
}

.demo-info {
    text-align: center;
    margin-top: 20px;
    color: var(--gray-600);
    font-size: 13px;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--white);
    width: 100%;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-lg);
}

.btn-success {
    background: var(--success);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-success:hover {
    background: #059669;
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
    background: #DC2626;
    box-shadow: var(--shadow-md);
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-warning:hover {
    background: #D97706;
    box-shadow: var(--shadow-md);
}

.btn-sm {
    padding: 10px 18px;
    font-size: 13px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.btn-edit {
    background: var(--info);
    color: var(--white);
    flex: 1;
}

.btn-edit:hover {
    background: #2563EB;
    box-shadow: var(--shadow-md);
}

.btn-delete {
    background: var(--danger);
    color: var(--white);
}

.btn-delete:hover {
    background: #DC2626;
    box-shadow: var(--shadow-md);
}

.btn-sm:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===== NAVBAR ===== */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow-md);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--gray-100);
}

.mobile-menu-toggle {
    display: none;
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    z-index: 1001;
    position: relative;
}

.mobile-menu-toggle:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.mobile-menu-toggle:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 26px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.navbar-brand i {
    font-size: 34px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-menu {
    display: flex;
    gap: 8px;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-item {
    background: transparent;
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--gray-700);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    z-index: 1;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: 12px;
    z-index: -1;
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.nav-item.active {
    background: var(--gradient-primary);
    color: var(--white);
    box-shadow: var(--shadow-md);
    font-weight: 600;
}

.nav-item.active::before {
    opacity: 1;
}

.nav-item:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* S'assurer que le texte est toujours visible */
.nav-item * {
    position: relative;
    z-index: 2;
}

/* ===== ICÔNES MODERNES ===== */
.nav-item i {
    font-size: 16px;
    margin-right: 8px;
    transition: all 0.3s ease;
}

.nav-item:hover i {
    transform: scale(1.1);
}

.btn i {
    margin-right: 8px;
    transition: all 0.3s ease;
}

.btn:hover i {
    transform: scale(1.1);
}

/* ===== ANIMATIONS MODERNES ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== EFFETS DE CHARGEMENT ===== */
.loading {
    animation: pulse 2s infinite;
}

.fade-in {
    animation: fadeInUp 0.6s ease-out;
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

.btn-logout {
    background: var(--danger);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: #DC2626;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* ===== VIEW HEADER ===== */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.view-title-section {
    flex: 1;
    min-width: 200px;
}

.view-actions-section {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

.page-title {
    font-size: 32px;
    color: white;
    margin-bottom: 25px;
    font-weight: 700;
}

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

.filter-bar {
    margin-bottom: 25px;
}

.filter-select {
    padding: 10px 16px;
    border: 2px solid white;
    border-radius: 10px;
    background: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    min-width: 200px;
}

/* ===== DASHBOARD ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--white);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--gray-100);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

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

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.stat-card h3 {
    font-size: 18px;
    color: var(--gray-700);
    margin-bottom: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-200);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--gray-600);
    font-size: 14px;
}

.stat-value {
    font-weight: 600;
    font-size: 16px;
}

/* ===== CLASSES MANAGEMENT ===== */
.classes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.class-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s;
    text-align: center;
}

.class-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.class-header {
    margin-bottom: 20px;
}

.class-header i {
    margin-bottom: 15px;
}

.class-header h3 {
    font-size: 20px;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.class-header p {
    color: var(--gray-600);
    font-size: 14px;
}

.class-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-top: 15px;
}

.class-actions .btn-sm {
    flex: 1;
    min-width: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

/* ===== STUDENTS GRID ===== */
.students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.student-card {
    background: var(--white);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--gray-100);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.student-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

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

.student-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.student-card:hover::after {
    opacity: 1;
}

.student-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.student-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 24px;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
    border: 3px solid var(--white);
    position: relative;
    transition: all 0.3s ease;
}

.student-avatar:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.student-avatar::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: var(--gradient-primary);
    z-index: -1;
    opacity: 0.2;
}

.student-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.student-info h4 {
    font-size: 16px;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.student-info p {
    font-size: 13px;
    color: var(--gray-600);
}

.student-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-top: 12px;
}

    .student-actions .btn-sm {
        flex: 1;
        min-width: 0;
        font-size: 13px;
        padding: 6px 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-height: 32px;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        font-weight: 500;
    }
    
    .student-actions .btn-sm i {
        font-size: 13px;
        margin-right: 2px;
    }

/* ===== GALLERY ===== */
.gallery-by-class {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.gallery-class-section {
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(10px);
    animation: slideInFromBottom 0.5s ease-out;
}

.gallery-class-title {
    color: white;
    font-size: 28px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 15px;
    border-bottom: 3px solid rgba(255,255,255,0.3);
}

.gallery-class-title i {
    color: var(--warning);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
}

.gallery-item {
    background: white;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.gallery-avatar {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 12px;
    overflow: hidden;
}

.gallery-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.gallery-average {
    font-size: 12px;
    color: var(--gray-600);
}

/* ===== ASSIGNMENTS ===== */
.assignments-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.assignment-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 1px solid var(--gray-200);
}

.assignment-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.assignment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.assignment-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.assignment-icon {
    font-size: 20px;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--gray-50);
    border-radius: 10px;
}

.assignment-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--gray-600);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-item i {
    color: var(--primary);
    font-size: 12px;
}

.assignment-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.assignment-actions .btn-sm {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.assignment-actions .btn-sm span {
    font-weight: 500;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: white;
    border: none;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-edit {
    background: var(--info);
    color: white;
    border: none;
}

.btn-edit:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-delete {
    background: var(--danger);
    color: white;
    border: none;
}

.btn-delete:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.assignment-title h3 {
    font-size: 20px;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.assignment-meta {
    font-size: 13px;
    color: var(--gray-600);
}

.assignment-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}

.type-pratique {
    background: #D1FAE5;
    color: #065F46;
}

.type-theorique {
    background: #DBEAFE;
    color: #1E40AF;
}

.type-mixte {
    background: #E9D5FF;
    color: #6B21A8;
}

.assignment-actions {
    display: flex;
    gap: 10px;
}

.assignment-subparts {
    border-top: 1px solid var(--gray-200);
    padding-top: 15px;
    margin-top: 15px;
}

.subpart-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

/* ===== STATISTICS - ACCORDIONS ===== */
.stat-accordion {
    background: white;
    border-radius: 10px;
    margin-bottom: 15px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.stat-accordion:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.stat-accordion-header {
    padding: 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    transition: background 0.3s;
}

.stat-accordion-header:hover {
    background: var(--gray-50);
}

.stat-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background: var(--gray-50);
    padding: 0 20px;
}

/* ===== RANKING ===== */
.stats-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ranking-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: var(--gray-50);
    border-radius: 10px;
}

.ranking-position {
    font-size: 20px;
    font-weight: 700;
    width: 40px;
}

.rank-1 { color: #F59E0B; }
.rank-2 { color: #9CA3AF; }
.rank-3 { color: #CD7F32; }

.ranking-student {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.ranking-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
}

.ranking-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ranking-score {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

/* ===== BACKUP ===== */
.backup-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.backup-card {
    background: white;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.backup-card i {
    color: var(--primary);
    margin-bottom: 20px;
}

.backup-card h2 {
    font-size: 22px;
    margin-bottom: 12px;
}

.backup-card p {
    color: var(--gray-600);
    margin-bottom: 25px;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 24px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 30px;
    animation: modalFadeIn 0.3s ease-out;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--gray-100);
    backdrop-filter: blur(10px);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 30px;
    color: var(--gray-600);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

/* ===== LOADING ===== */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

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

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.toast-error {
    border-left: 4px solid var(--danger);
}

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

/* ===== ANIMATIONS ===== */
@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-class-section:nth-child(1) { animation-delay: 0.1s; }
.gallery-class-section:nth-child(2) { animation-delay: 0.2s; }
.gallery-class-section:nth-child(3) { animation-delay: 0.3s; }
.gallery-class-section:nth-child(4) { animation-delay: 0.4s; }
.gallery-class-section:nth-child(5) { animation-delay: 0.5s; }
.gallery-class-section:nth-child(6) { animation-delay: 0.6s; }

/* ===== RESPONSIVE ===== */
@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== TABLETTE STYLES (768px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-content {
        padding: 20px 15px;
    }
    
    .navbar {
        padding: 0 20px;
        height: 70px;
    }
    
    .navbar-brand {
        font-size: 22px;
    }
    
    .navbar-brand i {
        font-size: 28px;
    }
    
    .nav-item {
        padding: 12px 18px;
        font-size: 13px;
    }
    
    .students-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 18px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 18px;
    }
    
    .classes-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 18px;
    }
    
    .assignments-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 18px;
    }
    
    .student-card {
        padding: 20px;
    }
    
    .student-avatar {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }
    
    .student-info h4 {
        font-size: 15px;
    }
    
    .student-info p {
        font-size: 12px;
    }
    
    .btn-sm {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    .page-title {
        font-size: 28px;
        margin-bottom: 25px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 18px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-number {
        font-size: 28px;
    }
    
    .stat-label {
        font-size: 13px;
    }
    
    .modal {
        width: 90%;
        max-width: 800px;
    }
    
    .modal-content {
        padding: 25px;
    }
    
    .modal h2 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    .form-group label {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .form-control {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    .btn-sm {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .gallery-class-title {
        font-size: 22px;
        margin-bottom: 20px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
    }
    
    .gallery-item {
        padding: 12px;
        min-height: 100px;
    }
    
    .gallery-item img {
        width: 60px;
        height: 60px;
    }
    
    .gallery-item h4 {
        font-size: 13px;
        margin: 6px 0 3px;
    }
    
    .gallery-item p {
        font-size: 10px;
    }
}

/* ===== MOBILE STYLES (max-width: 768px) ===== */
@media (max-width: 768px) {
    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .view-title-section {
        width: 100%;
    }
    
    .view-actions-section {
        width: 100%;
        justify-content: flex-start;
    }
    
    .class-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .class-actions .btn-sm {
        width: 100%;
        min-width: auto;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    /* Amélioration des cartes de devoirs sur mobile */
    .assignment-card {
        padding: 20px;
        margin-bottom: 15px;
    }
    
    .assignment-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .assignment-title h3 {
        font-size: 18px;
        line-height: 1.3;
        margin-bottom: 10px;
    }
    
    .assignment-meta {
        font-size: 13px;
        line-height: 1.4;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .assignment-meta i {
        margin-right: 4px;
    }
    
    .assignment-actions {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }
    
    .assignment-actions .btn-sm {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .assignment-subparts {
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid var(--gray-200);
    }
    
    .subpart-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 8px 0;
    }
    
    .subpart-item span:first-child {
        font-weight: 500;
        color: var(--gray-700);
    }
    
    .subpart-item span:last-child {
        font-size: 12px;
        color: var(--gray-500);
        background: var(--gray-100);
        padding: 2px 6px;
        border-radius: 4px;
    }
}

/* ===== TABLETTE STYLES (768px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
    .view-header {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .view-title-section {
        flex: 1;
        min-width: 200px;
    }
    
    .view-actions-section {
        display: flex;
        align-items: center;
        gap: 15px;
        flex-wrap: wrap;
    }
    
    .view-actions-section .btn {
        min-height: 44px;
        padding: 12px 18px;
        font-size: 13px;
        white-space: nowrap;
        margin: 3px;
    }
    
    /* Cartes de classe - boutons en ligne */
    .class-actions {
        display: flex;
        flex-direction: row;
        gap: 12px;
        justify-content: center;
        align-items: center;
        flex-wrap: wrap;
    }
    
    .class-actions .btn-sm {
        flex: 1;
        min-width: 100px;
        padding: 10px 16px;
        font-size: 12px;
        min-height: 44px;
        margin: 2px;
    }
    
    /* Cartes d'élèves - boutons optimisés */
    .student-actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-start;
        margin-top: 10px;
    }
    
    .student-actions .btn-sm {
        flex: 1;
        min-width: 75px;
        padding: 6px 10px;
        font-size: 12px;
        min-height: 34px;
        margin: 1px;
        border-radius: 6px;
        gap: 3px;
        font-weight: 500;
    }
    
    /* Optimisation supplémentaire pour les boutons d'élèves */
    .student-actions .btn-sm i {
        font-size: 13px;
        margin-right: 2px;
    }
    
    /* Réduire l'espacement entre les cartes d'élèves */
    .students-grid {
        gap: 16px;
    }
    
    /* Grilles optimisées pour tablettes */
    .classes-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 25px;
    }
    
    .students-grid {
        grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
        gap: 20px;
    }
    
    /* Améliorer les interactions tactiles */
    .btn, .btn-sm, .nav-item {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
    }
    
    /* Améliorer la lisibilité */
    .student-info h4 {
        line-height: 1.3;
    }
    
    .student-info p {
        line-height: 1.4;
    }
    
    /* Optimiser les modales pour tablette */
    .modal {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-content {
        max-height: 85vh;
        overflow-y: auto;
    }
    
    /* Améliorer les formulaires */
    .form-control {
        min-height: 44px;
        font-size: 16px; /* Évite le zoom automatique sur iOS */
    }
    
    /* Optimiser les grilles pour tablette */
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    
    .navbar-menu {
        display: flex;
        gap: 6px;
        flex: 1;
        justify-content: center;
        flex-wrap: nowrap;
        align-items: center;
    }
    
    .mobile-menu-toggle {
        display: none;
    }
    
    /* Bouton de déconnexion optimisé pour tablette */
    .btn-logout {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 16px !important;
        background: var(--danger) !important;
        color: var(--white) !important;
        border: none !important;
        box-shadow: var(--shadow-sm) !important;
        transition: all 0.3s ease !important;
        margin-left: 8px !important;
    }
    
    .btn-logout:hover {
        background: var(--danger-dark) !important;
        transform: translateY(-2px) !important;
        box-shadow: var(--shadow-md) !important;
    }
    
    .btn-logout i {
        margin: 0 !important;
        font-size: 16px !important;
    }
    
    /* Masquer le texte du bouton de déconnexion sur tablette */
    .btn-logout span {
        display: none !important;
    }
    
    /* Versions raccourcies des textes de menu pour économiser l'espace */
    .navbar-menu .nav-item span {
        font-size: 11px;
    }
    
    /* Si l'espace est vraiment limité, masquer certains textes et garder seulement les icônes */
    @media (max-width: 900px) and (min-width: 769px) {
        .navbar-menu .nav-item span {
            display: none;
        }
        
        .navbar-menu .nav-item {
            width: 40px;
            height: 40px;
            padding: 8px;
            border-radius: 50%;
            justify-content: center;
        }
        
        .navbar-menu .nav-item i {
            margin: 0;
            font-size: 14px;
        }
    }
    
    .navbar-menu .nav-item {
        background: transparent;
        border: none;
        padding: 10px 12px;
        border-radius: 10px;
        cursor: pointer;
        color: var(--gray-700);
        font-weight: 500;
        font-size: 12px;
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;
        text-decoration: none;
        z-index: 1;
        display: flex;
        align-items: center;
        gap: 4px;
        white-space: nowrap;
    }
    
    .navbar-menu .nav-item:hover {
        background: var(--gray-100);
        color: var(--primary);
        transform: translateY(-2px);
        box-shadow: var(--shadow-sm);
    }
    
    .navbar-menu .nav-item.active {
        background: var(--gradient-primary);
        color: var(--white);
        box-shadow: var(--shadow-md);
        font-weight: 600;
    }
    
    .page-title {
        font-size: 24px;
    }
}

/* ===== MOBILE MENU (écrans plus petits) ===== */
@media (max-width: 900px) {
    .navbar-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        box-shadow: var(--shadow-lg);
        flex-direction: column;
        padding: 20px;
        gap: 10px;
        z-index: 1000;
        border-radius: 0 0 12px 12px;
        border: 1px solid var(--gray-200);
    }
    
    .navbar-menu.active {
        display: flex;
    }
    
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 20px;
        color: var(--gray-700);
        cursor: pointer;
        padding: 10px;
        border-radius: 8px;
        transition: all 0.3s ease;
    }
    
    .mobile-menu-toggle:hover {
        background: var(--gray-100);
        color: var(--primary);
    }
    
    .navbar-menu .nav-item {
        width: 100%;
        justify-content: flex-start;
        padding: 15px;
        border-radius: 8px;
        background: transparent;
        color: var(--gray-700);
        font-weight: 500;
        transition: all 0.3s ease;
        position: relative;
        z-index: 1;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .navbar-menu .nav-item:hover {
        background: var(--gray-100);
        color: var(--primary);
        transform: translateX(5px);
    }
    
    .navbar-menu .nav-item.active {
        background: var(--primary);
        color: var(--white);
    }
    
    .students-grid, .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .classes-grid {
        grid-template-columns: 1fr;
    }
    
    .view-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .view-header > div {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .view-header button {
        width: 100%;
    }
    
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: 10px;
        position: relative;
    }
    
    .navbar-brand {
        font-size: 18px;
    }
    
    .btn-logout {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .gallery-class-title {
        font-size: 20px;
    }
}