/* =========================================
   QUESTION BANK STYLES  –  v4
   ========================================= */

/* --- Always-visible Back button in nav --- */
.qb-nav-back {
    display: flex;
    align-items: center;
}

/* --- Section Layout --- */
.qb-section {
    max-width: 1250px;
    margin: 0 auto;
}

/* =========================================
   LOGIN GATE
   ========================================= */
.qb-login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}

.qb-login-card {
    background: var(--color-white);
    border-radius: 16px;
    padding: 60px 50px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(5, 51, 107, 0.1);
    max-width: 500px;
    width: 100%;
    border-top: 5px solid var(--first-color);
}

/* Lock icon — approx 0.8cm × 0.8cm ≈ 30px */
.qb-login-icon {
    color: var(--first-color);
    margin-bottom: 12px;
    line-height: 1;
}
.qb-login-icon i {
    font-size: 45px;
}

.qb-login-card h1 {
    font-size: 32px;
    color: var(--text-color-second);
    margin-bottom: 8px;
}

.qb-login-subtitle {
    color: var(--first-color);
    font-weight: 500;
    font-size: 18px;
    margin-bottom: 20px;
}

.qb-login-info {
    color: #777;
    font-size: 14px;
    margin-bottom: 30px;
}

.qb-password-field {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.qb-password-field input {
    padding: 14px 20px;
    font-size: 18px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    outline: none;
    width: 280px;
    font-family: 'Poppins', sans-serif;
    transition: border-color 0.3s;
}

.qb-password-field input:focus {
    border-color: var(--first-color);
}

.qb-error {
    color: #d32f2f;
    font-size: 14px;
    margin-top: 15px;
    font-weight: 500;
}

/* =========================================
   BUTTONS
   ========================================= */
.qb-btn-primary {
    background: var(--first-color) !important;
    color: white !important;
    font-weight: 600;
    transition: background 0.3s, transform 0.2s;
}
.qb-btn-primary:hover {
    background: var(--first-color-hover) !important;
    color: white !important;
    transform: translateY(-2px);
}
.qb-btn-secondary {
    background: #f0f0f0 !important;
    color: var(--text-color-second) !important;
    font-weight: 500;
}
.qb-btn-secondary:hover {
    background: #e0e0e0 !important;
}
.qb-btn-lg {
    padding: 14px 32px !important;
    font-size: 16px !important;
}
.qb-btn-sm {
    padding: 8px 16px !important;
    font-size: 13px !important;
}

/* Footer-level buttons — larger */
.qb-btn-footer {
    padding: 12px 22px !important;
    font-size: 15px !important;
}

/* =========================================
   EXAM SETUP  –  2-COLUMN LAYOUT
   ========================================= */
.qb-setup-header {
    padding-top: 30px;
    margin-top: 50px;
}

.qb-section-subtitle {
    color: #777;
    font-size: 16px;
    margin-top: -15px;
}

.qb-setup-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin-bottom: 40px;
}

.qb-setup-card {
    background: var(--color-white);
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border-top: 4px solid var(--first-color);
}

.qb-setup-card h3 {
    font-size: 18px;
    color: var(--text-color-second);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: none;
}
.qb-setup-card h3 i {
    color: var(--first-color);
    font-size: 20px;
}

/* Chapter checkboxes */
.qb-chapter-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qb-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    color: var(--text-color-second);
}
.qb-checkbox-label:hover {
    background: #f5f8fc;
}
.qb-checkbox-label input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--first-color);
    cursor: pointer;
    flex-shrink: 0;
}

