:root {
    --acca-red: #C12420;
    --acca-orange: #E58A13;
    --bg-header: #EAEAEA;
    --bg-main: #EFEFEF;
    --bg-footer-top: #5C5C5C;
    --bg-footer-bottom: #3B3B3B;
    --border-color: #CCCCCC;
    --text-dark: #333333;
    --text-light: #FFFFFF;
    --font-main: 'Open Sans', Arial, sans-serif;
    --radio-purple: #3B2C6F;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.exam-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
}

/* Header Styles */
.exam-header {
    display: flex;
    height: 80px;
    background-color: var(--bg-header);
    border-bottom: 2px solid #D6D6D6;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
    align-items: stretch;
    z-index: 10;
}

.header-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 15px;
    border-left: 2px solid #FFFFFF;
    font-size: 13px;
}

.header-logo {
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.logo-box {
    background-color: var(--acca-red);
    color: var(--text-light);
    font-weight: bold;
    font-size: 24px;
    padding: 10px 15px;
    letter-spacing: 1px;
}

.header-question-info {
    flex-direction: row;
    align-items: center;
    gap: 20px;
    min-width: 180px;
}

.header-timer {
    align-items: center;
    min-width: 120px;
}

.timer-text {
    font-size: 16px;
    margin-top: 5px;
}

.font-bold {
    font-weight: bold;
}

.header-progress {
    flex-grow: 1;
    align-items: center;
    padding-top: 10px;
}

.progress-container {
    position: relative;
    width: 100%;
    max-width: 250px;
    margin-bottom: 5px;
}

.progress-bar-bg {
    background-color: #BDBDBD;
    height: 22px;
    width: 100%;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    background-color: #5A5A5A;
    height: 100%;
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    text-align: center;
    line-height: 22px;
    color: var(--text-light);
    font-size: 12px;
    font-weight: bold;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}

.progress-details-link {
    color: var(--acca-orange);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.header-title {
    color: var(--acca-orange);
    font-weight: bold;
    font-size: 15px;
    flex-grow: 1;
}

.header-exit {
    align-items: center;
    cursor: pointer;
    min-width: 80px;
    border-right: 2px solid #FFFFFF;
}

.exit-icon-box {
    background-color: #333;
    color: var(--acca-orange);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
}
.exit-icon { font-size: 18px; }
.exit-text { color: var(--acca-orange); font-size: 12px; font-weight: bold; }

/* Main Content Area */
.exam-main {
    flex-grow: 1;
    padding: 50px 10%;
    overflow-y: auto;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
}

.question-container {
    max-width: 800px;
    margin: 0 auto;
}

.question-text {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 30px;
    line-height: 1.4;
}

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

.option-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px dotted var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.option-item:first-child {
    border-top: 1px dotted var(--border-color);
}

.option-item:hover {
    background-color: #E6E6E6;
}

.custom-radio {
    margin-right: 15px;
    width: 18px;
    height: 18px;
    border: 1px solid #888;
    border-radius: 50%;
    background-color: #FFF;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.custom-radio.selected {
    border-color: #888;
}

.custom-radio.selected::after {
    content: '';
    width: 10px;
    height: 10px;
    background-color: var(--radio-purple);
    border-radius: 50%;
}

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

/* Footer Styles */
.exam-footer {
    height: 80px;
    background: linear-gradient(to bottom, var(--bg-footer-top), var(--bg-footer-bottom));
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
}

.footer-left, .footer-right {
    display: flex;
    gap: 30px;
}

.footer-btn {
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    outline: none;
}

.circle-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #2A2A2A;
    color: var(--acca-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: transform 0.1s;
}

.footer-btn:active .circle-icon {
    transform: scale(0.95);
}

.footer-btn:hover .circle-icon {
    background-color: #1A1A1A;
}

.help-icon {
    font-weight: bold;
    font-size: 20px;
    font-family: serif;
}

.nav-icon {
    background-color: #D22630;
    color: #FFF;
}
.footer-btn:hover .nav-icon {
    background-color: #A01B22;
}

.btn-label {
    color: var(--acca-orange);
    font-size: 13px;
    font-weight: bold;
}

/* Modals & Overlays */
.modal-overlay {
    position: fixed;
    top: 80px; /* Below header */
    left: 0;
    width: 100%;
    height: calc(100vh - 160px); /* Between header and footer */
    background-color: rgba(0,0,0,0.5);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #FFF;
    border: 1px solid #000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    padding: 20px;
    max-height: 90%;
    overflow-y: auto;
}

.progress-modal-content {
    width: 600px;
}

.exit-modal-content {
    width: 400px;
    background-color: #F5F5F5;
    text-align: center;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 14px;
}

.legend {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

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

.legend-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
}

.legend-icon.complete {
    background-color: var(--acca-orange);
}

.legend-icon.incomplete {
    border: 2px solid #D22630;
    background-color: transparent;
}

.legend-icon.flagged-icon {
    color: #555;
    background: none;
    font-size: 18px;
}

.question-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.grid-item {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    position: relative;
}

.grid-item .circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0; left: 0;
}

.grid-item .circle.complete {
    background-color: var(--acca-orange);
    color: #FFF;
}

.grid-item .circle.incomplete {
    border: 2px solid #D22630;
    color: #333;
}

.grid-item .flag {
    position: absolute;
    top: -5px;
    right: -5px;
    color: #555;
    font-size: 14px;
}

.modal-btn {
    padding: 8px 20px;
    background-color: #E0E0E0;
    border: 1px solid #999;
    cursor: pointer;
    font-weight: bold;
}

.modal-btn:hover {
    background-color: #D0D0D0;
}

.confirm-btn {
    border: 2px solid #000;
}

.text-center { text-align: center; }

/* Results Screen */
.results-screen {
    position: fixed;
    top: 80px;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #FFF;
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 50px;
}

.results-content {
    text-align: center;
    max-width: 600px;
}

.results-content h2 {
    margin-bottom: 20px;
    color: var(--acca-red);
}

.results-score {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
}

/* Exam Selection Screen */
.selection-screen {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    background: linear-gradient(135deg, #dce6f1 0%, #e8edf2 50%, #dce6f1 100%);
    padding: 40px 20px;
    overflow-y: auto;
}

.selection-content {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    max-width: 1100px;
    width: 100%;
    text-align: center;
}

.selection-title {
    color: var(--acca-red);
    margin-bottom: 10px;
    font-size: 28px;
}

.selection-subtitle {
    color: var(--text-color);
    margin-bottom: 30px;
    font-size: 16px;
}

.exam-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: 20px;
    text-align: left;
}

.exam-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-left: 4px solid var(--acca-red);
    border-radius: 8px;
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
}

