/* TCS/GSSSB Online CBRT Exam Simulator Stylesheet */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f0f2f5;
    user-select: none;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Header Section */
.exam-header {
    background-color: #4b6584;
    color: white;
    padding: 0 15px;
    height: 52px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #3867d6;
    position: relative;
    z-index: 100;
}

.exam-title h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50vw;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.palette-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #3867d6;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.palette-toggle-btn:hover {
    background: #2d98da;
}

.timer-box {
    background-color: #eb3b5a;
    color: white;
    padding: 6px 12px;
    font-weight: 800;
    border-radius: 4px;
    font-size: 15px;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* Main Container Layout */
.main-container {
    display: flex;
    height: calc(100vh - 114px); /* Header (52px) + Footer (62px) */
    background-color: white;
    position: relative;
    overflow: hidden;
}

/* Left Panel: Question Display */
.question-panel {
    flex: 3;
    padding: 20px 25px;
    overflow-y: auto;
    border-right: 2px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
}

.section-info {
    background-color: #e8f4f8;
    padding: 8px 14px;
    font-weight: 700;
    border-left: 5px solid #20bf6b;
    margin-bottom: 15px;
    font-size: 13px;
    color: #2c3e50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 0 4px 4px 0;
}

.q-nav-info {
    background: #ffffff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: #3867d6;
    border: 1px solid #bce2f2;
}

.question-header {
    font-weight: bold;
    font-size: 16px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.question-content {
    margin-bottom: 20px;
    flex-grow: 1;
}

.question-text-eng {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 15px;
    color: #1e293b;
    white-space: pre-line;
    font-weight: 500;
}

.question-img-guj {
    margin-top: 10px;
    margin-bottom: 15px;
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
}

/* Options Layout */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-row {
    display: flex;
    align-items: center;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    padding: 12px 16px;
    cursor: pointer;
    background-color: #ffffff;
    transition: all 0.2s ease;
}

.option-row:hover {
    background-color: #f8fafc;
    border-color: #3867d6;
}

.option-row input[type="radio"] {
    margin-right: 14px;
    transform: scale(1.35);
    cursor: pointer;
    accent-color: #3867d6;
}

.option-text-container {
    display: flex;
    align-items: center;
    flex-grow: 1;
}

.option-num {
    font-weight: 800;
    margin-right: 10px;
    font-size: 15px;
    color: #3867d6;
    min-width: 24px;
}

.option-img {
    max-height: 52px;
    max-width: 88%;
    vertical-align: middle;
}

.option-text {
    font-size: 15px;
    color: #1e293b;
    line-height: 1.4;
}

/* Right Panel: Sidebar & Palette */
.sidebar-panel {
    flex: 1;
    min-width: 320px;
    max-width: 360px;
    background-color: #f8fafc;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e2e8f0;
    overflow: hidden;
}

.candidate-info-box {
    display: flex;
    padding: 12px 15px;
    border-bottom: 2px solid #e2e8f0;
    background-color: #e0f2fe;
    gap: 12px;
    align-items: center;
}

.candidate-photo {
    width: 52px;
    height: 60px;
    background-color: #cbd5e1;
    border: 1px solid #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.candidate-details {
    font-size: 12.5px;
    line-height: 1.4;
    color: #1e293b;
}

.close-palette-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    color: #475569;
    padding: 6px 10px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

.palette-container {
    padding: 15px;
    flex-grow: 1;
    overflow-y: auto;
}

.palette-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.palette-title {
    font-weight: 700;
    font-size: 14px;
    color: #1e293b;
}

.badge-answered-count {
    background: #dcfce7;
    color: #166534;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
}

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

.palette-btn {
    width: 100%;
    height: 38px;
    border: 1px solid #cbd5e1;
    background-color: white;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.1s;
}

.palette-btn:active {
    transform: scale(0.96);
}

/* Palette Statuses */
.palette-btn.not-visited {
    background-color: #ffffff;
    border-color: #cbd5e1;
    color: #334155;
}

.palette-btn.not-answered {
    background-color: #eb3b5a; /* Red */
    border-color: #eb3b5a;
    color: white;
    clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%);
}

.palette-btn.answered {
    background-color: #20bf6b; /* Green */
    border-color: #20bf6b;
    color: white;
    clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%);
}

.palette-btn.marked {
    background-color: #8854d0; /* Purple */
    border-color: #8854d0;
    color: white;
    border-radius: 50%;
}

.palette-btn.marked-answered {
    background-color: #8854d0; /* Purple */
    border-color: #8854d0;
    color: white;
    border-radius: 50%;
}
.palette-btn.marked-answered::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background-color: #20bf6b; /* Small green dot */
    border-radius: 50%;
    border: 1px solid white;
}

