/* ==========================================================================
   MOBILE-NATIVE EXAM & WORKSHEET PLAYER CSS (`static/css/mobile-exam.css`)
   Lấy cảm hứng từ:
   - Duolingo Clone (`BhushanLagare7/lingo`): Tap Word Chips & 52px Thumb Buttons
   - SurveyJS (`surveyjs/survey-library`): Adaptive Stepper & Card Stack
   - H5P (`h5p-blanks` / `h5p-drag-text`): Tap-to-Match & Tap-to-Fill
   - Moodle App (`moodlehq/moodleapp`): Sticky Bottom Thumb Navigator
   ========================================================================== */

/* --- Thanh chuyển đổi Chế độ hiển thị Điện thoại / Từng phần --- */
.mob-mode-switcher {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    border-radius: 12px;
    padding: 8px 12px;
    margin-bottom: 16px;
}

.mob-mode-pills {
    display: inline-flex;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 3px;
    gap: 4px;
}

.mob-mode-pill {
    border: none;
    background: transparent;
    color: #475569;
    font-weight: 700;
    font-size: 0.82rem;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mob-mode-pill.is-active {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* --- Thẻ Nối Cột (Part 2 Matching) chuẩn Mobile (Thay bảng 3 cột A4) --- */
.mob-match-cards {
    display: none;
}

.mob-match-card {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.mob-match-opt-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    margin-top: 6px;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    color: #1e293b;
    font-weight: 600;
    font-size: 0.92rem;
    min-height: 46px;
    cursor: pointer;
    transition: all 0.14s ease;
}

.mob-match-opt-btn.is-picked {
    border-color: #2563eb;
    background: #dbeafe;
    color: #1e3a8a;
    font-weight: 700;
}

/* --- Chip Chạm Điền Từ (Part 4 Fill-in-the-blank Tap Chips) --- */
.mob-wordbank-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.mob-wb-chip {
    border: 1.5px solid #93c5fd;
    background: #eff6ff;
    color: #1e3a8a;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    min-height: 36px;
    transition: all 0.12s ease;
}

.mob-wb-chip:active,
.mob-wb-chip.is-used {
    background: #2563eb;
    color: #ffffff;
    border-color: #1d4ed8;
}

/* --- Chip Chạm Ghép Câu kiểu Duolingo (Part 5 Scramble Tap Builder) --- */
.mob-scram-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 10px;
}

.mob-scram-chip {
    border: 1.5px solid #cbd5e1;
    border-bottom-width: 3px;
    background: #ffffff;
    color: #0f172a;
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    min-height: 40px;
    user-select: none;
    transition: all 0.12s ease;
}

.mob-scram-chip.is-picked {
    background: #e2e8f0;
    color: #94a3b8;
    border-color: #cbd5e1;
    transform: translateY(1px);
}

.mob-scram-clear-btn {
    border: 1px solid #fca5a5;
    background: #fef2f2;
    color: #dc2626;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

/* --- Thanh Điều Hướng Ngón Cái Dưới Đáy (Sticky Bottom Thumb Bar) --- */
.mob-sticky-bottom-bar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(10px);
    border-top: 2px solid #cbd5e1;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.14);
}

/* --- Khi bật chế độ Điện thoại hoặc màn hình < 768px --- */
body.is-mobile-exam-layout .desktop-matching-table {
    display: none !important;
}

body.is-mobile-exam-layout .mob-match-cards {
    display: block !important;
}

@media (max-width: 767.98px) {
    .exam-paper-card {
        margin: 10px auto 84px !important;
        padding: 14px 12px !important;
        border-radius: 14px !important;
    }

    .desktop-matching-table {
        display: none !important;
    }

    .mob-match-cards {
        display: block !important;
    }

    .mcq-opt-btn {
        min-height: 50px;
        font-size: 0.96rem;
        padding: 12px 14px;
    }

    .exam-text-inp {
        width: 100% !important;
        min-height: 46px;
        font-size: 1rem;
    }
}
