/* Reset et styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Page de connexion élève */
.student-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-wrapper {
    width: 100%;
    max-width: 500px;
    padding: 2rem;
}

.login-card {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-card h1 {
    text-align: center;
    color: #2c3e50;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 2rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input.invalid {
    border-color: #e74c3c;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-large {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
}

/* Messages */
.error-message {
    padding: 1rem;
    background-color: #fee;
    color: #c33;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #c33;
}

.help-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.help-text {
    color: #7f8c8d;
    font-size: 0.875rem;
    margin: 0.25rem 0;
}

/* Navigation élève */
.student-nav {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-brand {
    font-size: 1.75rem;
    font-weight: bold;
}

.nav-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.student-names {
    display: flex;
    gap: 0.5rem;
}

.student-badge {
    background: rgba(255,255,255,0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-link {
    background: rgba(255,255,255,0.1);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    transition: background 0.3s;
}

.nav-link:hover {
    background: rgba(255,255,255,0.2);
}

.nav-link.active {
    background: rgba(255,255,255,0.3);
    font-weight: 600;
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

/* Dashboard Layout */
.dashboard-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.main-content h1 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 2rem;
}

/* Quiz Grid */
/* Category Section */
.category-section {
    margin-bottom: 3rem;
}

.category-title {
    font-size: 1.75rem;
    color: #667eea;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid #667eea;
}

.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

.quiz-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

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

.quiz-card.completed {
    border: 2px solid #27ae60;
}

.quiz-card img,
.quiz-placeholder {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
}

.quiz-card-content {
    padding: 1.25rem;
}

.quiz-card h3 {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 0.75rem;
}

.quiz-description {
    display: none;
    color: #7f8c8d;
    margin-bottom: 1rem;
    min-height: 3rem;
}

.quiz-points {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 1rem;
}

/* Quiz Status */
.quiz-status {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.completed-status {
    background-color: #d4edda;
    border-left: 4px solid #27ae60;
}

.completed-status strong {
    color: #27ae60;
    display: block;
    margin-bottom: 0.5rem;
}

.partial-status {
    background-color: #fff3cd;
    border-left: 4px solid #f39c12;
}

.partial-status strong {
    color: #f39c12;
    display: block;
    margin-bottom: 0.5rem;
}

.completed-by,
.not-completed-by {
    margin: 0.25rem 0;
    font-size: 0.85rem;
}

.completed-by {
    color: #27ae60;
}

.not-completed-by {
    color: #e67e22;
}

/* Leaderboard Page */
.leaderboard-page {
    min-height: calc(100vh - 100px);
    background: #f5f5f5;
    padding: 2rem 0;
}

.leaderboard-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
}

.leaderboard-container h1 {
    text-align: center;
    color: #2c3e50;
    font-size: 2.5rem;
    margin-bottom: 2rem;
}

.leaderboard-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.leaderboard-card h2 {
    color: #2c3e50;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid #667eea;
}

.leaderboard-card.current-position {
    border: 3px solid #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.leaderboard-list-large {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.leaderboard-item-large {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    transition: all 0.3s;
}

.leaderboard-item-large:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.leaderboard-item-large.current {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border: 2px solid #667eea;
    font-weight: 600;
}

.leaderboard-item-large.gold {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    font-weight: bold;
}

.leaderboard-item-large.silver {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
    font-weight: bold;
}

.leaderboard-item-large.bronze {
    background: linear-gradient(135deg, #cd7f32 0%, #d4a574 100%);
    font-weight: bold;
    color: white;
}

.rank-large {
    font-size: 1.8rem;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
}

.name-large {
    flex: 1;
    font-size: 1.2rem;
}

.points-large {
    font-size: 1.3rem;
    font-weight: 700;
    color: #667eea;
}

.leaderboard-item-large.bronze .points-large {
    color: white;
}

.back-button-container {
    text-align: center;
    margin-top: 2rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* Welcome Section & Level System */
.welcome-section {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.15);
    margin-bottom: 3rem;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.welcome-section h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 2rem;
    text-align: left;
}

.level-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 2rem;
    border: none;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.level-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.level-info {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.level-emoji {
    font-size: 5rem;
    line-height: 1;
    background: rgba(255,255,255,0.2);
    padding: 1rem;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}

.level-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.level-name {
    font-size: 1.8rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.level-points {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.9);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.level-points::before {
    content: '⭐';
    font-size: 1.4rem;
}

.level-progress {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.progress-bar {
    width: 100%;
    height: 28px;
    background: rgba(255,255,255,0.25);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.2);
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255,255,255,0.3);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    background-size: 200% 100%;
    border-radius: 12px;
    transition: width 1s ease-out;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.5);
    position: relative;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.3), transparent);
    border-radius: 12px 12px 0 0;
}

.progress-text {
    font-size: 1rem;
    color: white;
    text-align: center;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.max-level-badge {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    background-size: 200% 200%;
    color: #8B4513;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: bold;
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.5), inset 0 2px 4px rgba(255,255,255,0.5);
    animation: pulse 2s infinite, shimmer 3s infinite;
    position: relative;
    z-index: 1;
}

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

/* Guest Mode */
.guest-notice {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #f39c12;
    color: #856404;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    text-align: center;
}

.guest-notice strong {
    display: block;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #f39c12;
}

.guest-notice p {
    margin: 0.5rem 0;
}

.guest-notice a {
    color: #667eea;
    text-decoration: underline;
    font-weight: 600;
}

.guest-warning {
    display: inline-block;
    background: #fff3cd;
    color: #856404;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border-left: 4px solid #f39c12;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .leaderboard-container {
        padding: 0 1rem;
    }
}

@media (max-width: 768px) {
    .student-nav {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-info {
        flex-direction: column;
        width: 100%;
    }

    .student-names {
        flex-wrap: wrap;
        justify-content: center;
    }

    .dashboard-container {
        padding: 0 1rem;
    }

    .quiz-grid {
        grid-template-columns: 1fr;
    }

    .login-wrapper {
        padding: 1rem;
    }

    .login-card {
        padding: 2rem;
    }

    .welcome-section {
        padding: 1.5rem;
    }

    .welcome-section h1 {
        font-size: 1.8rem;
        text-align: left;
    }

    .level-emoji {
        font-size: 3.5rem;
        padding: 0.75rem;
    }

    .level-name {
        font-size: 1.3rem;
    }

    .level-points {
        font-size: 1rem;
    }

    .level-card {
        padding: 1.5rem;
    }

    .level-info {
        gap: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .progress-bar {
        height: 24px;
    }

    .max-level-badge {
        font-size: 1.1rem;
        padding: 1.2rem;
    }
}
