/* ============================================
   QUIZMASTER - MODERN CLEAN INTERFACE
   ============================================ */

/* ---- RESET ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    background: #0f172a;
    min-height: 100vh;
    display: flex;
}

.login-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.login-left {
    flex: 1;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    color: white;
}

.brand {
    margin-bottom: 60px;
}

.logo {
    width: 64px;
    height: 64px;
    background: #3b82f6;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 24px;
}

.brand h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.brand p {
    font-size: 1.1rem;
    color: #94a3b8;
}

.features {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.feature {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.feature-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.feature h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.feature p {
    color: #94a3b8;
    font-size: 0.95rem;
}

.login-right {
    width: 480px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-box {
    width: 100%;
    max-width: 360px;
}

.login-box h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
}

.login-subtitle {
    color: #64748b;
    margin-bottom: 32px;
    font-size: 0.95rem;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
    margin-bottom: 6px;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    color: #0f172a;
    background: #fafafa;
    transition: all 0.2s;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.btn-login:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* ============================================
   QUIZ PAGE
   ============================================ */
.quiz-page {
    background: #f8fafc;
}

.quiz-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quiz-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: #3b82f6;
}

.quiz-meta {
    display: flex;
    gap: 20px;
}

.meta-item {
    font-size: 0.875rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 6px 14px;
    border-radius: 20px;
}

.quiz-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #dc2626;
    font-variant-numeric: tabular-nums;
}

.timer-icon {
    font-size: 1.1rem;
}

.progress-track {
    height: 4px;
    background: #e2e8f0;
}

.progress-bar {
    height: 100%;
    background: #3b82f6;
    transition: width 0.3s ease;
}

.quiz-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 24px;
    padding-right: 320px;
}

.question-page {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #334155;
}

.page-range {
    font-size: 0.875rem;
    color: #64748b;
    background: white;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
}

.questions-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.question-block {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    transition: box-shadow 0.2s;
}

.question-block:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.q-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.q-number {
    font-size: 0.8rem;
    font-weight: 700;
    color: #3b82f6;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.q-status {
    font-size: 0.75rem;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 12px;
}

.q-status.answered-status {
    color: #16a34a;
    background: #f0fdf4;
}

.q-text {
    font-size: 1.05rem;
    font-weight: 500;
    color: #0f172a;
    margin-bottom: 16px;
    line-height: 1.6;
}

.q-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.q-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.q-option:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.q-option input[type="radio"] {
    display: none;
}

.opt-letter {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #e2e8f0;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
    transition: all 0.2s;
}

.q-option input:checked + .opt-letter {
    background: #3b82f6;
    color: white;
}

.q-option input:checked ~ .opt-text {
    color: #3b82f6;
    font-weight: 500;
}

.q-option:has(input:checked) {
    border-color: #3b82f6;
    background: #eff6ff;
}

.opt-text {
    font-size: 0.95rem;
    color: #334155;
}

