/**
 * Components Stylesheet: Question cards, Visualizers, Feedback boxes, Dashboard, Modals & Review Section
 */

/* Game Topbar */
.game-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
    gap: 16px;
}

.btn-icon {
    background: #F0F4FF;
    border: none;
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: #DCE5FF;
}

.game-progress-wrapper {
    flex: 1;
}

.game-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #495057;
}

.game-part-tag {
    color: var(--primary);
}

.progress-track {
    width: 100%;
    height: 10px;
    background: #E9ECEF;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4361EE, #4CC9F0);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.game-stats-pill {
    display: flex;
    align-items: center;
    gap: 8px;
}

.exam-status-pill {
    font-size: 13px;
    font-weight: 700;
    color: #4361EE;
    background: #EEF4FF;
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid #DCE5FF;
}

/* Question Container */
.question-container {
    background: white;
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--card-border);
}

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

.question-meta-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.question-points-badge {
    display: inline-block;
    background: #EBFBEE;
    color: #2B8A3E;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
}

.question-order-badge {
    display: inline-block;
    background: #F1F3F5;
    color: #495057;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
}

.question-title {
    font-size: 19px;
    font-weight: 700;
    color: #212529;
    line-height: 1.5;
}

/* Visualizer Wrapper */
.visualizer-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 16px 0 24px 0;
    background: #F8FAFD;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px dashed #CAD9EE;
}

.visual-card {
    text-align: center;
}

.visual-svg {
    max-width: 100%;
    height: auto;
}

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.option-card {
    display: flex;
    align-items: center;
    background: #F8F9FA;
    border: 2px solid #E9ECEF;
    border-radius: var(--radius-md);
    padding: 14px 18px;
    font-size: 16px;
    color: #343A40;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    font-family: inherit;
    position: relative;
}

.option-card:hover {
    background: #EEF4FF;
    border-color: #A0C4FF;
    transform: translateX(4px);
}

.option-letter {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    background: #E2E8F0;
    color: #475569;
    border-radius: 50%;
    font-weight: 700;
    margin-right: 14px;
    flex-shrink: 0;
}

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

.option-check-icon {
    font-size: 18px;
    margin-left: 10px;
    color: #888;
}

/* Selected Option during Exam (No spoiler of right/wrong) */
.option-selected {
    background: #EFF6FF !important;
    border-color: #3B82F6 !important;
    color: #1D4ED8 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.option-selected .option-letter {
    background: #3B82F6 !important;
    color: white !important;
}

.option-selected .option-check-icon {
    color: #3B82F6 !important;
}

/* Game Navigation Controls */
.game-nav-bar {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-top: 10px;
}

.btn-nav {
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-prev {
    background: #F1F3F5;
    color: #495057;
}

.btn-prev:hover:not(:disabled) {
    background: #E9ECEF;
}

.btn-next-step {
    flex: 1;
    background: linear-gradient(135deg, #4361EE, #3F37C9);
    color: white;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.btn-next-step:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
}

/* Result Screen */
.screen-result {
    position: relative;
    text-align: center;
}

.confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.result-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 36px 24px;
    box-shadow: var(--shadow-soft);
    border: 2px solid #E8EEFF;
    max-width: 750px;
    margin: 20px auto;
}

.medal-icon {
    font-size: 72px;
    margin-bottom: 12px;
}

.medal-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 6px;
}

.medal-desc {
    font-size: 16px;
    font-weight: 600;
    color: #6C757D;
    margin-bottom: 16px;
}

.result-mode-tag {
    display: inline-block;
    background: #EEF4FF;
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 24px;
}

.score-circle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4361EE, #4CC9F0);
    color: white;
    margin-bottom: 24px;
    box-shadow: 0 10px 25px rgba(67, 97, 238, 0.3);
}

.score-num {
    font-size: 42px;
    font-weight: 900;
    line-height: 1;
}

.score-max {
    font-size: 14px;
    opacity: 0.9;
}

