/* ========================================
   QUIZ DU JOUR - STYLES
   ======================================== */

/* Variables */
:root {
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --bg-light: #1a1a24;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    
    /* Aurora colors */
    --aurora-cyan: #00d9ff;
    --aurora-purple: #a855f7;
    --aurora-pink: #ec4899;
    --aurora-green: #10b981;
    
    /* Quiz colors */
    --correct: #10b981;
    --incorrect: #ef4444;
    --selected: #3b82f6;
    --timer-full: #10b981;
    --timer-mid: #eab308;
    --timer-low: #ef4444;
    
    --font-main: 'Inter', sans-serif;
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-main);
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ========================================
   BACKGROUND
   ======================================== */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

.floating-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--aurora-cyan);
    top: -100px;
    left: -100px;
    animation: float1 20s ease-in-out infinite;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: var(--aurora-purple);
    bottom: -50px;
    right: -50px;
    animation: float2 25s ease-in-out infinite;
}

.orb-3 {
    width: 200px;
    height: 200px;
    background: var(--aurora-pink);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: float3 15s ease-in-out infinite;
}

@keyframes float1 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(100px, 100px); }
}

@keyframes float2 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-80px, -80px); }
}

@keyframes float3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.3); }
}

/* ========================================
   GAME WRAPPER
   ======================================== */
.game-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 600px;
    margin: 0 auto;
    padding: 10px;
}

/* ========================================
   HEADER
   ======================================== */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--aurora-cyan);
}

.game-logo {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--aurora-cyan), var(--aurora-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.icon-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    transition: var(--transition);
}

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

/* ========================================
   SCREENS
   ======================================== */
.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.screen.hidden {
    display: none;
}

/* ========================================
   MENU SCREEN
   ======================================== */
.menu-screen {
    justify-content: flex-start;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.menu-content {
    text-align: center;
    max-width: 450px;
    width: 100%;
}

.title-glow {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--aurora-cyan), var(--aurora-purple), var(--aurora-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    text-shadow: 0 0 40px rgba(0, 217, 255, 0.3);
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1rem;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.btn-primary, .btn-secondary {
    padding: 15px 30px;
    border: none;
    border-radius: var(--border-radius);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--aurora-cyan), var(--aurora-purple));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 217, 255, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: #2a2a3a;
}

.btn-primary small, .btn-secondary small {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.8;
}

.btn-glow {
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 217, 255, 0.3); }
    50% { box-shadow: 0 0 40px rgba(0, 217, 255, 0.5); }
}

/* Instructions */
.instructions {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    text-align: left;
}

.instructions h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--aurora-cyan);
}

.instruction-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.instruction {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.instruction .icon {
    font-size: 1.2rem;
    width: 30px;
    text-align: center;
}

/* Leaderboard */
.leaderboard-preview, .leaderboard-full {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: left;
}

.leaderboard-preview h3, .leaderboard-full h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--aurora-purple);
    text-align: center;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-light);
    border-radius: 8px;
    font-size: 0.9rem;
}

.leaderboard-item.highlight {
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.2), rgba(168, 85, 247, 0.2));
    border: 1px solid var(--aurora-cyan);
}

.leaderboard-rank {
    font-weight: 700;
    min-width: 30px;
    color: var(--aurora-cyan);
}

.leaderboard-rank.gold { color: #ffd700; }
.leaderboard-rank.silver { color: #c0c0c0; }
.leaderboard-rank.bronze { color: #cd7f32; }

.leaderboard-name {
    flex: 1;
    font-weight: 500;
}

.leaderboard-score {
    font-weight: 600;
    color: var(--correct);
}

.leaderboard-correct {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 5px;
}

.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}

/* ========================================
   GAME SCREEN
   ======================================== */
.game-screen {
    padding: 10px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.game-mode-indicator {
    display: flex;
    gap: 10px;
    font-size: 0.85rem;
}

#modeLabel {
    color: var(--aurora-cyan);
    font-weight: 500;
}

#quizNumber {
    color: var(--aurora-purple);
    font-weight: 600;
}

.question-progress {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
}

#questionCounter {
    color: var(--text-secondary);
}

#currentScore {
    color: var(--correct);
    font-weight: 600;
}

/* Timer */
.timer-container {
    position: relative;
    height: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    margin-bottom: 20px;
    overflow: hidden;
}

.timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--aurora-cyan), var(--aurora-green));
    border-radius: 4px;
    transition: width 0.1s linear;
}

