/* exam-styles.css */
:root {
    --exam-header-bg: #1f618d; /* Matches existing secondary color for brand consistency */
    --exam-bg: #f4f6f9;
    --exam-border: #e0e6f5;
    --btn-blue: #1f618d;
    --btn-green: #2ecc71;
    --btn-grey: #95a5a6;
    --btn-purple: #9b59b6;
    --btn-red: #e74c3c;
    --text-main: #333;
    --text-muted: #666;
}

.exam-layout {
    display: grid;
    grid-template-rows: 60px 1fr 60px;
    grid-template-columns: 1fr 300px;
    height: 100vh;
    width: 100vw;
}

/* Header */
.exam-header {
    grid-column: 1 / -1;
    background-color: var(--exam-header-bg);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 10;
}

.exam-title h2 {
    margin: 0;
    font-size: 20px;
}

.exam-info {
    display: flex;
    align-items: center;
    gap: 30px;
}

.timer {
    font-size: 18px;
    font-weight: 700;
    background: rgba(0,0,0,0.2);
    padding: 5px 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Main Area */
.exam-main {
    grid-column: 1 / 2;
    grid-row: 2 / 4;   /* spans both the question and footer rows */
    background: #fff;
    border-right: 1px solid var(--exam-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.exam-tabs {
    display: flex;
    border-bottom: 2px solid var(--exam-border);
    background: #f8f9fb;
}

.exam-tab {
    padding: 12px 25px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    border-right: 1px solid var(--exam-border);
    border-bottom: 3px solid transparent;
}

.exam-tab.active {
    color: var(--btn-blue);
    background: #fff;
    border-bottom-color: var(--btn-blue);
}

.question-area {
    display: flex;
    flex-direction: row; /* Split into left and right columns */
    flex: 1;
    overflow: hidden;
    position: relative; /* for palette toggle button */
}

/* LEFT PANE: question header + body */
.question-top-pane {
    width: 60%;
    height: 100%;
    padding: 24px 30px 14px;
    overflow-y: scroll;    /* Drag scrollbar allowed */
    overscroll-behavior: none;
    border-right: 2px dashed var(--exam-border);
}
/* Kill mouse-wheel inside question pane once exam starts */
.no-wheel { pointer-events: none; }
.no-wheel * { pointer-events: none; }
/* Re-enable pointer events on scrollbar by not blocking it */

/* RIGHT PANE: options */
.question-bottom-pane {
    width: 40%;
    height: 100%;
    padding: 24px 30px 20px;
    background: #fafbfe;
    overflow-y: auto;
}

/* Palette Toggle Button floating on the right side */
.split-divider {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    z-index: 5;
}
.palette-toggle-btn {
    position: absolute;
    right: -1px;
    top: -20px;
    height: 40px;
    width: 24px;
    padding: 0;
    justify-content: center;
    background: #1f618d;
    color: #fff;
    border: none;
    border-radius: 6px 0 0 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    box-shadow: -2px 2px 8px rgba(0,0,0,.2);
    transition: background .2s;
    z-index: 20;
}
.palette-toggle-btn:hover { background: #154360; }
.palette-toggle-btn .arrow { font-size: 16px; margin: 0; padding: 0; }
#paletteToggleLabel { display: none; }

.question-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--exam-border);
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.question-no {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
}

.question-marks {
    font-size: 14px;
    color: var(--btn-green);
    font-weight: 600;
}

.question-body {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.6;
    margin-bottom: 30px;
}
.question-body * {
    font-size: 22px !important;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    border: 2px solid var(--exam-border);
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    transition: 0.2s;
}

.option-item:hover {
    background: #f0f7ff;
    border-color: #bad6ff;
}

.option-item input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Side Palette */
.exam-sidebar {
    grid-column: 2 / 3;
    grid-row: 2 / 4;
    background: #fdfdfd;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width .25s ease, opacity .25s ease;
    width: 300px;
}
.exam-sidebar.hidden {
    width: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}
/* When sidebar hidden, main area takes full width */
.exam-layout.sidebar-hidden {
    grid-template-columns: 1fr 0;
}

.candidate-profile {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--exam-border);
    background: #f8f9fb;
}

.candidate-profile img {
    width: 60px;
    height: 60px;
    border-radius: 30px;
    border: 2px solid var(--exam-border);
    background: #fff;
}

.candidate-info h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: var(--text-main);
}

.candidate-info p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.palette-status-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 15px;
    border-bottom: 1px solid var(--exam-border);
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-bubble {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    border-radius: 5px;
}

/* Specific Shapes for Status (Mimicking IBPS) */
.bubble-not-visited { background: #fff; border: 1px solid #ccc; color: #333; }
.bubble-not-answered { background: var(--btn-red); border-radius: 10px 10px 0 0; }
.bubble-answered { background: var(--btn-green); border-radius: 10px 10px 0 0; }
.bubble-marked { background: var(--btn-purple); border-radius: 50%; }
.bubble-marked-answered { background: var(--btn-purple); border-radius: 50%; position:relative; }
.bubble-marked-answered::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--btn-green);
    border-radius: 50%;
}