.stats-row {
    display: flex;
    justify-content: space-around;
    background: #F8FAFD;
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 24px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-icon { font-size: 20px; margin-bottom: 4px; }
.stat-val { font-size: 17px; font-weight: 800; color: #212529; }
.stat-lbl { font-size: 12px; color: #6C757D; font-weight: 600; }

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-action {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-review-exam {
    background: linear-gradient(135deg, #4361EE, #7209B7);
    color: white;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.btn-review-exam:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
}

.action-btn-row {
    display: flex;
    gap: 12px;
}

.btn-replay { background: linear-gradient(135deg, #F77F00, #FCBF49); color: white; }
.btn-dash-view { background: linear-gradient(135deg, #38B000, #70E000); color: white; }
.btn-home { background: #E9ECEF; color: #495057; }

/* Exam Review Section */
.exam-review-section {
    margin-top: 32px;
    text-align: left;
    border-top: 2px dashed #E2E8F0;
    padding-top: 24px;
}

.review-section-title {
    margin-bottom: 20px;
    text-align: center;
}

.review-section-title h3 {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}

.review-section-title p {
    font-size: 14px;
    color: #6C757D;
}

.review-questions-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.review-item-card {
    background: #FFFFFF;
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 2px solid #E2E8F0;
}

.item-pass { border-color: #86EFAC; background: #F0FDF4; }
.item-fail { border-color: #FECACA; background: #FEF2F2; }

.review-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.review-q-num {
    font-weight: 800;
    font-size: 16px;
    color: #1E293B;
}

.review-status-tag {
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
}

.review-correct-badge { background: #DCFCE7; color: #166534; }
.review-wrong-badge { background: #FEE2E2; color: #991B1B; }

.review-q-text {
    font-size: 16px;
    font-weight: 600;
    color: #334155;
    line-height: 1.5;
    margin-bottom: 14px;
}

.review-options-display {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.review-opt-row {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14.5px;
    background: white;
    border: 1px solid #E2E8F0;
}

.review-opt-letter {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #E2E8F0;
    font-weight: 700;
    margin-right: 10px;
    flex-shrink: 0;
}

.review-opt-correct {
    background: #DCFCE7;
    border-color: #4ADE80;
    color: #166534;
}

.review-opt-correct .review-opt-letter {
    background: #22C55E;
    color: white;
}

.review-opt-user-wrong {
    background: #FEE2E2;
    border-color: #F87171;
    color: #991B1B;
    text-decoration: line-through;
}

.review-opt-user-wrong .review-opt-letter {
    background: #EF4444;
    color: white;
}

.review-explanation-box {
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: #334155;
    border-left: 4px solid var(--primary);
    box-shadow: inset 0 0 4px rgba(0,0,0,0.02);
}

/* Dashboard Styles */
.screen-dashboard {
    width: 100%;
}

.dash-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dash-topbar h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
}

.dash-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dash-stat-card {
    background: white;
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    text-align: center;
    border: 1px solid var(--card-border);
}

.dash-stat-icon { font-size: 32px; margin-bottom: 8px; display: inline-block; }
.dash-stat-num { font-size: 26px; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.dash-stat-lbl { font-size: 13px; color: #6C757D; font-weight: 600; }

.dash-section-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 24px;
    border: 1px solid var(--card-border);
}

.section-title-row {
    margin-bottom: 6px;
}

.section-title-row h3 {
    font-size: 18px;
    font-weight: 700;
    color: #212529;
}

.section-desc {
    font-size: 14px;
    color: #6C757D;
    margin-bottom: 18px;
}

.topic-bars-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.topic-bar-header {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 6px;
}

.topic-ratio {
    font-weight: 600;
    color: #495057;
}

/* Badges Grid */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.badge-card {
    display: flex;
    align-items: center;
    padding: 14px;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    transition: all 0.2s;
}

.badge-unlocked {
    background: #F0FDF4;
    border-color: #86EFAC;
}

.badge-locked {
    background: #F8FAFC;
    border-color: #E2E8F0;
    opacity: 0.6;
}

.badge-icon {
    font-size: 32px;
    margin-right: 12px;
}

.badge-info {
    flex: 1;
}

.badge-info strong {
    display: block;
    font-size: 14px;
    color: #1E293B;
}

.badge-info small {
    font-size: 12px;
    color: #64748B;
}

.badge-status-tag {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.05);
}

/* Mistakes List */
.empty-mistakes {
    text-align: center;
    padding: 30px;
    color: #2E7D32;
}

.mistakes-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mistake-item {
    background: #FFF9F9;
    border: 1px solid #FFCDD2;
    border-radius: var(--radius-md);
    padding: 16px;
}

.mistake-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.mistake-tag {
    font-size: 12px;
    font-weight: 700;
    background: #FFCDD2;
    color: #C62828;
    padding: 2px 8px;
    border-radius: 6px;
}

.mistake-time {
    font-size: 12px;
    color: #757575;
}

.mistake-q {
    font-size: 15px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 10px;
}

.mistake-answers {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 14px;
    margin-bottom: 10px;
}

.ans-user { color: #D32F2F; }
.ans-correct { color: #2E7D32; }

.mistake-explanation {
    background: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    line-height: 1.5;
    color: #424242;
    border-left: 3px solid #2196F3;
}

.dash-footer {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 30px;
}

.btn-reset-data {
    background: none;
    border: 1px solid #FFCDD2;
    color: #D32F2F;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}

.btn-reset-data:hover {
    background: #FFEBEE;
}

/* Modal Overlay & Content */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 16px;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 580px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

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

.modal-header h2 {
    font-size: 20px;
    color: #212529;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #6C757D;
}

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

.btn-topic-item {
    display: flex;
    align-items: center;
    background: #F8FAFD;
    border: 1.5px solid #DCE5FF;
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-topic-item:hover {
    background: #EEF4FF;
    border-color: var(--primary);
    transform: translateX(4px);
}

.topic-emoji {
    font-size: 30px;
    margin-right: 14px;
    flex-shrink: 0;
}

.topic-desc strong {
    display: block;
    font-size: 15px;
    color: #1A1A24;
    margin-bottom: 3px;
}

.topic-desc small {
    font-size: 12.5px;
    color: #6C757D;
}