.exam-card:hover {
    border-color: var(--acca-red);
    border-left-color: var(--acca-orange);
    background: #fff;
    box-shadow: 0 6px 20px rgba(193, 36, 32, 0.12);
    transform: translateY(-3px);
}

.exam-card h3 {
    color: var(--text-dark);
    margin-bottom: 8px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.exam-card p {
    color: #888;
    font-size: 13px;
    margin: 0;
    font-weight: 600;
}

/* Feedback Container */
.feedback-container {
    margin-top: 25px;
    padding: 15px 20px;
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.feedback-icon {
    font-size: 24px;
    margin-top: 2px;
}

.feedback-content h4 {
    margin: 0 0 5px 0;
    font-size: 18px;
}

.feedback-content p {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: #333;
}

/* Correct state */
.feedback-container.correct {
    background-color: #d4edda;
    border-left: 5px solid #28a745;
}
.feedback-container.correct .feedback-icon {
    color: #28a745;
}
.feedback-container.correct h4 {
    color: #155724;
}

/* Incorrect state */
.feedback-container.incorrect {
    background-color: #f8d7da;
    border-left: 5px solid #dc3545;
}
.feedback-container.incorrect .feedback-icon {
    color: #dc3545;
}
.feedback-container.incorrect h4 {
    color: #721c24;
}

/* Option highlighting */
.option-item.correct-answer {
    border-color: #28a745;
    background-color: #e9f7ef;
}
.option-item.correct-answer .custom-radio {
    border-color: #28a745;
    background-color: #28a745;
}

.option-item.wrong-answer {
    border-color: #dc3545;
    background-color: #fce8e9;
}
.option-item.wrong-answer .custom-radio {
    border-color: #dc3545;
    background-color: #dc3545;
}

/* ── Responsive Styles ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .exam-container {
        height: auto;
        min-height: 100vh;
    }
    .exam-header {
        height: auto;
        flex-wrap: wrap;
        justify-content: center;
    }
    .header-logo {
        width: 100%;
        justify-content: center;
        padding: 15px 0;
    }
    .header-panel {
        border-left: none;
        border-bottom: 1px solid #ddd;
        flex: 1 1 50%;
        min-width: 50%;
        padding: 15px;
        text-align: center;
        align-items: center;
    }
    .header-progress {
        flex: 1 1 100%;
        min-width: 100%;
    }
    .header-title {
        flex: 1 1 100%;
        min-width: 100%;
        border-bottom: none;
    }
    .header-exit {
        flex: 1 1 100%;
        min-width: 100%;
        border-right: none;
    }
    .exam-main {
        padding: 20px 15px;
        overflow-y: visible;
    }
    .exam-footer {
        height: auto;
        padding: 20px 15px;
        flex-direction: column;
        gap: 20px;
    }
    .footer-left, .footer-right {
        width: 100%;
        justify-content: center;
        gap: 15px;
    }

    /* Auth / Selection screen */
    .selection-screen {
        padding: 16px 12px;
        align-items: flex-start;
    }
    .selection-content {
        padding: 22px 16px;
        border-radius: 10px;
    }
    .selection-title {
        font-size: 20px;
    }

    /* Selection screen header — stack buttons vertically */
    #selection-screen .selection-content > div:first-child {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
    #selection-screen .selection-content > div:first-child > div {
        flex-wrap: wrap;
        width: 100%;
        justify-content: flex-start;
    }
    #selection-screen .selection-content > div:first-child h1 {
        font-size: 18px !important;
    }

    /* Exam option cards — single column on mobile */
    .exam-options {
        grid-template-columns: 1fr;
    }

    /* Modals */
    .question-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    .progress-modal-content {
        width: 95%;
    }

    /* OTP input — smaller font on tiny screens */
    #otp-input, #forgot-otp-input {
        font-size: 22px !important;
        letter-spacing: 8px !important;
    }
}

/* Extra small screens (phones < 400px) */
@media (max-width: 400px) {
    .selection-content {
        padding: 18px 12px;
    }
    .selection-title {
        font-size: 18px;
    }
    .modal-btn {
        font-size: 14px !important;
        padding: 10px 14px !important;
    }
}