.timer-bar.warning {
    background: linear-gradient(90deg, var(--timer-mid), #f97316);
}

.timer-bar.danger {
    background: linear-gradient(90deg, var(--timer-low), #dc2626);
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.timer-text {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    text-shadow: 0 0 5px rgba(0,0,0,0.5);
}

/* Category Badge */
.category-badge {
    display: inline-block;
    padding: 6px 16px;
    background: linear-gradient(135deg, var(--aurora-purple), var(--aurora-pink));
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}

/* Question */
.question-container {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 25px 20px;
    margin-bottom: 20px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-text {
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.5;
}

/* Answers */
.answers-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.answer-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.answer-btn:hover:not(:disabled) {
    border-color: var(--aurora-cyan);
    background: rgba(0, 217, 255, 0.1);
    transform: translateX(5px);
}

.answer-btn:disabled {
    cursor: not-allowed;
}

.answer-btn.selected {
    border-color: var(--selected);
    background: rgba(59, 130, 246, 0.2);
}

.answer-btn.correct {
    border-color: var(--correct);
    background: rgba(16, 185, 129, 0.2);
    animation: correctPulse 0.5s ease;
}

.answer-btn.incorrect {
    border-color: var(--incorrect);
    background: rgba(239, 68, 68, 0.2);
    animation: shake 0.5s ease;
}

.answer-btn.show-correct {
    border-color: var(--correct);
    background: rgba(16, 185, 129, 0.2);
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.answer-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--aurora-cyan), var(--aurora-purple));
    border-radius: 50%;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.answer-btn.correct .answer-letter {
    background: var(--correct);
}

.answer-btn.incorrect .answer-letter {
    background: var(--incorrect);
}

.answer-text {
    flex: 1;
    line-height: 1.4;
}

/* Feedback */
.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 30px 50px;
    text-align: center;
    z-index: 100;
    animation: feedbackIn 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.feedback.hidden {
    display: none;
}

@keyframes feedbackIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.feedback-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.feedback-text {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.feedback.correct .feedback-text {
    color: var(--correct);
}

.feedback.incorrect .feedback-text {
    color: var(--incorrect);
}

.feedback-points {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--aurora-cyan), var(--aurora-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   RESULT SCREEN
   ======================================== */
.result-screen {
    padding: 20px;
    overflow-y: auto;
}

.result-content {
    text-align: center;
}

.result-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--aurora-cyan), var(--aurora-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-subtitle {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Score Display */
.score-display {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 20px;
}

.score-big {
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--aurora-cyan), var(--aurora-purple), var(--aurora-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.score-label {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.score-details {
    font-size: 1rem;
    color: var(--correct);
    font-weight: 600;
}

/* Result Summary */
.result-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: var(--bg-card);
    border-radius: 8px;
    text-align: left;
}

.result-item.correct {
    border-left: 4px solid var(--correct);
}

.result-item.incorrect {
    border-left: 4px solid var(--incorrect);
}

.result-item-icon {
    font-size: 1.5rem;
}

.result-item-content {
    flex: 1;
}

.result-item-question {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.result-item-answer {
    font-weight: 600;
}

.result-item.correct .result-item-answer {
    color: var(--correct);
}

.result-item.incorrect .result-item-answer {
    color: var(--incorrect);
}

.result-item-correct-answer {
    font-size: 0.85rem;
    color: var(--correct);
    margin-top: 3px;
}

.result-item-points {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--aurora-cyan);
}

/* Save Score Form */
.save-score-form {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

.save-score-form.hidden {
    display: none;
}

.pseudo-input {
    padding: 12px 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: var(--bg-light);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    width: 180px;
    transition: var(--transition);
}

.pseudo-input:focus {
    outline: none;
    border-color: var(--aurora-cyan);
}

.save-score-form .btn-primary {
    padding: 12px 20px;
    flex-direction: row;
}

.save-status {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 15px;
    min-height: 20px;
}

.save-status.success { color: var(--correct); }
.save-status.error { color: var(--incorrect); }

.result-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.result-actions .btn-primary,
.result-actions .btn-secondary {
    padding: 12px 25px;
    flex-direction: row;
}

/* ========================================
   MODALS
   ======================================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 30px;
    max-width: 450px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    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: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal h2 {
    text-align: center;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--aurora-cyan), var(--aurora-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal h3 {
    text-align: center;
    margin: 20px 0 15px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.modal p {
    color: var(--text-secondary);
    margin-bottom: 15px;
    text-align: center;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stat-box {
    background: var(--bg-light);
    padding: 15px 10px;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--aurora-cyan);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Category Stats */
.category-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cat-stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-light);
    border-radius: 8px;
}

.cat-stat-icon {
    font-size: 1.2rem;
}

.cat-stat-name {
    flex: 1;
    font-weight: 500;
}

.cat-stat-value {
    font-weight: 600;
    color: var(--correct);
}

/* Help */
.help-section {
    background: var(--bg-light);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: left;
}

.help-section h4 {
    color: var(--aurora-cyan);
    margin-bottom: 10px;
}

.help-section ul {
    list-style: none;
    padding-left: 0;
}

.help-section li {
    color: var(--text-secondary);
    padding: 5px 0;
    padding-left: 20px;
    position: relative;
    font-size: 0.9rem;
}

.help-section li::before {
    content: "•";
    color: var(--aurora-purple);
    position: absolute;
    left: 0;
}

.categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.cat-tag {
    padding: 5px 12px;
    background: var(--bg-card);
    border-radius: 15px;
    font-size: 0.8rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 500px) {
    .title-glow {
        font-size: 1.6rem;
    }
    
    .question-text {
        font-size: 1rem;
    }
    
    .answer-btn {
        padding: 14px 15px;
        font-size: 0.9rem;
    }
    
    .answer-letter {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    .score-big {
        font-size: 3rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-height: 700px) {
    .question-container {
        padding: 20px 15px;
        min-height: 80px;
    }
    
    .answer-btn {
        padding: 12px 15px;
    }
    
    .timer-container {
        margin-bottom: 15px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: #2a2a3a;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a3a4a;
}

/* Animation utilities */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-up {
    animation: slideUp 0.3s ease;
}
