@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&display=swap');

:root {
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.95);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Hind Siliguri', sans-serif; }

body {
    background: #0f172a;
    color: var(--text-main);
    padding: 15px;
    min-height: 100vh;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 9999;
}
.spinner {
    width: 50px; height: 50px;
    border: 5px solid rgba(255,255,255,0.1); border-top: 5px solid #38bdf8;
    border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 20px;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

.progress-bar-container { width: 80%; max-width: 400px; background: #1e293b; height: 12px; border-radius: 10px; margin-top: 15px; overflow: hidden; }
.progress-bar { width: 0%; height: 100%; background: linear-gradient(90deg, #0284c7, #10b981); transition: 0.3s; }

/* Buttons & Header */
.header, .distribution-card, .question-card, .omr-card {
    background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--border-radius);
    padding: 20px; margin-bottom: 15px;
}
.header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; }
.header-left { display: flex; align-items: center; gap: 15px; }
.user-avatar { width: 45px; height: 45px; background: #2563eb; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.btn { padding: 8px 16px; border-radius: 8px; border: none; font-weight: 600; cursor: pointer; color: white; transition: 0.2s; }
.btn-key { background: #d97706; } .btn-start { background: #2563eb; }
.btn-history { background: #475569; } .btn-danger { background: #ef4444; }
.btn-full { width: 100%; margin-bottom: 15px; }

.timer-box { background: rgba(0,0,0,0.3); padding: 8px 15px; border-radius: 8px; font-weight: 700; color: #38bdf8; border: 1px solid #334155;}
select { background: #0f172a; color: white; padding: 8px; border-radius: 8px; border: 1px solid #334155; }

/* Badges */
.subject-badges { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 15px; }
.badge { padding: 8px 15px; border-radius: 20px; font-weight: 600; border: 2px solid transparent; cursor: pointer; font-size: 14px; }
.badge.active { transform: scale(1.05); box-shadow: 0 0 10px rgba(255,255,255,0.2); }
.bio-badge { background: #064e3b; color: #6ee7b7; border-color: #059669; }
.chem-badge { background: #78350f; color: #fde047; border-color: #d97706; }
.phy-badge { background: #1e3a8a; color: #93c5fd; border-color: #2563eb; }
.eng-badge { background: #581c87; color: #e9d5ff; border-color: #9333ea; }
.gk-badge { background: #881337; color: #fca5a5; border-color: #e11d48; }
.info-text { text-align: center; font-size: 13px; color: var(--text-muted); }

/* Layout Grid */
.main-container { display: grid; grid-template-columns: 1fr 300px; gap: 15px; }

/* Question Area */
.question-card { min-height: 450px; display: flex; flex-direction: column; justify-content: space-between; }
.q-header { display: flex; justify-content: space-between; border-bottom: 1px solid #334155; padding-bottom: 10px; margin-bottom: 15px; }
.q-number { font-weight: 700; color: #38bdf8; font-size: 18px; }
.subject-tag { background: #2563eb; padding: 4px 10px; border-radius: 12px; font-size: 12px; }
.question-text { font-size: 20px; font-weight: 600; margin-bottom: 20px; line-height: 1.5; }

.option-btn { background: #1e293b; border: 1px solid #334155; color: white; padding: 12px 15px; border-radius: 8px; margin-bottom: 10px; display: flex; align-items: center; gap: 15px; cursor: pointer; text-align: left; font-size: 16px; }
.option-btn:hover { border-color: #38bdf8; }
.option-prefix { width: 30px; height: 30px; background: #334155; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; }

.selected { border-color: #38bdf8; background: rgba(14, 165, 233, 0.15); }
.correct-ans { background: rgba(16, 185, 129, 0.2) !important; border-color: #10b981 !important; color: #a7f3d0 !important; }
.wrong-ans { background: rgba(239, 68, 68, 0.2) !important; border-color: #ef4444 !important; color: #fca5a5 !important; }

/* Explanations */
.explanation-box { background: rgba(6, 78, 59, 0.3); border: 1px solid #059669; padding: 15px; border-radius: 8px; margin-top: 15px; }
.ref-text { color: #34d399; font-weight: 700; margin-bottom: 5px; font-size: 14px; }
.exp-text { font-size: 14px; color: #e2e8f0; line-height: 1.6; }
.q-footer { display: flex; justify-content: space-between; border-top: 1px solid #334155; padding-top: 15px; margin-top: 15px; }

/* OMR */
.omr-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; max-height: 400px; overflow-y: auto; padding-right: 5px; }
.omr-btn { aspect-ratio: 1; border-radius: 6px; border: 1px solid #334155; background: #1e293b; color: white; font-weight: bold; cursor: pointer; }
.omr-btn.answered { background: #2563eb; border-color: #3b82f6; }
.omr-btn.current { border-color: #38bdf8; box-shadow: 0 0 0 2px #38bdf8; }

/* Modals */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; z-index: 9000; }
.modal-content { background: #1e293b; border: 1px solid #334155; padding: 25px; border-radius: 12px; width: 90%; max-width: 450px; text-align: center; }
.modal-large { max-width: 550px; text-align: left; }
.score-display { font-size: 40px; font-weight: bold; color: #38bdf8; margin: 15px 0; }
.result-breakdown { background: #0f172a; padding: 15px; border-radius: 8px; margin-bottom: 20px; text-align: left; }
.breakdown-row { display: flex; justify-content: space-between; margin-bottom: 5px; }
.text-success { color: #10b981; } .text-danger { color: #ef4444; }
.history-list { max-height: 400px; overflow-y: auto; }

@media (max-width: 800px) { .main-container { grid-template-columns: 1fr; } }