.qb-select-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Difficulty badges */
.qb-difficulty-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.qb-diff-badge {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    display: inline-block;
}
.qb-diff-easy   { background: #e8f5e9; color: #2e7d32; }
.qb-diff-medium  { background: #fff3e0; color: #e65100; }
.qb-diff-hard    { background: #fce4ec; color: #c62828; }

/* Number of questions — dropdown select */
.qb-num-questions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qb-select {
    padding: 10px 16px;
    font-size: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    background: white;
    min-width: 90px;
    transition: border-color 0.3s;
}
.qb-select:focus { border-color: var(--first-color); }
.qb-available-count { color: #999; font-size: 13px; }

.qb-generate-area {
    text-align: center;
    padding: 20px 0;
}

/* =========================================
   EXAM VIEW
   ========================================= */

/* Push the exam section down so header isn't hidden under nav */
.qb-exam-section {
    padding-top: 2em;
}

.qb-exam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
    margin-top: 50px;
}
.qb-exam-header h1 {
    font-size: 30px;
    color: var(--text-color-second);
}
.qb-exam-meta {
    color: #777;
    font-size: 18px;
    margin-top: 4px;
}

/* --- Timer --- */
.qb-timer-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-white);
    padding: 12px 24px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    font-size: 22px;
    font-weight: 600;
    color: var(--first-color);
    font-variant-numeric: tabular-nums;
}
.qb-timer-display i {
    font-size: 24px;
    color: var(--first-color);
}

.qb-progress-ring {
    background: var(--first-color);
    color: white;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

/* --- Question Map (mini nav) --- */
.qb-question-map {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 24px;
    justify-content: center;
}

.qb-map-dot {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 2px solid #ddd;
    background: var(--color-white);
    font-size: 12px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-family: 'Poppins', sans-serif;
}
.qb-map-dot:hover {
    border-color: var(--first-color);
    color: var(--first-color);
}
.qb-map-dot.active {
    background: var(--first-color);
    border-color: var(--first-color);
    color: white;
}
.qb-map-dot.answered:not(.active) {
    background: #e8f5e9;
    border-color: #81c784;
    color: #2e7d32;
}

/* Question cards */
.qb-question-card {
    background: var(--color-white);
    border-radius: 12px;
    padding: 35px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border-left: 5px solid var(--first-color);
    animation: fadeIn 0.3s ease;
}

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

.qb-question-number {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

/* Larger question number circle */
.qb-q-num {
    background: var(--first-color);
    color: white;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    flex-shrink: 0;
}

.qb-q-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Larger chapter & difficulty badges */
.qb-chapter-badge {
    background: #eef6fa;
    color: var(--first-color);
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
}

/* Override diff badge size in exam/results context */
.qb-question-card .qb-diff-badge,
.qb-result-card .qb-diff-badge {
    font-size: 14px;
    padding: 4px 14px;
}

/* Larger question text */
.qb-question-text {
    font-size: 18px;
    color: var(--text-color-second);
    line-height: 1.7;
    margin-bottom: 22px;
    font-weight: 500;
}

/* Larger multiple choice options */
.qb-choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.qb-choice-label {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    color: var(--text-color-second);
}
.qb-choice-label:hover {
    border-color: var(--first-color);
    background: #f5f8fc;
}
.qb-choice-label input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--first-color);
    cursor: pointer;
    flex-shrink: 0;
}
.qb-choice-label.selected {
    border-color: var(--first-color);
    background: #eef6fa;
}
.qb-choice-letter {
    font-weight: 600;
    color: var(--first-color);
    min-width: 24px;
    font-size: 16px;
}

/* =========================================
   NAVIGATION CONTROLS
   ========================================= */
.qb-nav-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qb-nav-indicator {
    font-size: 16px;
    font-weight: 600;
    color: #555;
    min-width: 70px;
    text-align: center;
}

/* =========================================
   RESULTS VIEW
   ========================================= */
.qb-results-summary {
    background: var(--color-white);
    border-radius: 16px;
    padding: 40px 20px;
    box-shadow: 0 8px 30px rgba(5, 51, 107, 0.1);
    margin-bottom: 40px;
    border-top: 5px solid var(--first-color);
}

/* Desktop: single row of 6 items, divider between col 2 and 3 */
.qb-score-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    align-items: start;
    text-align: center;
}

.qb-score-item {
    padding: 10px 8px;
}

/* Vertical divider between Total Time and Correct */
.qb-score-item:nth-child(2) {
    border-right: 2px solid #ddd;
}

