/**
 * E-Modul Pembelajaran Bahasa Indonesia (Model CIRC)
 * Modern Design System & Gamified Adventure Theme
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Palette */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --secondary-gradient: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
    --accent-gradient: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --adventure-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #311042 100%);

    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;

    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #4f46e5;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 30px -4px rgba(79, 70, 229, 0.15);
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.35);
}

body {
    font-family: var(--font-body);
    color: var(--text-main);
    background-color: var(--bg-main);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .font-heading {
    font-family: var(--font-heading);
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Utility Gradients & Badges */
.bg-gradient-primary {
    background: var(--primary-gradient) !important;
}
.bg-gradient-secondary {
    background: var(--secondary-gradient) !important;
}
.bg-gradient-accent {
    background: var(--accent-gradient) !important;
}
.bg-gradient-success {
    background: var(--success-gradient) !important;
}
.bg-gradient-dark {
    background: var(--adventure-gradient) !important;
}

.card-custom {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card-custom:hover {
    box-shadow: var(--shadow-hover);
}

.btn-primary-custom {
    background: var(--primary-gradient);
    border: none;
    color: #ffffff;
    font-weight: 600;
    padding: 0.65rem 1.4rem;
    border-radius: var(--radius-sm);
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}
.btn-primary-custom:hover {
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35);
}

.btn-success-custom {
    background: var(--success-gradient);
    border: none;
    color: #ffffff;
    font-weight: 600;
    padding: 0.65rem 1.4rem;
    border-radius: var(--radius-sm);
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}
.btn-success-custom:hover {
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
}

/* ======================================================
   ADMIN LAYOUT & RESPONSIVE OFFCANVAS DRAWER
   ====================================================== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    width: 100%;
}
.admin-sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 1060;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    height: 100vh;
    position: sticky;
    top: 0;
}
.admin-sidebar .sidebar-brand {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: #ffffff;
    text-decoration: none;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 800;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.admin-sidebar .sidebar-menu {
    list-style: none;
    padding: 1rem 0.75rem;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}
.admin-sidebar .menu-header {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    padding: 0.75rem 1rem 0.25rem;
}
.admin-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    color: #94a3b8;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.925rem;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-bottom: 0.25rem;
}
.admin-sidebar .nav-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}
.admin-sidebar .nav-link:hover {
    color: #ffffff;
    background: var(--sidebar-hover);
}
.admin-sidebar .nav-link.active {
    color: #ffffff;
    background: var(--primary);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

/* Sidebar Backdrop for Mobile */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.sidebar-backdrop.show,
body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
}

.admin-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f8fafc;
    width: 100%;
}
.admin-topbar {
    min-height: 65px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.admin-content {
    padding: 1.75rem;
    flex-grow: 1;
}

/* ======================================================
   STUDENT ADVENTURE DASHBOARD (CIRC)
   ====================================================== */
.adventure-hero {
    background: var(--adventure-gradient);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    color: #ffffff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
}
.adventure-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, rgba(0, 0, 0, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

.adventure-map-container {
    position: relative;
    padding: 2rem 0;
}

/* Flow Stepper Map */
.flow-step-node {
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    height: 100%;
}
.flow-step-node.unlocked {
    border-color: #6366f1;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.12);
}
.flow-step-node.unlocked:hover {
    transform: translateY(-5px);
    box-shadow: 0 14px 30px rgba(99, 102, 241, 0.2);
}
.flow-step-node.active-stage {
    border-color: #4f46e5;
    border-width: 2px;
    background: linear-gradient(180deg, #ffffff 0%, #f5f3ff 100%);
    position: relative;
}
.flow-step-node.active-stage::after {
    content: 'TAHAP SAAT INI';
    position: absolute;
    top: -12px;
    right: 20px;
    background: var(--primary-gradient);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}
.flow-step-node.completed {
    border-color: #10b981;
    background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
}
.flow-step-node.locked {
    opacity: 0.65;
    background: #f8fafc;
    border-style: dashed;
    filter: grayscale(0.2);
    cursor: not-allowed;
}

.node-icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
    transition: all 0.3s ease;
}
.flow-step-node.unlocked .node-icon-wrapper {
    background: #eef2ff;
    color: #4f46e5;
}
.flow-step-node.active-stage .node-icon-wrapper {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: var(--shadow-glow);
}
.flow-step-node.completed .node-icon-wrapper {
    background: #dcfce7;
    color: #16a34a;
}
.flow-step-node.locked .node-icon-wrapper {
    background: #e2e8f0;
    color: #94a3b8;
}

/* ======================================================
   QUESTION TYPE COMPONENTS (PG, MR, TF, TFK, MATCHING)
   ====================================================== */
.question-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-soft);
}