.palette-btn.active-question {
    border: 2.5px solid #2d98da !important;
    box-shadow: 0 0 8px rgba(45, 152, 218, 0.6);
}

/* Legend Box */
.legend-box {
    padding: 12px 15px;
    background-color: #f1f5f9;
    border-top: 1px solid #e2e8f0;
    font-size: 11.5px;
}

.legend-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
}

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

.legend-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    flex-shrink: 0;
}

.legend-icon.not-visited {
    background-color: white;
    border: 1px solid #cbd5e1;
    color: #334155;
}
.legend-icon.not-answered {
    background-color: #eb3b5a;
    color: white;
    clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%);
}
.legend-icon.answered {
    background-color: #20bf6b;
    color: white;
    clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%);
}
.legend-icon.marked {
    background-color: #8854d0;
    color: white;
    border-radius: 50%;
}
.legend-icon.marked-answered {
    background-color: #8854d0;
    color: white;
    border-radius: 50%;
    position: relative;
}
.legend-icon.marked-answered::after {
    content: '';
    position: absolute;
    bottom: 0px;
    right: 0px;
    width: 6px;
    height: 6px;
    background-color: #20bf6b;
    border-radius: 50%;
    border: 1px solid white;
}

/* Footer Section */
.exam-footer {
    background-color: #ffffff;
    height: 62px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    border-top: 2px solid #e2e8f0;
    position: relative;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.04);
}

.footer-left, .footer-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-tcs {
    padding: 9px 16px;
    font-size: 13.5px;
    font-weight: 700;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-tcs:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.btn-default {
    background-color: #ffffff;
    border-color: #cbd5e1;
    color: #334155;
}
.btn-default:hover {
    background-color: #f8fafc;
    border-color: #94a3b8;
}

.btn-tcs-purple {
    background-color: #8854d0;
    color: white;
}
.btn-tcs-purple:hover {
    background-color: #7138be;
}

.btn-tcs-primary {
    background-color: #3867d6;
    color: white;
}
.btn-tcs-primary:hover {
    background-color: #2d55b8;
}

.btn-tcs-success {
    background-color: #20bf6b;
    color: white;
}
.btn-tcs-success:hover {
    background-color: #1a9e58;
}

.hide-desktop {
    display: none !important;
}

/* ========================================================= */
/* RESPONSIVE DESIGN FOR MOBILE & TABLETS (<= 900px)         */
/* ========================================================= */

@media (max-width: 900px) {
    .hide-desktop {
        display: inline-flex !important;
    }
    
    .hide-xs {
        display: none !important;
    }

    .exam-header {
        padding: 0 10px;
        height: 48px;
    }

    .exam-title h2 {
        font-size: 14px;
        max-width: 42vw;
    }

    .palette-toggle-btn {
        padding: 5px 9px;
        font-size: 12px;
    }

    .timer-box {
        padding: 5px 9px;
        font-size: 13.5px;
    }

    /* Full width Question area */
    .main-container {
        height: calc(100vh - 142px); /* Header (48px) + Mobile 2-Row Footer (94px) */
    }

    .question-panel {
        flex: 1;
        width: 100%;
        border-right: none;
        padding: 12px 14px 20px 14px;
    }

    .section-info {
        font-size: 12px;
        padding: 6px 10px;
        margin-bottom: 10px;
    }

    .question-header {
        font-size: 14px;
        margin-bottom: 12px;
        padding-bottom: 6px;
    }

    .question-text-eng {
        font-size: 15px;
        margin-bottom: 12px;
    }

    .option-row {
        padding: 10px 12px;
        gap: 8px;
    }

    .option-row input[type="radio"] {
        margin-right: 8px;
    }

    .option-num {
        font-size: 14px;
        margin-right: 6px;
    }

    .option-text {
        font-size: 14px;
    }

    /* Slide-out Palette Drawer */
    .sidebar-panel {
        position: fixed;
        top: 0;
        right: -360px;
        width: 320px;
        max-width: 88vw;
        height: 100vh;
        z-index: 1500;
        background: #ffffff;
        box-shadow: -5px 0 25px rgba(0,0,0,0.3);
        transition: right 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        flex-direction: column;
        border-left: none;
    }

    .sidebar-panel.open {
        right: 0;
    }

    .palette-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.65);
        z-index: 1400;
        backdrop-filter: blur(2px);
    }

    .palette-backdrop.active {
        display: block;
    }

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

    .palette-btn {
        height: 36px;
        font-size: 12.5px;
    }

    /* Mobile 2-Row Footer */
    .exam-footer {
        height: auto;
        min-height: 94px;
        padding: 6px 10px 8px 10px;
        display: flex;
        flex-direction: column;
        gap: 6px;
        box-shadow: 0 -3px 12px rgba(0,0,0,0.08);
    }

    .footer-row-mobile {
        display: flex;
        width: 100%;
        gap: 6px;
    }

    .footer-row-mobile .btn-tcs {
        flex: 1;
        padding: 8px 6px;
        font-size: 12px;
        justify-content: center;
    }

    .btn-tcs i {
        font-size: 11px;
    }

    #btnMarkNext {
        flex: 1.3;
    }

    #btnClear {
        flex: 1;
    }

    #btnPrev {
        flex: 0.9;
    }

    #btnSaveNext {
        flex: 1.3;
    }

    #btnSubmit {
        flex: 1.1;
    }
}

