/* ============ GLOBAL RESET ============ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f3f5f9;
    color: #111827;
}

/* =========================================================================
   PART 1 – GENERIC APP STYLES (dashboard.php, start_session.php, etc.)
   ========================================================================= */

/* Top bar for dashboard & other pages (NOT exam page) */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #0b3a82;
    color: #ffffff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
}

.top-bar a.link {
    color: #cbd5ff;
    text-decoration: none;
    font-size: 0.9rem;
}
.top-bar a.link:hover {
    text-decoration: underline;
}

/* Generic content layout */
.content {
    max-width: 960px;
    margin: 28px auto;
    padding: 0 18px 32px;
}
.content.narrow {
    max-width: 640px;
}

/* Cards (dashboard sections) */
.card {
    background: #ffffff;
    padding: 16px 18px;
    margin-top: 16px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
    border: 1px solid #d1d5db;
}

h2 {
    margin-top: 0;
    font-size: 1.3rem;
    font-weight: 600;
}
h3 {
    margin-top: 0;
    font-size: 1rem;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #16a34a;
    color: #f9fafb;
    font-size: 0.78rem;
    font-weight: 500;
}

/* Buttons (used everywhere) */
.btn-primary,
.btn-secondary,
.btn-danger-small,
.btn-primary-small,
.btn-secondary-small {
    display: inline-block;
    border: none;
    border-radius: 4px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.1;
    white-space: nowrap;
}

.btn-primary {
    background: #1c4ed8;
    color: #f9fafb;
}
.btn-primary:hover {
    background: #1e40af;
}

.btn-secondary {
    background: #e5e7eb;
    color: #111827;
}
.btn-secondary:hover {
    background: #d1d5db;
}

.btn-danger-small {
    background: #b91c1c;
    color: #f9fafb;
    padding: 6px 11px;
    font-size: 0.8rem;
}
.btn-danger-small:hover {
    background: #991b1b;
}

.btn-primary-small {
    background: #1c4ed8;
    color: #f9fafb;
    padding: 6px 11px;
    font-size: 0.8rem;
}
.btn-primary-small:hover {
    background: #1e40af;
}

.btn-secondary-small {
    background: #e5e7eb;
    color: #111827;
    padding: 6px 11px;
    font-size: 0.8rem;
}
.btn-secondary-small:hover {
    background: #d1d5db;
}

/* Agreement box on start_session.php */
.agreement-box {
    background: #eff6ff;
    padding: 12px 14px;
    border-radius: 4px;
    border: 1px solid #dbeafe;
    margin-bottom: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Login page */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: radial-gradient(circle at top, #1d4ed8 0, #0f172a 55%, #020617 100%);
    color: #e5e7eb;
}

.login-container {
    background: #020617;
    padding: 26px 24px 24px;
    border-radius: 8px;
    width: 320px;
    box-shadow: 0 12px 30px rgba(15,23,42,0.6);
    border: 1px solid #1e293b;
}

.login-container h2 {
    margin-top: 0;
    margin-bottom: 10px;
    text-align: center;
    font-size: 1.15rem;
}
.login-subtitle {
    text-align: center;
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 14px;
}

.login-container label {
    display: block;
    margin-top: 10px;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.login-container input[type="email"],
.login-container input[type="password"],
.login-container input[type="text"] {
    width: 100%;
    padding: 8px 9px;
    border-radius: 4px;
    border: 1px solid #4b5563;
    background: #020617;
    color: #e5e7eb;
    font-size: 0.9rem;
}
.login-container input:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 1px #3b82f6;
}

.login-container .btn-primary {
    width: 100%;
    margin-top: 16px;
    font-weight: 500;
}

.login-switch {
    margin-top: 10px;
    text-align: center;
    font-size: 0.9rem;
}

.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 0.8rem;
}

/* =========================================================================
   PART 2 – CFA-LIKE EXAM UI (session.php)
   ========================================================================= */
/* =========================================================================
   PART 2 – CFA-LIKE EXAM UI (session.php)
   ========================================================================= */

/* we only override styles when body has .exam-body */
body.exam-body {
    background: #ffffff;
    color: #222;
}

/* ----- Top grey bar ----- */
/* .cfa-top-bar {
    display: grid;
    grid-template-columns: 1.4fr 1.6fr 1.2fr;
    align-items: center;
    background: #4a4a4a;
    color: #ffffff;
    padding: 10px 12px;
    font-size: 0.8rem;
}

.cfa-top-left div + div {
    margin-top: 2px;
}

.cfa-top-center {
    text-align: center;
}
.cfa-top-center-label {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
}
.cfa-clock-icon {
    font-size: 0.9rem;
}
.cfa-top-timer {
    font-weight: 700;
    font-size: 0.9rem;
    margin: 2px 0;
}

.cfa-progress-row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-top: 2px;
}

.cfa-progress-wrap {
    flex: 0 0 220px;
    height: 6px;
    background: #777;
    border-radius: 3px;
    overflow: hidden;
}
.cfa-progress-bar {
    height: 100%;
    width: 0;
    background: #8cc63f; 
}
.cfa-progress-text {
    font-size: 0.78rem;
}

.cfa-top-right {
    display: flex;
    justify-content: flex-end;
} */