.question-badge {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.3rem 0.75rem;
    border-radius: 8px;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.soal-manage-item,
.list-group-item {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
}

.soal-manage-item .btn,
.list-group-item .btn {
    border-radius: 8px !important;
}

.badge-pg { background: #e0e7ff; color: #4338ca; }
.badge-mr { background: #fef3c7; color: #b45309; }
.badge-tf { background: #dbeafe; color: #1e40af; }
.badge-tfk { background: #fce7f3; color: #9d174d; }
.badge-matching { background: #dcfce7; color: #15803d; }

/* PG Options (Radio) */
.option-radio-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
}
.option-radio-card:hover {
    border-color: #818cf8;
    background: #f5f3ff;
}
.option-radio-card.selected {
    border-color: #4f46e5;
    background: #eef2ff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}
.option-radio-card input[type="radio"] {
    display: none;
}
.option-badge-key {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.option-radio-card.selected .option-badge-key {
    background: #4f46e5;
    color: #ffffff;
}

/* MR Options (Checkbox) */
.option-checkbox-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
}
.option-checkbox-card:hover {
    border-color: #f59e0b;
    background: #fffbeb;
}
.option-checkbox-card.selected {
    border-color: #d97706;
    background: #fef3c7;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.1);
}
.option-checkbox-card input[type="checkbox"] {
    display: none;
}
.checkbox-custom-indicator {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.option-checkbox-card.selected .checkbox-custom-indicator {
    background: #d97706;
    border-color: #d97706;
    color: #ffffff;
}

/* TF (True/False) Segmented Controls */
.tf-segmented-group {
    display: flex;
    gap: 1rem;
    max-width: 400px;
}
.tf-btn {
    flex: 1;
    padding: 0.85rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #ffffff;
    font-weight: 700;
    font-size: 1rem;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}
.tf-btn.tf-benar:hover {
    border-color: #10b981;
    background: #f0fdf4;
    color: #059669;
}
.tf-btn.tf-benar.selected {
    border-color: #059669;
    background: #10b981;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}
.tf-btn.tf-salah:hover {
    border-color: #ef4444;
    background: #fef2f2;
    color: #dc2626;
}
.tf-btn.tf-salah.selected {
    border-color: #dc2626;
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

/* TFK Table Matrix */
.tfk-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
}
.tfk-row {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}
.tfk-row td {
    padding: 1rem;
    vertical-align: middle;
}
.tfk-row td:first-child {
    border-top-left-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-sm);
}
.tfk-row td:last-child {
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
    text-align: right;
    white-space: nowrap;
}

/* Matching (Menjodohkan) UI */
.matching-board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
}
.matching-col-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}
.matching-item {
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.15rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    user-select: none;
}
.matching-item:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}
.matching-item.active-source {
    border-color: #2563eb;
    background: #dbeafe;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
.matching-item.paired {
    border-color: #10b981;
    background: #f0fdf4;
}

.paired-pill {
    font-size: 0.75rem;
    font-weight: 700;
    background: #dcfce7;
    color: #15803d;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ======================================================
   ONE-WAY POSTTEST ENVIRONMENT
   ====================================================== */
.posttest-container {
    max-width: 850px;
    margin: 2rem auto;
}
.posttest-header {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-soft);
}
.posttest-warning-banner {
    background: #fff7ed;
    border-left: 4px solid #f97316;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: #9a3412;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ======================================================
   INLINE SOAL IN READING MODULES
   ====================================================== */
.inline-soal-box {
    background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
    border: 2px solid #818cf8;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin: 1.75rem 0;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.08);
    position: relative;
}
.inline-soal-box::before {
    content: 'UJI PEMAHAMAN PARAGRAF (CIRC)';
    position: absolute;
    top: -12px;
    left: 20px;
    background: var(--primary-gradient);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 10px;
    border-radius: 20px;
    letter-spacing: 0.05em;
}

/* Penalty alert badge */
.penalty-badge {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ======================================================
   DYNAMIC LOGIN & AUTH COMPONENTS
   ====================================================== */
.login-hero-mobile {
    display: none;
}
.role-segmented-tab {
    background: #f1f5f9;
    padding: 5px;
    border-radius: 50px;
    display: flex;
    position: relative;
    border: 1px solid var(--border-color);
}
.role-segmented-tab .role-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.65rem 1rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    color: #64748b;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    cursor: pointer;
    z-index: 1;
}
.role-segmented-tab .role-btn.active {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}
.demo-chip {
    border: 1px solid var(--border-color);
    background: #ffffff;
    border-radius: 50px;
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    user-select: none;
}
.demo-chip:hover {
    background: #eef2ff;
    border-color: #818cf8;
    color: #4f46e5;
    transform: translateY(-1px);
}
.demo-chip:active {
    transform: scale(0.96);
}
.demo-chip code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.76rem;
    color: #4f46e5;
}

/* Custom Table Responsive Container */
.table-responsive-custom {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
}

/* ======================================================
   MOBILE RESPONSIVENESS & DYNAMIC SCREEN ADAPTATION
   ====================================================== */

/* 1. Large Tablets & Medium Devices (<= 991px) */
@media (max-width: 991.98px) {
    /* Admin Offcanvas Slide-over Drawer */
    .admin-wrapper {
        flex-direction: column;
        min-height: 100vh;
    }
    .admin-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        width: 290px !important;
        max-width: 85vw !important;
        z-index: 1060 !important;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
        box-shadow: none;
    }
    .admin-sidebar.show {
        transform: translateX(0) !important;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.45) !important;
    }
    
    .admin-topbar {
        padding: 0.75rem 1rem;
        min-height: 60px;
    }
    .admin-content {
        padding: 1.25rem 0.85rem;
    }
    .posttest-container {
        padding: 0 0.5rem;
    }
}

/* 2. Mobile Phones & Small Tablets (<= 768px) */
@media (max-width: 768px) {
    /* Global Spacing */
    body {
        font-size: 0.93rem;
    }
    .container, .container-fluid {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    /* Auth / Login Mobile Adaptation */
    .login-desktop-hero {
        display: none !important;
    }
    .login-hero-mobile {
        display: block !important;
        text-align: center;
        padding: 1.5rem 1rem 0.75rem;
    }
    .login-card-main {
        border-radius: 24px !important;
        box-shadow: 0 10px 35px rgba(15, 23, 42, 0.08) !important;
    }

    /* Adventure Hero Banner on Mobile */
    .adventure-hero {
        padding: 1.25rem 1rem !important;
        border-radius: var(--radius-md) !important;
        margin-bottom: 1.25rem !important;
    }
    .adventure-hero h2 {
        font-size: 1.35rem !important;
        line-height: 1.25 !important;
    }
    .adventure-hero p {
        font-size: 0.85rem !important;
    }
    .adventure-hero .status-box-wrap {
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 1rem;
    }

    /* Adventure Stepper Map Nodes */
    .adventure-map-container {
        padding: 0.25rem 0 !important;
    }
    .flow-step-node {
        padding: 1.25rem 1rem !important;
        border-radius: var(--radius-md) !important;
    }
    .flow-step-node h5 {
        font-size: 1.05rem !important;
    }
    .flow-step-node p {
        font-size: 0.825rem !important;
    }
    .node-icon-wrapper {
        width: 44px !important;
        height: 44px !important;
        font-size: 1.15rem !important;
        border-radius: 12px !important;
        margin-bottom: 0.75rem !important;
    }

    /* Question Cards & Forms */
    .question-card {
        padding: 1.15rem 0.9rem !important;
        border-radius: var(--radius-md) !important;
        margin-bottom: 1rem !important;
    }
    .question-card img {
        max-height: 200px !important;
        width: 100% !important;
        object-fit: contain !important;
    }
    .option-radio-card, .option-checkbox-card {
        padding: 0.75rem 0.85rem !important;
        gap: 0.65rem !important;
        font-size: 0.88rem !important;
        min-height: 46px;
    }
    .option-badge-key {
        width: 26px !important;
        height: 26px !important;
        font-size: 0.78rem !important;
    }

    /* Matching UI on Mobile */
    .matching-board {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }
    .matching-item {
        padding: 0.75rem 0.85rem !important;
        font-size: 0.86rem !important;
        min-height: 44px;
    }

    /* Inline Questions in Reading View */
    .inline-soal-box {
        padding: 1.15rem 0.85rem !important;
        margin: 1.25rem 0 !important;
        border-radius: var(--radius-sm) !important;
    }
    .passage-content {
        font-size: 0.95rem !important;
        line-height: 1.7 !important;
    }

    /* One-Way Posttest Header */
    .posttest-header {
        padding: 0.85rem 1rem !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.65rem !important;
    }
    .posttest-header .progress {
        width: 100% !important;
    }

    /* LKPD Submission & Result Certificate */
    #certificate-card {
        padding: 1.35rem 0.9rem !important;
        border-radius: var(--radius-md) !important;
    }
    #certificate-card h2 {
        font-size: 1.25rem !important;
    }

    /* Admin Action Buttons & Card Items on Mobile */
    .list-group-item {
        overflow: hidden !important;
        max-width: 100% !important;
    }
    .list-group-item .btn,
    .admin-topbar .btn,
    .admin-content .btn {
        border-radius: 8px !important;
    }
    .list-group-item code {
        word-break: break-all !important;
    }
    .btn-action-group {
        display: flex;
        gap: 0.35rem;
        flex-wrap: wrap;
    }
    .btn-action-group .btn {
        padding: 0.35rem 0.65rem !important;
        font-size: 0.8rem !important;
    }
}

/* 3. Small Mobile Phones (<= 576px) */
@media (max-width: 576px) {
    /* TFK Matrix: Transform table into mobile cards */
    .tfk-table, 
    .tfk-table tbody, 
    .tfk-table tr, 
    .tfk-table td {
        display: block !important;
        width: 100% !important;
    }
    .tfk-row {
        margin-bottom: 0.75rem !important;
        padding: 0.85rem !important;
        border: 1px solid var(--border-color) !important;
        border-radius: var(--radius-sm) !important;
    }
    .tfk-row td {
        padding: 0 !important;
        text-align: left !important;
    }
    .tfk-row td:first-child {
        margin-bottom: 0.65rem !important;
        font-size: 0.88rem !important;
        line-height: 1.5 !important;
    }
    .tfk-row td:last-child > div {
        display: flex !important;
        justify-content: flex-start !important;
        gap: 1.5rem !important;
        border-top: 1px dashed #e2e8f0;
        padding-top: 0.5rem;
    }

    /* Segmented TF buttons */
    .tf-segmented-group {
        max-width: 100% !important;
        gap: 0.5rem !important;
    }
    .tf-btn {
        padding: 0.65rem 0.5rem !important;
        font-size: 0.9rem !important;
    }

    /* Modal dialog responsive adjustments */
    .modal-dialog {
        margin: 0.5rem !important;
    }
    .modal-body {
        padding: 1rem 0.85rem !important;
    }
}
