/**
 * Easy Sarkari Mock Test - CBT Examination Room & Scorecard CSS
 */

body.es-cbt-body {
    margin: 0;
    padding: 0;
    background: #f1f5f9;
    font-family: 'Poppins', 'Noto Sans Devanagari', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1e293b;
    overflow-x: hidden;
}

.es-cbt-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ====================================================
   PHASE 1: PRE-EXAM INSTRUCTIONS SCREEN
   ==================================================== */
.es-cbt-intro-card {
    max-width: 820px;
    margin: 40px auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.es-intro-header {
    background: linear-gradient(135deg, #1e3a8a, #0369a1);
    color: #ffffff;
    padding: 30px;
}

.es-intro-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
}

.es-intro-title {
    font-size: 24px;
    margin: 0 0 10px;
    color: #ffffff !important;
}

.es-intro-meta {
    font-size: 14px;
    color: #e0f2fe;
    margin: 0;
    display: flex;
    gap: 15px;
}

.es-intro-body {
    padding: 30px;
}

.es-instructions-list {
    padding-left: 20px;
    line-height: 1.8;
    color: #334155;
    font-size: 14px;
}

.es-palette-legend-intro {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
}

.es-palette-legend-intro h4 {
    margin: 0 0 12px;
    font-size: 14px;
}

.es-legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    font-size: 13px;
}

.es-badge-sample {
    font-size: 14px;
    margin-right: 4px;
}

.es-candidate-form {
    margin-top: 25px;
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
}

.es-candidate-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.es-candidate-fields input,
.es-candidate-fields select {
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}

.es-intro-footer {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.es-btn-start-cbt {
    background: #16a34a;
    color: #ffffff;
    border: none;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s, transform 0.1s;
}

.es-btn-start-cbt:hover {
    background: #15803d;
    transform: scale(1.02);
}

.es-btn-back-home {
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
}

/* ====================================================
   PHASE 2: LIVE CBT EXAMINATION ROOM
   ==================================================== */
.es-cbt-room {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Header */
.es-cbt-header {
    background: #1e293b;
    color: #ffffff;
    height: 58px;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.es-cbt-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.es-brand-icon {
    font-size: 24px;
}

.es-cbt-exam-name {
    font-size: 15px;
    font-weight: 700;
    color: #f8fafc;
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.es-cbt-candidate-name {
    font-size: 12px;
    color: #94a3b8;
}

.es-cbt-candidate-name strong {
    color: #38bdf8;
}

/* Section pills in Header */
.es-cbt-header-center {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0 10px;
}

.es-sec-tab-btn {
    background: #334155;
    color: #cbd5e1;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.es-sec-tab-btn.active {
    background: #0284c7;
    color: #ffffff;
}

/* Header Right: Language, Timer, Zoom */
.es-cbt-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.es-cbt-lang-toggle {
    display: flex;
    align-items: center;
    background: #334155;
    border-radius: 6px;
    padding: 2px 4px;
    gap: 4px;
}

.es-cbt-lang-toggle .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #94a3b8;
    margin-left: 4px;
}

.es-lang-btn {
    background: transparent;
    color: #cbd5e1;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.es-lang-btn.active {
    background: #2563eb;
    color: #ffffff;
}

.es-cbt-timer-box {
    background: #0f172a;
    border: 1px solid #334155;
    padding: 6px 14px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    font-weight: 700;
    color: #22c55e;
    font-family: monospace;
}

.es-cbt-timer-box.timer-warning {
    color: #ef4444;
    border-color: #ef4444;
    animation: es-pulse 1s infinite;
}

@keyframes es-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.es-icon-btn {
    background: #334155;
    color: #ffffff;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.es-btn-palette-toggle {
    display: none;
    background: #334155;
    color: #ffffff;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
}

/* CBT Main Workspace Split */
.es-cbt-main-content {
    display: flex;
    flex: 1;
    height: calc(100vh - 58px);
    overflow: hidden;
}

/* Left: Question Panel */
.es-cbt-question-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #ffffff;
    overflow-y: auto;
    padding: 24px 30px;
    box-sizing: border-box;
}

.es-q-panel-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 12px;
    margin-bottom: 18px;
}

.es-q-number-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 12px;
}

