
/* ============================================================
   1. MODAL SIZING
============================================================ */
@media (min-width: 1200px) {
    .modal-xl {
        --bs-modal-width: 1400px !important;
    }
}


/* ============================================================
   2. STEP 2 · QUIZ BUILDER — INTRO / SETTINGS
============================================================ */
.quiz-builder-intro h5 {
    letter-spacing: -0.01em;
}

.quiz-settings-card {
    background: #f8f9fa;
    border-radius: 14px;
    border: 1px solid #edeef0;
}

.quiz-settings-card .form-label {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6c757d;
}

.quiz-settings-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 9px;
}

.quiz-questions-heading {
    letter-spacing: -0.01em;
}

.quiz-question-count-badge {
    font-weight: 600;
    letter-spacing: .02em;
}


/* ============================================================
   3. QUESTION CARD
   ------------------------------------------------------------
   Base background is #f8f9fa (used on the PDF and standalone
   Quiz Maker pages). The PPT and Video pages use a slightly
   different shade (#FBFBFB) and a different "Add Option" button
   radius — preserved below via page-section overrides so the
   original per-page look is unchanged.
============================================================ */
.quiz-question-card {
    border: 1px solid #e9ecef;
    border-radius: 14px;
    background: #f8f9fa;
    overflow: hidden;
    transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease, opacity .18s ease;
}

.quiz-question-card:hover {
    box-shadow: 0 6px 20px rgba(20, 20, 30, .06);
    border-color: #dde0e3;
}

.quiz-question-card:focus-within {
    border-color: #adb5bd;
    box-shadow: 0 6px 20px rgba(20, 20, 30, .08);
}

.quiz-question-card.dragging {
    opacity: .45;
    transform: scale(.98);
    box-shadow: 0 10px 24px rgba(20, 20, 30, .12);
}

.quiz-question-number {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    font-weight: 600;
    font-size: .95rem;
}

.quiz-question-num-text {
    font-weight: 700;
    font-size: .85rem;
    letter-spacing: -0.01em;
}

.quiz-drag-handle {
    cursor: grab;
    color: #adb5bd;
    padding: .25rem .35rem;
    border-radius: 6px;
    transition: background-color .15s ease, color .15s ease;
}

.quiz-drag-handle:hover {
    background-color: #f1f3f5;
    color: #495057;
}

.quiz-drag-handle:active {
    cursor: grabbing;
}

.quiz-type-select {
    min-width: 160px;
    font-weight: 500;
}

.quiz-question-input {
    font-size: 1.02rem;
    border-radius: 14px;
    resize: none;
}

.quiz-question-input:focus {
    box-shadow: 0 0 0 .2rem rgba(33, 37, 41, .08);
    border-color: #adb5bd;
}

.quiz-option-row {
    border: 1px solid #e9ecef;
    border-radius: 14px;
    background: #fbfbfc;
    transition: background-color .15s ease, border-color .15s ease;
}

.quiz-option-row:hover {
    background: #f4f5f6;
}

.quiz-option-row:focus-within {
    border-color: #adb5bd;
    background: #fff;
}

.quiz-option-row .form-control {
    border: none;
    background: transparent;
    box-shadow: none;
    padding-left: .25rem;
}

.quiz-option-row .form-control:focus {
    box-shadow: none;
}

.quiz-option-marker {
    flex: 0 0 auto;
}

.quiz-remove-option {
    opacity: .45;
    transition: opacity .15s ease;
}

.quiz-option-row:hover .quiz-remove-option {
    opacity: 1;
}

.quiz-add-option-btn {
    border-style: dashed;
    border-radius: 14px;
    font-weight: 500;
}

.quiz-remove-question-btn {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
}

.quiz-add-question-bar {
    border: 1px dashed #ced4da;
    border-radius: 14px;
    background: #f8f9fa;
}

.quiz-add-question-bar .form-select {
    min-width: 170px;
}

.quiz-hint {
    font-size: .82rem;
}

/* ---- Accordion header ---- */
.quiz-question-header {
    cursor: pointer;
    user-select: none;
    row-gap: .5rem;
}

.quiz-question-header .collapse-chevron {
    color: #adb5bd;
    transition: transform .2s ease;
    flex: 0 0 auto;
}

.quiz-question-header[aria-expanded="true"] .collapse-chevron {
    transform: rotate(180deg);
}

.quiz-question-header > .d-flex.align-items-center.flex-grow-1 {
    min-width: 0;
}

.quiz-question-title-text {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    min-width: 0;
}

.quiz-question-type-label {
    font-size: .78rem;
}

.quiz-question-body {
    border-top: 1px solid #edeef0;
}

.quiz-delete-question-btn {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
}


/* ============================================================
   4. DRAG & DROP INSERTION INDICATOR
============================================================ */
.quiz-drop-indicator {
    height: 3px;
    margin: 4px 6px 10px;
    border-radius: 3px;
    background: #212529;
    position: relative;
    box-shadow: 0 0 0 4px rgba(33, 37, 41, .08);
    animation: quizDropPulse 1s ease-in-out infinite;
}

.quiz-drop-indicator::before {
    content: "";
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #212529;
}

@keyframes quizDropPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}


/* ============================================================
   5. RESPONSIVE — QUESTION HEADER (MOBILE)
============================================================ */
@media (max-width: 575.98px) {
    .quiz-question-header {
        flex-wrap: wrap;
    }

    .quiz-question-header > .d-flex.align-items-center.flex-grow-1 {
        flex: 1 1 100%;
    }

    .quiz-question-typewrap {
        order: 3;
        flex: 1 1 100%;
        margin: .5rem 0 0 !important;
    }

    .quiz-question-typewrap .quiz-type-select {
        min-width: 0;
        width: 100%;
    }

    .quiz-question-actions {
        order: 2;
        margin-left: auto;
    }

    .quiz-question-number {
        width: 34px;
        height: 34px;
        flex: 0 0 34px;
    }

    .quiz-question-num-text {
        font-size: .78rem;
    }
}