.question-palette-grid {
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    overflow-y: auto;
    flex: 1;
}

.palette-btn {
    width: 40px;
    height: 40px;
    border: none;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Footer Actions */
.exam-footer {
    grid-column: 1 / 2;
    grid-row: 3 / 4;
    background: #fff;
    border-top: 1px solid var(--exam-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
}

.action-buttons-group {
    display: flex;
    gap: 15px;
}

.exam-btn {
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
    transition: 0.2s;
}

.exam-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-mark { background: var(--btn-purple); }
.btn-clear { background: #fff; color: var(--text-main); border: 1px solid var(--exam-border); }
.btn-clear:hover { background: #f0f0f0; }
.btn-save { background: var(--btn-green); font-size: 16px; padding: 10px 30px; }

@media (max-width: 900px) {
    .exam-layout {
        grid-template-columns: 1fr;
    }
    .exam-sidebar {
        display: none; /* Hide sidebar on mobile, show via toggle in real app */
    }
    .exam-footer {
        grid-column: 1 / -1;
        padding: 0 10px;
    }
    .action-buttons-group {
        gap: 5px;
    }
    .exam-btn {
        padding: 10px;
        font-size: 12px;
    }
}

/* =============================================
   PYQ PAGE: GENERAL CARD (Category / Exam / Year)
   ============================================= */
.card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 24px 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    cursor: pointer;
}
.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 28px rgba(99,102,241,0.15);
    border-color: #6366f1;
}

/* =============================================
   PYQ PAGE: SHIFT CARD
   ============================================= */
.pyq-card {
    position: relative;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 28px 20px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.pyq-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 28px rgba(99,102,241,0.15);
    border-color: #6366f1;
}
.pyq-card h3 {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin: 10px 0 6px;
}
.pyq-card p {
    font-size: 13px;
    color: #64748b;
    margin: 0;
}

/* Clock icon inside shift card */
.icon-box {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #eef2ff;
    color: #6366f1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin: 0 auto 6px;
    transition: all 0.3s ease;
}
.pyq-card:hover .icon-box {
    background: #6366f1;
    color: #fff;
    transform: scale(1.1) rotate(10deg);
}

/* PDF icon button — TOP RIGHT corner of shift card */
.pdf-icon-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s ease;
    z-index: 2;
}
.pdf-icon-btn.available {
    background: #fef3c7;
    color: #d97706;
    cursor: pointer;
}
.pdf-icon-btn.available:hover {
    background: #d97706;
    color: #fff;
    transform: scale(1.15);
}
.pdf-icon-btn.not-available {
    background: #f1f5f9;
    color: #cbd5e1;
    cursor: default;
}

/* =============================================
   PYQ PAGE: QUESTION CARDS
   ============================================= */
.question-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s ease;
}
.question-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.q-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.q-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f1f5f9;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}

.q-text {
    font-size: 16px;
    color: #1e293b;
    line-height: 1.7;
    margin-bottom: 20px;
    font-weight: 500;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
@media (max-width: 600px) {
    .options-grid { grid-template-columns: 1fr; }
}

.option-box {
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    color: #334155;
    background: #f8fafc;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}
.option-box:hover {
    border-color: #6366f1;
    background: #eef2ff;
    color: #4338ca;
}
.option-box.correct {
    border-color: #22c55e !important;
    background: #f0fdf4 !important;
    color: #15803d !important;
    font-weight: 700;
}
.option-box.wrong {
    border-color: #ef4444 !important;
    background: #fef2f2 !important;
    color: #b91c1c !important;
    font-weight: 700;
}

.explanation-box {
    display: none;
    margin-top: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #fef9ec, #fffbf0);
    border-left: 4px solid #f59e0b;
    border-radius: 12px;
    font-size: 14px;
    color: #78350f;
    line-height: 1.6;
}

/* Loading / Empty state */
.state-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 24px;
    background: #fff;
    border-radius: 20px;
    border: 1px dashed #cbd5e1;
    color: #94a3b8;
    font-size: 15px;
}
.state-msg i {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
    color: #cbd5e1;
}
