/* 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;
}

.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;
}

/* =============================================
   DATA INTERPRETATION (DI) RESPONSIVE STYLES
   ============================================= */
.di-table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    margin: 12px 0 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    background: #fff;
}
.di-table {
    width: 100%;
    min-width: 440px;
    border-collapse: collapse;
    font-size: 13.5px;
    text-align: center;
}
.di-table th {
    background: #1f618d;
    color: #ffffff;
    font-weight: 700;
    padding: 10px 12px;
    border: 1px solid #174d71;
    white-space: nowrap;
}
.di-table td {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-weight: 500;
}
.di-table tr:nth-child(even) td {
    background: #f8fafc;
}
.di-table tr:hover td {
    background: #f0f7ff;
}
.di-swipe-hint {
    display: none;
    font-size: 11px;
    color: #64748b;
    margin-bottom: 4px;
    font-weight: 600;
}
@media (max-width: 768px) {
    .di-swipe-hint {
        display: block;
    }
}
.di-direction-card {
    background: #f8fafc;
    border-left: 4px solid #0284c7;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px;
    color: #334155;
    line-height: 1.5;
    margin-bottom: 12px;
    border-top: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}
.di-direction-card b {
    color: #0369a1;
}
.di-question-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 12px;
}
.di-set-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    border: 1px solid #bae6fd;
}
.di-q-title {
    font-size: 15px;
    color: #0f172a;
    line-height: 1.5;
    margin: 0;
}

/* DI Bar Chart Card & SVG */
.di-chart-card {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 14px 16px;
    margin: 12px 0 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.di-chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}
.di-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.di-legend-color {
    width: 13px;
    height: 13px;
    border-radius: 3px;
    display: inline-block;
}
.di-svg-chart {
    width: 100%;
    height: auto;
    max-height: 340px;
    display: block;
}
.di-table-details summary {
    user-select: none;
    transition: color 0.15s ease;
}
.di-table-details summary:hover {
    color: #0284c7;
}

/* =============================================
   MOBILE & TABLET RESPONSIVENESS (<= 768px)
   ============================================= */
@media (max-width: 768px) {
    .exam-layout {
        display: flex !important;
        flex-direction: column !important;
        height: 100vh !important;
        width: 100vw !important;
        overflow: hidden !important;
    }

    .exam-header {
        height: 50px !important;
        padding: 0 12px !important;
        flex-shrink: 0 !important;
    }
    .exam-title h2 {
        font-size: 15px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 180px !important;
    }
    .timer {
        font-size: 13px !important;
        padding: 4px 10px !important;
    }

    .exam-main {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        border-right: none !important;
    }

    .exam-tabs {
        overflow-x: auto !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        padding: 2px 4px !important;
    }
    .exam-tab {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }

    /* Stack Question and Options vertically on mobile */
    .question-area {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .question-top-pane {
        width: 100% !important;
        height: auto !important;
        max-height: 46vh !important;
        padding: 12px 14px !important;
        border-right: none !important;
        border-bottom: 2px dashed var(--exam-border) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .question-bottom-pane {
        width: 100% !important;
        height: auto !important;
        flex: 1 !important;
        padding: 12px 14px !important;
        background: #fafbfe !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .option-item {
        padding: 10px 14px !important;
        font-size: 14px !important;
        gap: 10px !important;
    }

    /* Floating Palette drawer for mobile */
    .exam-sidebar {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 82vw !important;
        max-width: 320px !important;
        z-index: 1000 !important;
        background: #fff !important;
        box-shadow: -4px 0 20px rgba(0,0,0,0.25) !important;
        transform: translateX(100%) !important;
        transition: transform 0.25s ease !important;
        display: flex !important;
        opacity: 1 !important;
    }
    .exam-sidebar:not(.hidden) {
        transform: translateX(0) !important;
    }
    .exam-sidebar.hidden {
        transform: translateX(100%) !important;
        pointer-events: none !important;
    }

    /* Palette toggle floating button on mobile */
    .palette-toggle-btn {
        position: fixed !important;
        right: 0 !important;
        bottom: 72px !important;
        top: auto !important;
        height: 36px !important;
        width: auto !important;
        padding: 0 10px !important;
        border-radius: 18px 0 0 18px !important;
        z-index: 99 !important;
        font-size: 11px !important;
        background: #1f618d !important;
        box-shadow: -2px 2px 10px rgba(0,0,0,0.3) !important;
    }

    /* Action buttons footer on mobile */
    .exam-main > div:last-child {
        padding: 8px 10px !important;
        gap: 6px !important;
    }
    .exam-main > div:last-child button {
        padding: 7px 10px !important;
        font-size: 11px !important;
    }

    /* TCS Instructions screen on mobile */
    .tcs-top-bar {
        height: 48px !important;
        padding: 0 10px !important;
    }
    .tcs-logo img {
        height: 26px !important;
    }
    .tcs-test-name {
        font-size: 14px !important;
        margin-left: 45px !important;
    }
    .tcs-main-split {
        flex-direction: column !important;
    }
    .tcs-right-pane {
        display: none !important; /* Hide candidate box on mobile instructions */
    }
    .tcs-left-pane {
        width: 100% !important;
        border-right: none !important;
    }
    .tcs-instructions-scroll {
        padding: 12px 14px !important;
    }
    .tcs-bubble-list {
        margin: 8px 0 8px 6px !important;
        gap: 8px !important;
    }
    .bubble-row {
        font-size: 12px !important;
        gap: 8px !important;
    }
    .tcs-instructions-footer {
        padding: 10px 14px !important;
    }
    .tcs-ready-btn {
        width: 100% !important;
        padding: 10px !important;
    }
}