/* ---------- TOP GREY BAR ---------- */
.cfa-top-bar {
    background: #4b4b4b;
    color: white;
    padding: 10px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 16px;
}

/* Left block (Question / Section) */
.cfa-top-left {
    font-size: 16px;
    line-height: 1.4;
}
/* ----- Top centre timer + progress area ----- */
/* TOP CENTER: TWO COLUMN LAYOUT */
.cfa-top-center {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    padding: 0 20px;
}

/* Timer Column */
.cfa-timer-col {
    display: flex;
    flex-direction: column;
}

.cfa-timer-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cfa-clock-icon {
    font-size: 1.4rem;
}

.cfa-top-label {
    font-size: 1.1rem;
}

.cfa-top-timer {
    font-size: 1em;
    font-weight: 500;
    margin-top: 2px;
    padding-left: 30px;
}

/* Progress Column */
.cfa-progress-col {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    justify-content: flex-end;
}

.cfa-progress-wrap {
    width: 230px;
    height: 14px;
    background: #ffffff;
    border-radius: 999px;
    overflow: hidden;
}

.cfa-progress-bar {
    height: 100%;
    width: 0;
    background: #8cc63f;
}

.cfa-progress-text {
    font-size: 1rem;
}

/* Right side (Finish Test button) */
.cfa-top-right {
    display: flex;
    align-items: center;
}

/* Finish button */
.cfa-finish-btn {
    background: #f3e8bd;
    color: #000;
    border: 1px solid #d1c59a;
    padding: 6px 16px;
    font-size: 1.4rem;
    font-weight: 600;
    cursor: pointer;
}
.cfa-finish-btn:hover {
    background: #e6d99f;
}

/* ----- Green strip under top bar ----- */
.cfa-strip {
    background: #8cc63f;
    color: #fff;
    font-size: 0.8rem;
    padding: 4px 12px;
    border-bottom: 1px solid #6f9b2e;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cfa-strip-left {
    font-weight: 600;
}
.cfa-strip-right {
    font-weight: 600;
}

/* ----- Main layout ----- */

.cfa-main {
    display: grid;
    grid-template-columns: 135px minmax(0, 1fr); /* a bit wider left, like CFA */
    column-gap: 26px;                            /* clear space for the arrow */
    padding: 12px 26px 16px 26px;                /* space around whole panel */
    background: #fff;    
    flex: 1;                     /* light grey like CBT */
}

/* Sidebar with question numbers */
.cfa-sidebar {
    /* background: #f5f5f5; */
    /* border-right: 1px solid #d4d4d4; */
    display: flex;
    flex-direction: column;
    padding-top: 4px;      /* tiny drop so top edges don’t feel glued */
}

.cfa-question-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 6px;
}

/* ---------- LEFT QUESTION PALETTE (FINAL) ---------- */

.cfa-question-list .palette-btn {
    position: relative;
    width: 90%;
    display: block;
    margin: 4px 0;
    padding: 6px 0;
    font-size: 0.8rem;
    text-align: center;
    cursor: pointer;
    color: #ffffff;
    border-radius: 5px;
    border: 1px solid transparent;

    /* IMPORTANT: default = green, so even if only "flagged" class is present
       it still shows as green unanswered */
    background: #8cc63f;
}

/* ANSWERED => dark grey */
.cfa-question-list .palette-btn.answered {
    background: #4a4a4a;
}

/* LEFT WEDGE ONLY FOR ANSWERED */
.cfa-question-list .palette-btn.answered::before {
    content: "";
    position: absolute;
    left: -1px;
    top: -1px;
    width: 0;
    height: 0;
    border-bottom: 10px solid #d0d7df;   /* light grey tab */
    border-left: 10px solid #ffffff;
}

/* Make sure unanswered never get a wedge */
.cfa-question-list .palette-btn:not(.answered)::before {
    content: none;
}

/* FLAGGED — ONLY adds icon, does NOT change color or wedge */
.cfa-question-list .palette-btn.flagged .flag-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.78rem;
    color: #ffffff;
    pointer-events: none;
}

/* CURRENT QUESTION — add right arrow, color matches background */

/* flatten right edge so arrow attaches cleanly */
.cfa-question-list .palette-btn.current {
    border-radius: 5px 0 0 5px;
}

/* base arrow shape */
.cfa-question-list .palette-btn.current::after {
    content: "";
    position: absolute;
    top: 0;
    right: -15px;
    width: 0;
    height: 0;
    border-top: 14px solid transparent;
    border-bottom: 14px solid transparent;
}

/* current + ANSWERED => grey arrow */
.cfa-question-list .palette-btn.current.answered::after {
    border-left: 15px solid #4a4a4a;
}

/* current + UNANSWERED (with or without flag) => green arrow */
.cfa-question-list .palette-btn.current:not(.answered)::after {
    border-left: 15px solid #8cc63f;
}