/* Page Navigation */
.page-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.btn-nav {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-prev {
    background: white;
    color: #475569;
    border: 1.5px solid #e2e8f0;
}

.btn-prev:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.btn-next {
    background: #3b82f6;
    color: white;
}

.btn-next:hover {
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-submit {
    background: #16a34a;
    color: white;
}

.btn-submit:hover {
    background: #15803d;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

/* Sidebar */
.quiz-sidebar {
    position: fixed;
    right: 0;
    top: 73px;
    width: 280px;
    height: calc(100vh - 73px);
    background: white;
    border-left: 1px solid #e2e8f0;
    padding: 24px;
    overflow-y: auto;
}

.sidebar-box h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.nav-btn {
    aspect-ratio: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.nav-btn.nav-answered {
    background: #16a34a;
    color: white;
    border-color: #16a34a;
}

.nav-btn.current-page {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.nav-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.8rem;
    color: #64748b;
}

.nav-legend span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: white;
    border: 1.5px solid #e2e8f0;
}

.legend-dot.answered {
    background: #16a34a;
    border-color: #16a34a;
}

.legend-dot.current {
    background: #3b82f6;
    border-color: #3b82f6;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
}

.modal-box {
    background: white;
    padding: 32px;
    border-radius: 16px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-box h3 {
    color: #dc2626;
    font-size: 1.25rem;
    margin-bottom: 12px;
}

.modal-box p {
    color: #64748b;
    margin-bottom: 24px;
}

.btn-modal {
    padding: 12px 32px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

/* ============================================
   RESULT PAGE
   ============================================ */
.result-page {
    background: #f8fafc;
    padding: 40px 24px;
}

.result-container {
    max-width: 800px;
    margin: 0 auto;
}

.result-header {
    text-align: center;
    margin-bottom: 32px;
}

.result-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
}

.result-subtitle {
    color: #64748b;
}

.score-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    margin-bottom: 32px;
    border: 1px solid #e2e8f0;
}

.score-ring {
    width: 180px;
    height: 180px;
    margin: 0 auto 24px;
    position: relative;
}

.score-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-ring .track {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 10;
}

.score-ring .fill {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease;
}

.score-ring.excellent .fill { stroke: #16a34a; }
.score-ring.good .fill { stroke: #3b82f6; }
.score-ring.average .fill { stroke: #f59e0b; }
.score-ring.below-average .fill { stroke: #f97316; }
.score-ring.poor .fill { stroke: #dc2626; }

.score-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-percent {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
}

.score-grade {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #64748b;
    margin-top: 4px;
}

.score-details {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.score-item {
    padding: 16px;
    background: #f8fafc;
    border-radius: 10px;
}

.score-label {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.score-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

.score-value.correct-val { color: #16a34a; }
.score-value.incorrect-val { color: #dc2626; }

.feedback-text {
    font-size: 1.25rem;
    font-weight: 600;
}

.feedback-text.excellent { color: #16a34a; }
.feedback-text.good { color: #3b82f6; }
.feedback-text.average { color: #f59e0b; }
.feedback-text.below-average { color: #f97316; }
.feedback-text.poor { color: #dc2626; }

/* Review Section */
.review-section {
    background: white;
    border-radius: 16px;
    padding: 32px;
    border: 1px solid #e2e8f0;
    margin-bottom: 32px;
}

.review-section h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 24px;
}

.review-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.review-item {
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
}

.review-item.correct {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.review-item.incorrect {
    border-color: #fecaca;
    background: #fef2f2;
}

.review-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.review-qnum {
    font-size: 0.875rem;
    font-weight: 700;
    color: #3b82f6;
}

.review-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
}

.review-item.correct .review-badge {
    background: #bbf7d0;
    color: #16a34a;
}

.review-item.incorrect .review-badge {
    background: #fecaca;
    color: #dc2626;
}

.review-question {
    font-size: 1rem;
    font-weight: 500;
    color: #0f172a;
    margin-bottom: 16px;
    line-height: 1.5;
}

.review-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.review-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #f8fafc;
    font-size: 0.9rem;
}

.review-opt.right {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.review-opt.wrong {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    text-decoration: line-through;
}

.opt-mark {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.review-opt.right .opt-mark {
    background: #16a34a;
    color: white;
}

.review-opt.wrong .opt-mark {
    background: #dc2626;
    color: white;
}

.opt-tag {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.opt-tag.your {
    background: #dbeafe;
    color: #1e40af;
}

.opt-tag.correct {
    background: #dcfce7;
    color: #166534;
}

/* Result Actions */
.result-actions {
    text-align: center;
}

.btn-newquiz {
    display: inline-block;
    padding: 14px 40px;
    background: #3b82f6;
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-newquiz:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .quiz-sidebar {
        display: none;
    }
    
    .quiz-main {
        padding-right: 24px;
    }
}

@media (max-width: 768px) {
    .login-wrapper {
        flex-direction: column;
    }
    
    .login-left {
        padding: 40px 24px;
        min-height: auto;
    }
    
    .login-right {
        width: 100%;
        padding: 40px 24px;
    }
    
    .features {
        display: none;
    }
    
    .score-details {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quiz-meta {
        display: none;
    }
    
    .question-block {
        padding: 16px;
    }
    
    .page-nav {
        flex-direction: column;
        gap: 12px;
    }
    
    .page-nav span:empty {
        display: none;
    }
}

/* ============================================
   NIMASA-SPECIFIC ADDITIONS
   ============================================ */

/* Category Info on Login */
.category-info {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.category-info h4 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    margin-bottom: 16px;
}

.cat-item {
    font-size: 0.85rem;
    color: #cbd5e1;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.cat-item strong {
    color: #60a5fa;
}

/* Scope Banner */
.scope-banner {
    background: #1e3a5f;
    color: white;
    padding: 12px 24px;
    font-size: 0.9rem;
}

.scope-inner {
    max-width: 900px;
    margin: 0 auto;
    padding-right: 320px;
    line-height: 1.5;
}

.scope-inner strong {
    color: #60a5fa;
}

/* Topic Tag in Question */
.q-topic {
    font-size: 0.75rem;
    color: #3b82f6;
    background: #eff6ff;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
}

/* Scope Reference on Results */
.scope-reference {
    background: #eff6ff;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 32px;
}

.scope-reference h4 {
    font-size: 0.875rem;
    color: #1e40af;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.scope-reference p {
    color: #334155;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Review Topic */
.review-topic {
    font-size: 0.75rem;
    color: #3b82f6;
    background: #eff6ff;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
    margin-right: auto;
    margin-left: 12px;
}

/* Responsive for scope banner */
@media (max-width: 1024px) {
    .scope-inner {
        padding-right: 24px;
    }
}

@media (max-width: 768px) {
    .scope-banner {
        font-size: 0.8rem;
        padding: 10px 16px;
    }
    
    .review-topic {
        display: none;
    }
}