.qb-score-item-label {
    font-size: 14px;
    font-weight: 600;
    color: #777;
    margin-bottom: 8px;
}

.qb-score-item-value {
    font-size: 32px;
    font-weight: 700;
}

.qb-score-item-value.val-score     { color: var(--first-color); }
.qb-score-item-value.val-time      { color: var(--first-color); }
.qb-score-item-value.val-correct   { color: #2e7d32; }
.qb-score-item-value.val-incorrect { color: #c62828; }
.qb-score-item-value.val-unanswered { color: #ff9800; }
.qb-score-item-value.val-total     { color: var(--first-color); }

.qb-stat-correct    { color: #2e7d32; }
.qb-stat-incorrect  { color: #c62828; }
.qb-stat-unanswered { color: #ff9800; }
.qb-stat-total      { color: var(--first-color); }

/* Time badge in results */
.qb-time-badge {
    background: #f5f5f5;
    color: #666;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.qb-time-badge i { font-size: 14px; }

/* Result cards */
.qb-result-card {
    background: var(--color-white);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}
.qb-result-card.correct    { border-left: 5px solid #2e7d32; }
.qb-result-card.incorrect  { border-left: 5px solid #c62828; }

.qb-result-icon {
    font-size: 22px;
    margin-right: 8px;
}

.qb-result-choices .qb-choice-label {
    cursor: default;
    pointer-events: none;
}
.qb-choice-correct   { border-color: #2e7d32 !important; background: #e8f5e9 !important; }
.qb-choice-incorrect { border-color: #c62828 !important; background: #fce4ec !important; }

.qb-solution-box {
    margin-top: 20px;
    padding: 18px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--first-color);
}
.qb-solution-box h4 {
    font-size: 14px;
    color: var(--first-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.qb-solution-box p {
    font-size: 14px;
    color: #555;
    line-height: 1.7;
}

/* =========================================
   FOOTER AREA
   ========================================= */
.qb-exam-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 0;
    border-top: 2px solid #eee;
    margin-top: 20px;
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media only screen and (max-width: 768px) {
    .qb-setup-row {
        grid-template-columns: 1fr;
    }

    .qb-login-card {
        padding: 40px 25px;
    }

    .qb-password-field {
        flex-direction: column;
        align-items: stretch;
    }
    .qb-password-field input {
        width: 100%;
    }

    .qb-exam-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .qb-exam-footer {
        flex-direction: column;
        gap: 15px;
    }

    .qb-nav-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Mobile scoreboard: 2 rows × 3 columns
       Row 1: Score | Correct  Incorrect
       Row 2: Time  | Unanswered  Total
       Divider between column 1 and 2 */
    .qb-score-row {
        grid-template-columns: 1fr 1fr 1fr;
    }
    /* Reorder items for mobile: Score, Correct, Incorrect, Time, Unanswered, Total */
    .qb-score-item:nth-child(1) { order: 1; } /* Score */
    .qb-score-item:nth-child(2) { order: 4; border-right: none; } /* Total Time -> row 2 col 1 */
    .qb-score-item:nth-child(3) { order: 2; } /* Correct */
    .qb-score-item:nth-child(4) { order: 3; } /* Incorrect */
    .qb-score-item:nth-child(5) { order: 5; } /* Unanswered */
    .qb-score-item:nth-child(6) { order: 6; } /* Total */
    /* Vertical divider on first column */
    .qb-score-item:nth-child(1),
    .qb-score-item:nth-child(2) {
        border-right: 2px solid #ddd;
    }
    .qb-results-summary { padding: 30px 10px; }
    .qb-score-item-value { font-size: 28px; }
}

@media only screen and (max-width: 540px) {
    .qb-question-text { font-size: 16px; }
    .qb-choice-label { padding: 14px 16px; font-size: 15px; }
    .qb-timer-display { font-size: 18px; padding: 10px 16px; }
    .qb-btn-footer { padding: 10px 16px !important; font-size: 14px !important; }
}
