/* ==========================================
   RESET & BASE STYLES (Tailwind green-500 & gray-500 Theme)
========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f0f4f8;
    color: #1f2937;
    overflow: hidden;
}

/* ==========================================
   THEME VARIABLES
========================================== */
:root {
    --primary: #22c55e;        /* Tailwind green-500 */
    --primary-hover: #16a34a;  /* Tailwind green-600 */
    --gray-dark: #4b5563;      /* Tailwind gray-600 */
    --gray-light: #6b7280;     /* Tailwind gray-500 */
    --border: #e5e7eb;
    --bg-main: #f0f4f8;
    --white: #ffffff;
    --header-height: 70px;
    --footer-height: 80px;
}

/* ==========================================
   LAYOUT STRUCTURE
========================================== */
.exam-container {
    width: 100%;
    height: 100vh;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
}

.exam-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-left {
    width: 33%;
    font-size: 18px;
    font-weight: 600;
    color: rgb(34 197 94); 
}

.header-center {
    width: 33%;
    text-align: center;
}

.header-center h1 {
    color: #0f172a;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.header-center .tech-accent {
    color: var(--primary);
}

.header-right {
    width: 33%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

#timerContainer {
    display: flex;
    align-items: center;
    gap: 8px;
    color: red;
}

.clock-icon {
    width: 24px;
    height: 24px;
}

#timer {
    font-size: 24px;
    font-weight: 700;
}

/* ==========================================
   MAIN COMPONENT LAYOUT
========================================== */
.exam-main {
    height: calc(100vh - var(--header-height) - var(--footer-height));
    display: flex;
    padding: 20px 30px;
    gap: 25px;
    flex: 1;
}

.question-panel {
    width: 58%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.omr-panel {
    width: 42%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Label Tab Headers exactly like image */
.panel-tab {
    background: rgb(34 197 94); /* Dark Navy classic panel label header */
    color: var(--white);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 4px 4px 0 0;
    align-self: flex-start;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-body-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 0 6px 6px 6px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

#questionContainer, #omrContainer {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ==========================================
   QUESTION ITEMS
========================================== */
.question-item {
    background: var(--white);
    padding: 20px 0;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.2s;
}

.question-item:last-child {
    border-bottom: none;
}

.question-text {
    font-size: 16px;
    line-height: 1.6;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 16px;
}

.question-hindi {
    color: #fc3a52;
    margin-bottom: 6px;
}

.question-english {
    color: #0f172a;
}

/* Options */
.option-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-left: 4px;
}

.option {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.radio-circle {
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--gray-light);
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s;
    background: var(--white);
}

.option:hover .radio-circle {
    border-color: var(--primary);
}

.option.active .radio-circle {
    border-color: var(--primary);
    background: var(--primary);
}

/* The inner dot matching the image checked radio look */
.option.active .radio-circle::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--white);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.option-text {
    font-size: 15px;
    color: #374151;
    font-weight: 500;
}

/* ==========================================
   OMR SHEET GRID VIEWPORT
========================================== */
.omr-header {
    display: grid;
    grid-template-columns: 70px repeat(4, 1fr);
    align-items: center;
    text-align: center;
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 20;
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 0;
    font-weight: 700;
    color: #475569;
    font-size: 14px;
}

.omr-row {
    display: grid;
    grid-template-columns: 70px repeat(4, 1fr);
    align-items: center;
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
    min-height: 46px;
    transition: background 0.15s;
}

.omr-row:hover {
    background: #f8fafc;
}

.omr-row.current {
    background: #f0fdf4;
}

.omr-number {
    font-size: 14px;
    font-weight: 700;
    color: #475569;
}

.omr-row.current .omr-number {
    color: var(--primary);
}

.omr-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    padding: 8px 0;
}

.omr-bubble {
    width: 20px;
    height: 20px;
    border: 1.5px solid #fc3a52;
    border-radius: 50%;
    position: relative;
    transition: all 0.15s;
    background: var(--white);
}

.omr-cell:hover .omr-bubble {
    border-color: var(--primary);
}

/* Filled Bubble fills exactly dark matching the provided layout spec */
.omr-cell.active .omr-bubble {
    border-color: #0f172a;
    background: #0f172a;
}

/* ==========================================
   FOOTER BUTTONS
========================================== */
.exam-footer {
    height: var(--footer-height);
    background: var(--white);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    align-items: center;
}

#submitExam {
    border: none;
    background: rgb(34 197 94);
    color: var(--white);
    padding: 12px 36px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

#submitExam:hover {
    background: green;
}

.submit-icon {
    width: 18px;
    height: 18px;
    transform: rotate(90deg);
}

/* Scrollbars styling */
#questionContainer::-webkit-scrollbar, #omrContainer::-webkit-scrollbar { width: 6px; }
#questionContainer::-webkit-scrollbar-track, #omrContainer::-webkit-scrollbar-track { background: transparent; }
#questionContainer::-webkit-scrollbar-thumb, #omrContainer::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

/* Modals & Loaders */
#loadingScreen {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: loader .7s linear infinite;
}

@keyframes loader {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-box {
    width: 400px;
    background: var(--white);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.modal-box h2 { font-size: 20px; margin-bottom: 20px; text-align: center; }
.summary { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.summary p { display: flex; justify-content: space-between; font-size: 16px; border-bottom: 1px dashed #e5e7eb; padding-bottom: 6px; }
.modal-buttons { display: flex; gap: 12px; }
.modal-buttons button { flex: 1; border: none; padding: 12px; border-radius: 6px; cursor: pointer; font-size: 15px; font-weight: 600; }
#cancelSubmit { background: #f3f4f6; color: #4b5563; }
#confirmSubmit { background: var(--primary); color: #white; color: white; }

.hidden { display: none !important; }

/* Responsive adjustments */
@media(max-width: 992px) {
    .exam-main { flex-direction: column; padding: 15px; }
    .question-panel, .omr-panel { width: 100%; height: 50%; }
}