/* =========================================
   📱 MOBILE ENGINE EXACT CLONE CSS
   ========================================= */

@media screen and (max-width: 768px) {

    /* Hiding Desktop UI in Test Mode */
    .mock-header,
    .mock-action-row,
    .mock-nav-row,
    .mock-right-panel {
        display: none !important;
    }

    /* Important: Hide .mock-left-panel scroll restrictions if any */
    .mock-left-panel {
        width: 100% !important;
        border: none !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    .mock-body {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #1c1c1c;
        color: #e0e0e0;
    }

    /* 🔴 TOP HEADER (#tb-mobile-header) */
    #tb-mobile-header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 105px;
        /* Adjust according to top bar and sub bar */
        z-index: 99999;
        background: #181818;
        border-bottom: 1px solid #333;
    }

    /* Top Bar */
    .tb-top-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 15px;
        height: 55px;
        /* Added height */
    }

    .tb-left {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .tb-pause-btn {
        width: 32px;
        height: 32px;
        border: 1px solid #555;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #aaa;
    }

    .tb-timer-title {
        display: flex;
        flex-direction: column;
    }

    #tb-time-disp {
        font-size: 1.2rem;
        font-weight: 500;
        color: #fff;
    }

    .tb-title {
        font-size: 0.75rem;
        color: #888;
    }

    .tb-right {
        display: flex;
        align-items: center;
        gap: 15px;
    }

    .tb-lang-toggle {
        font-size: 1.2rem;
        color: #fff;
        cursor: pointer;
    }

    .tb-hamburger {
        font-size: 1.5rem;
        color: #fff;
        cursor: pointer;
    }

    /* Sub Bar */
    .tb-sub-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 15px;
        height: 50px;
        /* Added height */
        background: #252525;
        border-top: 1px solid #333;
    }

    .tb-left-sub {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .tb-q-badge {
        background: #111;
        color: #fff;
        font-weight: bold;
        padding: 2px 10px;
        border-radius: 4px;
        font-size: 0.9rem;
    }

    .tb-q-time {
        color: #888;
        font-size: 0.85rem;
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .tb-right-sub {
        display: flex;
        align-items: center;
        gap: 15px;
        color: #888;
        font-size: 1.1rem;
    }

    /* 🔴 QUESTION CONTAINER STYLES (Absolutely positioned) */

    #test-question-container {
        position: fixed !important;
        top: 105px !important;
        bottom: 65px !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 20px 15px !important;
        overflow-y: auto !important;
        background: #121212 !important;
        z-index: 10 !important;
    }

    .question-text {
        font-size: 1.1rem;
        margin-bottom: 20px;
        line-height: 1.6;
    }

    .options-container {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .option {
        background: transparent !important;
        border: 1px solid #333 !important;
        border-radius: 8px !important;
        padding: 15px !important;
        display: flex;
        align-items: flex-start;
        gap: 12px;
        transition: 0.2s;
    }

    .option:active {
        background: #2a2a2a !important;
    }

    .option.selected {
        border-color: #4A90E2 !important;
        background: rgba(74, 144, 226, 0.1) !important;
    }

    .opt-circle {
        font-style: italic;
        color: #888;
        font-size: 1rem;
    }

    /* 🔴 BOTTOM FOOTER (#tb-bottom-bar) */
    #tb-bottom-bar {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 65px !important;
        background: #1e1e24 !important;
        border-top: 1px solid #333 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0 10px !important;
        gap: 10px !important;
        z-index: 99999 !important;
    }

    .tb-btn {
        flex: 1;
        height: 42px;
        /* Set specific height */
        border-radius: 6px;
        font-size: 0.9rem;
        font-weight: bold;
        cursor: pointer;
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 0 5px;
    }

    .tb-btn.outline {
        background: transparent;
        border: 1px solid #777;
        color: #e0e0e0;
    }

    .tb-btn.primary {
        background: #1890ff;
        border: none;
        color: #fff;
        flex: 1.5;
    }

    /* 🔴 SIDE DRAWER */
    #tb-drawer-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 100000;
        display: none;
    }

    #tb-side-drawer {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 350px;
        height: 100vh;
        background: #2b2b2b;
        z-index: 100001;
        transition: right 0.3s ease;
        display: flex;
        flex-direction: column;
        color: #e0e0e0;
    }

    /* Drawer Header & Tabs */
    .tb-drawer-header {
        background: #2f2f2f;
        padding-top: 10px;
        border-bottom: 1px solid #444;
    }

    .tb-tabs {
        display: flex;
        justify-content: space-around;
        border-bottom: 1px solid #444;
    }

    .tb-tabs button {
        background: transparent;
        border: none;
        color: #aaa;
        font-size: 1rem;
        padding: 15px 0;
        flex: 1;
        font-weight: 500;
    }

    .tb-tabs button.active {
        color: #fff;
        border-top: 2px solid #fff;
        /* Top border like image */
    }

    /* Drawer Content Elements */
    .tb-instructions {
        padding: 15px;
        font-size: 1rem;
        display: flex;
        align-items: center;
        gap: 10px;
        border-bottom: 1px solid #444;
    }

    .tb-legend {
        padding: 15px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
        font-size: 0.85rem;
    }

    .tb-leg-item {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    /* Icons styling */
    .tb-icon.review {
        color: #f44336;
        font-size: 1.1rem;
    }

    .tb-icon.unattempted {
        color: #777;
        font-size: 1.1rem;
    }

    .tb-icon.unseen {
        color: #fff;
        font-size: 1rem;
        font-weight: 100;
    }

    .tb-icon.attempted {
        color: #4a90e2;
        font-size: 1.1rem;
    }

    .tb-section-header {
        padding: 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-top: 1px solid #444;
        font-weight: 500;
        font-size: 1rem;
    }

    .tb-stat-counts {
        padding: 0 15px 15px 15px;
        display: flex;
        gap: 15px;
        border-bottom: 2px solid #555;
        /* Line under counts */
    }

    .tb-stat-counts div {
        display: flex;
        align-items: center;
        gap: 5px;
        font-size: 0.85rem;
    }

    /* Drawer Scrolling Content */
    #tb-drawer-content {
        flex: 1;
        overflow-y: auto;
        padding: 15px;
    }

    /* Grid View */
    .tb-grid-container {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: 10px;
        justify-items: center;
    }

    .tb-grid-item {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9rem;
        cursor: pointer;
        color: #fff;
    }

    .tb-grid-item.unseen {
        border: 1px solid #777;
        background: transparent;
    }

    .tb-grid-item.unattempted {
        background: #777;
        border: none;
    }

    .tb-grid-item.attempted {
        background: #4a90e2;
        border: none;
    }

    .tb-grid-item.review {
        background: transparent;
        border: 1px solid #f44336;
        color: #f44336;
        position: relative;
    }

    .tb-grid-item.review::after {
        content: "★";
        position: absolute;
        top: -6px;
        right: -6px;
        color: #f44336;
        font-size: 0.8rem;
    }

    .tb-grid-item.answered-review {
        background: transparent;
        border: 1px solid #4a90e2;
        color: #4a90e2;
        position: relative;
    }

    .tb-grid-item.answered-review::after {
        content: "★";
        position: absolute;
        top: -6px;
        right: -6px;
        color: #4a90e2;
        font-size: 0.8rem;
    }

    .tb-grid-item.current {
        border-radius: 50% !important;
        box-shadow: inset 0 0 0 2px #fff;
    }

    /* List View */
    .tb-list-container {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .tb-list-item {
        display: flex;
        align-items: flex-start;
        gap: 15px;
        padding-bottom: 12px;
        border-bottom: 1px solid #444;
    }

    .tb-list-num {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 0.85rem;
        color: #fff;
    }

    .tb-list-num.unseen {
        background: transparent;
        border: 1px solid #777;
    }

    .tb-list-num.unattempted {
        background: #777;
    }

    .tb-list-num.attempted {
        background: #4a90e2;
    }

    .tb-list-num.review,
    .tb-list-num.answered-review {
        background: transparent;
        border: 1px solid #f44336;
        color: #f44336;
    }

    .tb-list-text {
        font-size: 0.95rem;
        color: #e0e0e0;
        line-height: 1.4;
    }

    /* Drawer Footer */
    .tb-drawer-footer {
        padding: 0;
        background: #78909c;
        /* Blue-gray exact color from screenshot */
    }

    .tb-submit-btn {
        width: 100%;
        padding: 18px 0;
        background: transparent;
        color: #fff;
        font-weight: 600;
        font-size: 1rem;
        border: none;
        letter-spacing: 0.5px;
    }
}