/* quiz.css - Premium Glassmorphism Dark Mode Styles for Exam Engine */

:root {
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(255, 255, 255, 0.1);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --review: #8b5cf6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

body.dark-theme {
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Base Glassmorphism Class */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
}

/* Header removed, using global .navbar from shared.css */

.exam-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Screens */
.screen {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 0 1.5rem 1.5rem;
}
.screen.active {
    display: flex;
    flex-direction: column;
}

#loading-screen {
    align-items: center;
    justify-content: center;
}

.loader {
    border: 4px solid var(--panel-border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Main Exam Layout */
.exam-container {
    display: flex;
    gap: 1.5rem;
    height: 100%;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
}

.ad-container {
    margin-bottom: 1.5rem;
    min-height: 90px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.question-panel {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.status-panel {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Question Area */
.question-header {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    font-weight: 600;
}

.q-marks {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.question-content {
    font-size: 1.2rem;
    line-height: 1.6;
    padding: 1.5rem;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
}

/* Options */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-label:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
}

.option-label input[type="radio"] {
    margin-right: 1rem;
    transform: scale(1.2);
    accent-color: var(--primary);
}

.option-label.selected {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
}

/* Actions */
.action-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    gap: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

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

.btn-secondary { background: var(--review); color: white; }
.btn-secondary:hover { background: #7c3aed; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-outline { 
    background: transparent; 
    border: 1px solid var(--text-muted); 
    color: var(--text-main); 
}

.btn-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    color: var(--warning);
}
.btn-warning:hover {
    background: var(--warning);
    color: #fff;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}
.btn-outline:hover { background: rgba(255,255,255,0.1); }

/* Status Panel (Right Side) */
.timer-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--danger);
}

.palette-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    font-size: 0.9rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.badge.answered { background: var(--success); }
.badge.not-answered { background: var(--danger); }
.badge.review { background: var(--review); }
.badge.not-visited { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); }

.palette-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem;
    background: transparent;
    border: none;
    overflow-y: auto;
    max-height: calc(100vh - 300px);
}

.palette-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
    margin-bottom: -0.5rem;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.5px;
}

.palette-section-title.active {
    color: var(--primary);
    border-color: var(--primary);
}

.palette-grid-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.5rem;
}

.pal-btn {
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.pal-btn.answered { background: var(--success); color: white; }
.pal-btn.not-answered { background: var(--danger); color: white; }
.pal-btn.review { background: var(--review); color: white; }

/* Result Screen */
.result-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    text-align: center; /* Centers the Exam Completed heading naturally */
}

.detailed-stats-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.1);
    margin-top: 2rem;
    width: 100%;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.score-value {
    font-size: 3.5rem;
    font-weight: 900;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, #8b5cf6, #f43f5e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}
.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    font-family: 'Outfit', sans-serif;
}
.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
}
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }

/* Review List */
.review-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
    text-align: left;
}

.review-q { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; }

.review-opt {
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    border: 1px solid var(--panel-border);
}

.review-opt.correct { background: rgba(16, 185, 129, 0.2); border-color: var(--success); }
.review-opt.incorrect { background: rgba(239, 68, 68, 0.2); border-color: var(--danger); }

.explanation-box {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--primary);
    border-radius: 4px;
}

.mt-4 { margin-top: 1.5rem; }
.text-center { text-align: center; }

@media (max-width: 1024px) {
    .exam-container {
        flex-direction: column;
    }
    .status-panel {
        min-width: 100%;
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .action-buttons {
        flex-wrap: wrap;
    }
    .btn {
        flex: 1 1 100%;
        margin-bottom: 0.5rem;
    }
    .palette-container {
        max-height: 180px;
        overflow-y: auto;
    }
    body.dark-theme {
        height: auto;
        overflow: auto;
    }
    
    .navbar {
        flex-wrap: wrap;
        padding: 1rem;
        gap: 1rem;
        justify-content: center;
    }
    .exam-title {
        display: none; 
    }
    .nav-links {
        width: 100%;
        justify-content: space-between;
        gap: 0.5rem !important;
    }
    .nav-links .btn {
        flex: 1;
        margin-bottom: 0;
    }

    .detailed-stats-card {
        grid-template-columns: 1fr 1fr;
        padding: 1rem;
        gap: 1rem;
    }
    .detailed-stats-card .stat-box:first-child {
        grid-column: 1 / -1; 
    }
    .score-value {
        font-size: 2.5rem !important; 
    }
}

/* Section Tabs */
.section-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.5rem;
    overflow-x: auto;
}

.section-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--text-main);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.section-tab.active {
    background: var(--primary-dim);
    color: var(--primary);
    border-color: var(--primary);
}

.section-tab:hover:not(.active) {
    background: rgba(255,255,255,0.05);
}