.es-q-section-badge {
    background: #e0f2fe;
    color: #0369a1;
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 600;
}

.es-q-marks-info {
    display: flex;
    gap: 8px;
}

.es-mark-pos {
    background: #dcfce7;
    color: #15803d;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
}

.es-mark-neg {
    background: #fee2e2;
    color: #b91c1c;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
}

.es-q-text-body {
    font-size: 17px;
    line-height: 1.7;
    color: #1e293b;
    margin-bottom: 25px;
}

/* Options */
.es-q-options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.es-option-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.es-option-row:hover {
    border-color: #93c5fd;
    background: #f8fafc;
}

.es-option-row.selected {
    border-color: #2563eb;
    background: #eff6ff;
}

.es-option-key {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 28px;
    background: #e2e8f0;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.es-option-row.selected .es-option-key {
    background: #2563eb;
    color: #ffffff;
}

.es-option-text {
    font-size: 15px;
    color: #1e293b;
    flex: 1;
}

/* Bottom Controls */
.es-cbt-bottom-bar {
    border-top: 1px solid #e2e8f0;
    padding-top: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.es-bottom-left, .es-bottom-right {
    display: flex;
    gap: 10px;
}

.es-btn-primary {
    background: #16a34a;
    color: #ffffff;
    border: none;
    padding: 10px 22px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.es-btn-primary:hover {
    background: #15803d;
}

.es-btn-secondary {
    background: #64748b;
    color: #ffffff;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.es-btn-secondary:hover {
    background: #475569;
}

.es-btn-ghost {
    background: transparent;
    color: #64748b;
    border: 1px solid #cbd5e1;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.es-btn-ghost:hover {
    background: #f1f5f9;
}

/* Right: Palette Panel (TCS iON style) */
.es-cbt-palette-panel {
    width: 320px;
    background: #f8fafc;
    border-left: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.es-palette-header {
    padding: 15px 18px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.es-palette-header h4 {
    margin: 0;
    font-size: 15px;
    color: #0f172a;
}

.es-close-palette-btn {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

.es-palette-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px 16px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
}

.es-leg-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #475569;
}

.es-leg-badge {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 11px;
}

.es-bg-answered { background: #16a34a; }
.es-bg-not-answered { background: #dc2626; }
.es-bg-not-visited { background: #cbd5e1; color: #334155; }
.es-bg-review { background: #7c3aed; }

.es-palette-grid-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.es-palette-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.es-pal-btn {
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.es-pal-btn:hover {
    transform: scale(1.08);
}

.es-pal-btn.current {
    box-shadow: 0 0 0 2px #2563eb, 0 0 6px rgba(37, 99, 235, 0.5);
}

.es-pal-btn.answered {
    background: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
}

.es-pal-btn.not-answered {
    background: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
}

.es-pal-btn.review {
    background: #7c3aed;
    color: #ffffff;
    border-color: #7c3aed;
}

.es-pal-btn.not-visited {
    background: #e2e8f0;
    color: #475569;
}

.es-palette-footer {
    padding: 15px;
    border-top: 1px solid #e2e8f0;
}

.es-btn-submit-test {
    width: 100%;
    background: #2563eb;
    color: #ffffff;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.es-btn-submit-test:hover {
    background: #1d4ed8;
}

/* ====================================================
   PHASE 3: SUBMIT CONFIRMATION MODAL
   ==================================================== */
.es-modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 15px;
}

.es-modal-box {
    background: #ffffff;
    border-radius: 10px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.es-modal-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.es-modal-header h3 {
    margin: 0;
    font-size: 17px;
}

.es-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
}

.es-modal-body {
    padding: 20px;
}

.es-summary-table {
    width: 100%;
    margin-top: 12px;
    border-collapse: collapse;
}

.es-summary-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f1f5f9;
}

.es-modal-footer {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 12px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.es-btn-final-submit {
    background: #16a34a !important;
    border-color: #16a34a !important;
    color: #ffffff !important;
}

/* ====================================================
   PHASE 4: SCORECARD & SOLUTION REVIEW
   ==================================================== */
.es-result-card-wrap {
    max-width: 1000px;
    margin: 30px auto;
    padding: 0 15px;
}

.es-scorecard-hero {
    background: #ffffff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    margin-bottom: 25px;
}

.es-scorecard-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 18px;
    margin-bottom: 22px;
}

.es-result-badge-kicker {
    font-size: 13px;
    font-weight: 700;
    color: #0284c7;
    display: block;
    margin-bottom: 6px;
}

.es-res-title {
    font-size: 22px;
    margin: 0 0 6px;
}

.es-res-candidate {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.es-pass-pill {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

.es-pill-pass {
    background: #dcfce7;
    color: #15803d;
}

.es-pill-fail {
    background: #fee2e2;
    color: #b91c1c;
}

.es-score-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.es-kpi-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.es-kpi-val {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
}

.es-kpi-lbl {
    font-size: 12px;
    color: #64748b;
}

.es-kpi-primary .es-kpi-val { color: #2563eb; }
.es-kpi-green .es-kpi-val { color: #16a34a; }
.es-kpi-red .es-kpi-val { color: #dc2626; }

.es-res-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Leaderboard */
.es-leaderboard-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 22px;
    margin-bottom: 25px;
}

.es-leaderboard-box h3 {
    margin: 0 0 15px;
    font-size: 17px;
}

.es-leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.es-leaderboard-table th, .es-leaderboard-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
}

.es-leaderboard-table th {
    background: #f8fafc;
    color: #64748b;
    font-size: 13px;
    text-align: left;
}

/* Solutions Review */
.es-solutions-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
}

.es-solutions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.es-solutions-header h3 {
    margin: 0;
    font-size: 18px;
}

.es-sol-filter-btns {
    display: flex;
    gap: 8px;
}

.es-sol-fbtn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.es-sol-fbtn.active {
    background: #1e293b;
    color: #ffffff;
    border-color: #1e293b;
}

.es-sol-item-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    background: #ffffff;
}

.es-sol-item-card.is-correct {
    border-left: 4px solid #16a34a;
}

.es-sol-item-card.is-incorrect {
    border-left: 4px solid #dc2626;
}

.es-sol-item-card.is-unattempted {
    border-left: 4px solid #94a3b8;
}

.es-sol-card-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.es-sol-opt-row {
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.es-sol-opt-row.opt-correct {
    background: #dcfce7;
    color: #14532d;
    font-weight: 600;
}

.es-sol-opt-row.opt-wrong-chosen {
    background: #fee2e2;
    color: #7f1d1d;
    font-weight: 600;
}

.es-explanation-box {
    margin-top: 14px;
    background: #f8fafc;
    border-left: 3px solid #0284c7;
    padding: 12px 15px;
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    line-height: 1.6;
}

/* User Dashboard CSS */
.es-user-dashboard-wrapper {
    max-width: 1000px;
    margin: 20px auto;
    font-family: inherit;
}

.es-dashboard-header {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.es-dash-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.es-user-avatar img {
    border-radius: 50%;
}

.es-dash-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.es-dstat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.es-dstat-card .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: #2563eb;
}

.es-dstat-card strong {
    display: block;
    font-size: 22px;
}

.es-dstat-card span {
    font-size: 12px;
    color: #64748b;
}

.es-dash-table-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
}

.es-dash-table {
    width: 100%;
    border-collapse: collapse;
}

.es-dash-table th, .es-dash-table td {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.es-dash-table th {
    background: #f8fafc;
    color: #64748b;
    font-size: 13px;
    text-align: left;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .es-btn-palette-toggle {
        display: block;
    }
    .es-cbt-palette-panel {
        position: fixed;
        right: -330px;
        top: 58px;
        bottom: 0;
        width: 300px;
        z-index: 200;
        transition: right 0.3s ease;
        box-shadow: -4px 0 15px rgba(0,0,0,0.2);
    }
    .es-cbt-palette-panel.is-open {
        right: 0;
    }
    .es-close-palette-btn {
        display: block;
    }
    .es-cbt-question-panel {
        padding: 15px;
    }
    .es-cbt-exam-name {
        max-width: 160px;
    }
    .es-cbt-header-center {
        display: none;
    }
}