/* ============================================================
   6. QUIZ HISTORY SIDEBAR (STEP 2 ONLY)
============================================================ */
.quiz-history-card {
    border-radius: 14px;
    position: sticky;
    top: 20px;
}

.quiz-history-item {
    background: #fbfbfc;
    transition: background-color .15s ease, border-color .15s ease;
}

.quiz-history-item:hover {
    background: #f4f5f6;
    border-color: #dde0e3 !important;
}

.quiz-history-empty {
    font-size: .85rem;
}

.quiz-history-list {
    scrollbar-width: thin;
}


/* ============================================================
   7. PERSISTENT RIGHT-SIDE PANEL (STEPS 1 & 3)
============================================================ */
.quiz-side-panel {
    border-radius: 14px;
    position: sticky;
    top: 20px;
}

.quiz-side-panel .side-panel-tip {
    font-size: .84rem;
}

.quiz-side-summary-row {
    font-size: .84rem;
}

.quiz-side-summary-row + .quiz-side-summary-row {
    margin-top: .4rem;
}


/* ============================================================
   8. AI QUIZ SIDE PANEL (STEP 2, ABOVE QUIZ HISTORY)
============================================================ */
.quiz-ai-side-panel {
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
    background:
        linear-gradient(#fff, #fff) padding-box,
        linear-gradient(135deg, #7c3aed, #2563eb 55%, #06b6d4) border-box;
    box-shadow: 0 10px 28px rgba(124, 58, 237, .14);
    transition: box-shadow .2s ease, transform .2s ease;
}

.quiz-ai-side-panel:hover {
    box-shadow: 0 14px 34px rgba(124, 58, 237, .2);
    transform: translateY(-1px);
}

/* Soft decorative glow in the corner so the card reads as "special" */
.quiz-ai-side-panel::before {
    content: "";
    position: absolute;
    top: -60px;
    right: -60px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 58, 237, .16), rgba(37, 99, 235, .08) 55%, transparent 75%);
    pointer-events: none;
}

.quiz-ai-side-panel .card-body {
    position: relative;
    z-index: 1;
}

/* Gradient icon badge instead of the flat dark icon used elsewhere */
.quiz-ai-side-panel .quiz-settings-icon {
    background: linear-gradient(135deg, #7c3aed, #2563eb) !important;
    color: #fff !important;
    box-shadow: 0 4px 10px rgba(124, 58, 237, .3);
}

/* Small "AI-Powered" pill next to the panel title */
.quiz-ai-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    padding: .22rem .55rem;
    border-radius: 999px;
    line-height: 1;
}

/* Gradient CTA button so it visually matches the panel accent */
.quiz-ai-side-panel .btn-dark.quiz-ai-generate-btn {
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    border: none;
    box-shadow: 0 6px 16px rgba(124, 58, 237, .3);
    transition: filter .15s ease, box-shadow .15s ease, transform .15s ease;
}

.quiz-ai-side-panel .btn-dark.quiz-ai-generate-btn:hover {
    filter: brightness(1.06);
    box-shadow: 0 8px 20px rgba(124, 58, 237, .38);
    transform: translateY(-1px);
}

.quiz-ai-side-panel .btn-dark.quiz-ai-generate-btn:active {
    transform: translateY(0);
}


/* ============================================================
   9. RESPONSIVE — SIDE PANELS (TABLET/MOBILE)
============================================================ */
@media (max-width: 991.98px) {
    .quiz-side-panel,
    .quiz-history-card {
        position: static;
        top: auto;
    }
}


/* ============================================================
   10. PAGE-SPECIFIC OVERRIDES
   ------------------------------------------------------------
   Two pages (PPT + Quiz, Video + Quiz) used a very slightly
   different question-card background and, on the PPT page only,
   a different "Add Option" button radius. These are scoped to
   each page's existing wrapper section id so behavior/appearance
   stays pixel-identical to before — no HTML changes required,
   since #main_ppt_quiz_section and #main_video_section already
   exist in the markup.
============================================================ */

/* PPT + Quiz to SCORM (add-quiz-to-ppt.php) */
#main_ppt_quiz_section .quiz-question-card {
    background: #FBFBFB;
}

#main_ppt_quiz_section .quiz-add-option-btn {
    border-radius: 10px;
}

/* Video + Quiz to SCORM (add-quiz-to-video.php) */
#main_video_section .quiz-question-card {
    background: #FBFBFB;
}

/* ============================================================
   AI QUIZ NAV BUTTON
   Same UI as #openAiQuizModalBtn
============================================================ */

#generateQuizAiNavBtn {
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    border: none;
    color: #fff;
    box-shadow: 0 6px 16px rgba(124, 58, 237, .3);
    transition: filter .15s ease, box-shadow .15s ease, transform .15s ease;
}

#generateQuizAiNavBtn:hover {
    filter: brightness(1.06);
    color: #fff;
    box-shadow: 0 8px 20px rgba(124, 58, 237, .38);
    transform: translateY(-1px);
}

#generateQuizAiNavBtn:active {
    transform: translateY(0);
}

#generateQuizAiNavBtn:focus {
    color: #fff;
    box-shadow: 0 0 0 .2rem rgba(124, 58, 237, .2);
}

#generateQuizAiNavBtn i {
    color: #fff;
}