/**
 * VIEW - Styles cho Game Trắc Nghiệm
 */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 800px;
    width: 100%;
    overflow: hidden;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header {
    position: relative;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 30px;
    text-align: center;
    color: white;
}

.sound-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 1.4em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.sound-toggle:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.08);
}

.sound-toggle.muted {
    opacity: 0.8;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.header p {
    font-size: 1.2em;
    opacity: 0.95;
}

.content {
    padding: 40px;
}

.start-screen,
.quiz-screen,
.result-screen {
    display: none;
}

.start-screen.active,
.quiz-screen.active,
.result-screen.active {
    display: block;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Hàng: thanh tiến độ + đồng hồ */
.quiz-header-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.quiz-header-row .progress-bar {
    flex: 1;
    margin-bottom: 0;
}

.quiz-timer {
    flex-shrink: 0;
    min-width: 4em;
    padding: 8px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.25em;
    font-weight: bold;
    text-align: center;
    transition: background 0.3s, color 0.3s;
}

.quiz-timer.timer-warning {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    animation: pulse 1s ease-in-out infinite;
}

.quiz-timer.timer-up {
    background: linear-gradient(135deg, #333 0%, #555 100%);
}

@keyframes pulse {
    50% { opacity: 0.85; transform: scale(1.02); }
}

/* Nút "Câu tiếp theo" ẩn mặc định, View sẽ hiện khi đã chọn đáp án */
.quiz-screen .next-btn {
    display: none;
}

.start-btn,
.next-btn,
.restart-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2em;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    margin: 10px;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.start-btn:hover,
.next-btn:hover,
.restart-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.6);
}

.start-btn:active,
.next-btn:active,
.restart-btn:active {
    transform: translateY(-1px);
}

.question-container {
    margin: 30px 0;
}

.question-number {
    color: #667eea;
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 15px;
}

.question {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 30px;
    line-height: 1.5;
}

.answers {
    display: grid;
    gap: 15px;
}

.answer-btn {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border: 3px solid transparent;
    padding: 20px;
    border-radius: 15px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    color: #333;
}

.answer-btn:hover {
    transform: translateX(10px);
    border-color: #667eea;
    background: linear-gradient(135deg, #e0e7ff 0%, #c3cfe2 100%);
}

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

.answer-btn.correct {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border-color: #11998e;
}

.answer-btn.wrong {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    color: white;
    border-color: #eb3349;
}

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

.progress-bar {
    background: #e0e0e0;
    height: 10px;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 10px;
}

.score-display {
    text-align: center;
    margin: 30px 0;
}

.score-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 auto 30px;
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.score-number {
    font-size: 3em;
    font-weight: bold;
}

.score-text {
    font-size: 1.2em;
}

.message {
    font-size: 1.5em;
    color: #333;
    margin: 20px 0;
}

.emoji {
    font-size: 3em;
    margin: 20px 0;
}

.intro-text {
    font-size: 1.2em;
    line-height: 1.8;
    color: #555;
    margin: 20px 0;
    text-align: center;
}

/* Khối chọn đề thi */
.exam-section {
    margin: 25px 0;
}

.exam-section-title {
    font-size: 1.2em;
    color: #667eea;
    margin-bottom: 15px;
    text-align: center;
}

.exam-list {
    display: grid;
    gap: 12px;
}

.exam-card {
    display: block;
    width: 100%;
    padding: 16px 20px;
    border: 3px solid #e0e0e0;
    border-radius: 15px;
    background: linear-gradient(135deg, #f8f9ff 0%, #e8ecff 100%);
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    font-family: inherit;
}

.exam-card:hover {
    border-color: #667eea;
    background: linear-gradient(135deg, #e8ecff 0%, #d0d8ff 100%);
    transform: translateX(6px);
}

.exam-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.exam-card .exam-name {
    display: block;
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 6px;
}

.exam-card .exam-meta {
    display: block;
    font-size: 0.9em;
    opacity: 0.9;
}

.exam-card.selected .exam-meta {
    opacity: 0.95;
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 30px;
}

@media (max-width: 600px) {
    .header h1 {
        font-size: 1.8em;
    }

    .question {
        font-size: 1.2em;
    }

    .answer-btn {
        padding: 15px;
    }

    .score-circle {
        width: 150px;
        height: 150px;
    }

    .score-number {
        font-size: 2.5em;
    }
}