/* non-current => NO arrow at all */
.cfa-question-list .palette-btn:not(.current)::after {
    content: none;
}


/* Right side: white panel */
.cfa-content {
    background: #e9ecef;
    display: flex;
    flex-direction: column;
}

.cfa-panel {
    background: #ffffff;
    border-radius: 3px;
    border: 1px solid #a0a6b2;         /* thin dark-ish border (image 1) */
    display: flex;
    flex: 1;
}

.cfa-question-wrapper {
    flex: 1;
    padding: 18px 22px 22px;           /* more inner space like image 1 */
    overflow-y: auto;
    /* background: #f4f4f4;               light band behind question & options */
}


/* Vignette + question text */
.vignette-box {
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #f8f8f8;
    border: 1px solid #e4e4e4;
    font-size: 0.86rem;
    line-height: 1.4;
}
.vignette-box:empty {
    display: none;
}

.question-box {
    padding: 8px 10px 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 10px;
    background: #F5F7F8;
}

/* Options: boxed style like CFA */
.options {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.9rem;
}

.option-item {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    align-items: stretch;
    border: 2px solid #2f4858;
    padding: 14px 10px;
    cursor: pointer;
    background: #ffffff;
}
.option-item:hover {
    background: #ffffff;          /* keep it white on hover */
    border-color: #e4c15a;        /* orange outline on hover */
}
.option-item input[type="radio"] {
    margin-top: 6px;
}

/* hide default radio bullet but keep accessible */
.option-item input[type="radio"] {
    opacity: 0;
    position: absolute;
}

/* Letter column */
.option-letter {
    font-weight: 700;
    display: flex;
    align-items: center;
}

/* Option text */
.option-text {
    display: flex;
    align-items: center;
    padding-left: 4px;
}
/* HIDE inline flag row – we’ll use bottom flag */
.question-actions {
    display: none;
}

/* selected visual state – class added by JS */
.option-item.selected {
    background: #f6e3a1;           /* yellow fill */
    border-color: #e4c15a;
    box-shadow: inset 0 0 0 1px #ffffff;
}
/* Ruled-out options (right-click) */
.option-item.ruled-out {
    background: #ffffff;          /* keep base white */
    border-color: #e4c15a;        /* same orange outline */
}

.option-item.ruled-out .option-text,
.option-item.ruled-out .option-letter {
    text-decoration: line-through;
    color: #444444;
}


/* Selected option – thicker border */
.option-item input[type="radio"]:checked ~ .option-text,
.option-item input[type="radio"]:checked + .option-letter {
    font-weight: 700;
}
.option-item input[type="radio"]:checked ~ .option-text {
    color: #000;
}
.option-item input[type="radio"]:checked ~ .option-text,
.option-item input[type="radio"]:checked + .option-letter {
    /* highlight border on parent */
}
.option-item input[type="radio"]:checked ~ .option-text::before {
    /* optional extra visual if you want */
}

/* Question actions row (flag) */
.question-actions {
    margin-top: 10px;
    font-size: 0.8rem;
}
.flag-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ----- Bottom bar ----- */
.cfa-bottom-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 58px;                 /* thicker */
    background: #4a4a4a;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px;
    font-size: 0.8rem;
    z-index: 100;
}

.cfa-bottom-left .cfa-icon {
    margin-right: 8px;
}

.cfa-bottom-right {
    display: flex;
    gap: 4px;
}

.cfa-nav-btn {
    background: #8cc63f;
    color: #fff;
    border: 1px solid #4b7f1e;
    padding: 4px 12px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 600;
}
.cfa-nav-btn:hover {
    background: #7ab230;
}

.cfa-nav-disabled {
    background: #666;
    color: #ccc;
    border-color: #444;
    cursor: default;
}

.cfa-flag-btn {
    width: 44px;
    height: 41px;
    border-radius: 4px;
    border: 1px solid #4b7f1e;
    background: #8cc63f;      /* same grey as bar shows behind */
    color: #ffffff;               /* white flag icon (⚑) */
    font-size: 1.6rem;
    cursor: pointer;
}
.cfa-icon i {
    font-size: 2rem;
    line-height: 1;
}
.cfa-flag-btn i {
    font-size: 1.4rem;
    line-height: 1;
}

/* flagged state – white square around the flag */
/* .cfa-flag-btn.active {
    background: #ffffff;
    color: #4a4a4a;              
    border-color: #ffffff;
}
.cfa-flag-btn.active i {
    color: #4a4a4a; 
} */

/* body.exam-body {
    background: #ffffff;
    color: #222;
    padding-bottom: 56px;

    
} */
body.exam-body {
    background: #ffffff;
    color: #222;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 56px;   /* space for fixed bottom bar */
}
/* ----- Responsive ----- */
@media (max-width: 900px) {
    .cfa-main {
        grid-template-columns: 60px minmax(0, 1fr);
    }
    .cfa-panel {
        margin: 10px;
    }
    .cfa-top-bar {
        grid-template-columns: 1fr;
        row-gap: 4px;
        text-align: left;
    }
}