/* Modal Confirmation */
.modal-overlay-cbrt {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

.summary-modal {
    background-color: white;
    width: 100%;
    max-width: 480px;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.summary-title {
    font-size: 17px;
    font-weight: bold;
    color: #1e293b;
    border-bottom: 2px solid #3867d6;
    padding-bottom: 8px;
    margin-bottom: 12px;
    text-align: center;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.summary-table th, .summary-table td {
    border: 1px solid #e2e8f0;
    padding: 7px 10px;
    font-size: 13px;
}

.summary-table th {
    background-color: #f8fafc;
    text-align: left;
}

.summary-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ========================================================= */
/* INSTRUCTION & GUIDELINES SCREEN (BILINGUAL)               */
/* ========================================================= */
#instructionScreen {
    position: fixed;
    inset: 0;
    background: #f1f5f9;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #1e293b;
}

.instruction-header {
    background: #ffffff;
    padding: 12px 24px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    flex-shrink: 0;
}

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

.inst-logo-badge {
    background: linear-gradient(135deg, #3867d6, #4834d4);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.inst-candidate-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 12px;
}

.inst-candidate-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e0e7ff;
    color: #4338ca;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.instruction-body {
    flex: 1;
    padding: 20px 15px 40px 15px;
    display: flex;
    justify-content: center;
}

.instruction-content-box {
    max-width: 960px;
    width: 100%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.inst-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.inst-summary-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    gap: 12px;
}

.inst-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.inst-card-label {
    font-size: 11.5px;
    color: #64748b;
    font-weight: 600;
}

.inst-card-val {
    font-size: 15px;
    font-weight: 800;
    color: #1e293b;
    margin-top: 2px;
}

.inst-lang-tabs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #e0f2fe;
    padding: 10px 16px;
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.inst-lang-buttons {
    display: flex;
    gap: 6px;
}

.inst-lang-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1.5px solid #93c5fd;
    background: white;
    color: #1e40af;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.inst-lang-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.inst-text-area {
    max-height: 380px;
    overflow-y: auto;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 20px;
    background: #ffffff;
    line-height: 1.6;
}

.inst-sec-title {
    font-size: 15.5px;
    font-weight: 700;
    color: #1e293b;
    margin: 15px 0 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.inst-sec-title:first-child {
    margin-top: 0;
}

.inst-list {
    padding-left: 22px;
    font-size: 14px;
    color: #334155;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inst-symbols-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 12px 0 16px 0;
}

.inst-symbol-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-size: 13px;
}

.inst-declaration-box {
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: 8px;
    padding: 14px 18px;
}

.inst-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 13.5px;
    line-height: 1.5;
    color: #1e293b;
}

.inst-checkbox-label input[type="checkbox"] {
    transform: scale(1.35);
    margin-top: 3px;
    cursor: pointer;
    accent-color: #16a34a;
    flex-shrink: 0;
}

.inst-footer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    padding-top: 14px;
    border-top: 1px solid #e2e8f0;
}

.btn-start-exam {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: white;
    font-weight: 800;
    font-size: 15px;
    padding: 12px 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-start-exam:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(22, 163, 74, 0.45);
}

.btn-start-exam:disabled {
    background: #cbd5e1 !important;
    color: #64748b !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    transform: none !important;
    opacity: 0.65;
}

@media (max-width: 768px) {
    .instruction-header {
        padding: 10px 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .inst-candidate-info {
        width: 100%;
        justify-content: space-between;
    }

    .inst-summary-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .inst-symbols-grid {
        grid-template-columns: 1fr;
    }
    
    .inst-footer-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }
    
    .btn-start-exam, .inst-footer-actions .btn-tcs {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .inst-summary-grid {
        grid-template-columns: 1fr;
    }
}

