/* ============================================
   MOBILE-FIRST EXAM INTERFACE REDESIGN
   Complete ground-up redesign for mobile
   ============================================ */

/* CRITICAL: Override Tailwind's flex and width classes */

/* Step 1: Sidebar slides in from right on mobile */
@media screen and (max-width: 1024px) {

    /* Position sidebar off-screen right */
    div.w-80.bg-white.border-l.border-gray-200.p-4.overflow-y-auto.exam-palette,
    div.exam-palette,
    .exam-palette,
    [class*="exam-palette"] {
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        width: 85% !important;
        max-width: 360px !important;
        height: 100vh !important;
        z-index: 9999 !important;
        background: white !important;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3) !important;
        transition: right 0.3s ease-in-out !important;
        overflow-y: auto !important;
        border-left: none !important;
        padding: 1rem !important;
    }

    /* Show palette when active */
    .exam-palette.palette-open {
        right: 0 !important;
    }

    /* Make content wrapper block instead of flex */
    div.exam-content-wrapper,
    .exam-content-wrapper,
    div.flex.exam-content-wrapper {
        display: block !important;
        flex-direction: column !important;
        width: 100% !important;
        height: auto !important;
        min-height: calc(100vh - 80px) !important;
    }

    /* Question area full width */
    div.exam-question-area,
    .exam-question-area,
    div.flex-1.p-6.overflow-y-auto.exam-question-area {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        padding: 1rem !important;
    }
}

/* Floating button to open palette - DISABLED */
.palette-toggle-btn {
    display: none !important;
}

@media screen and (max-width: 1024px) {
    .palette-toggle-btn {
        display: flex !important;
        position: fixed !important;
        bottom: 24px !important;
        right: 24px !important;
        width: 64px !important;
        height: 64px !important;
        border-radius: 50% !important;
        background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%) !important;
        color: white !important;
        border: none !important;
        box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4) !important;
        z-index: 9998 !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 28px !important;
        cursor: pointer !important;
        transition: all 0.3s ease !important;
    }

    .palette-toggle-btn:hover {
        transform: scale(1.05) !important;
        box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5) !important;
    }

    .palette-toggle-btn:active {
        transform: scale(0.95) !important;
    }
}

/* Overlay when palette is open - DISABLED */
.palette-overlay {
    display: none !important;
}

@media screen and (max-width: 1024px) {
    .palette-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: rgba(0, 0, 0, 0.6) !important;
        z-index: 9997 !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: opacity 0.3s ease, visibility 0.3s ease !important;
    }

    .palette-overlay.active {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
}

/* Close button inside palette - DISABLED */
.palette-close-btn {
    display: none !important;
}

@media screen and (max-width: 1024px) {
    .palette-close-btn {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        padding: 1rem !important;
        margin-bottom: 1rem !important;
        background: white !important;
        border: none !important;
        border-bottom: 2px solid #e5e7eb !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
        cursor: pointer !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        color: #1f2937 !important;
    }
}

/* Hide these elements on desktop */
@media screen and (min-width: 1025px) {

    .palette-toggle-btn,
    .palette-overlay,
    .palette-close-btn {
        display: none !important;
    }
}

/* Step 2: Make everything bigger and more readable */
@media screen and (max-width: 768px) {

    /* QUESTION TEXT - HUGE */
    p.question-text,
    .question-text,
    p.text-lg.text-gray-800.leading-relaxed.question-text,
    div.prose.max-w-none p,
    .exam-question-area p.text-lg {
        font-size: 20px !important;
        line-height: 1.6 !important;
        font-weight: 600 !important;
        color: #111827 !important;
    }

    /* Question card - less padding */
    .exam-question-area>div>div.bg-white.rounded-lg.border.border-gray-200 {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }

    /* Question header badges */
    .exam-question-area span.text-white.px-3.py-1,
    .exam-question-area span.bg-gray-100.text-gray-700 {
        font-size: 12px !important;
        padding: 0.5rem 0.75rem !important;
    }

    /* "Select the correct answer" heading */
    .exam-question-area h3.text-lg {
        font-size: 16px !important;
        margin-bottom: 0.75rem !important;
    }

    /* ANSWER OPTIONS - LARGE AND TAPPABLE */
    div.option-item,
    .option-item,
    div[class*="border-2 rounded-lg p-4 cursor-pointer"] {
        min-height: 64px !important;
        padding: 1rem !important;
        margin-bottom: 0.75rem !important;
        border-radius: 12px !important;
        border-width: 2px !important;
    }

    /* Answer option container */
    .option-item>div.flex.items-center {
        gap: 0.75rem !important;
    }

    /* Radio button - LARGE */
    div.option-radio,
    .option-radio,
    div[class*="w-6 h-6 rounded-full"] {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        min-height: 28px !important;
        flex-shrink: 0 !important;
    }

    .option-radio>div,
    .option-radio div[class*="w-3 h-3"] {
        width: 16px !important;
        height: 16px !important;
    }

    /* Option label (A, B, C, D) */
    .option-item span.font-medium.text-gray-700 {
        font-size: 16px !important;
        font-weight: 600 !important;
    }

    /* Option text */
    .option-item span.text-gray-800 {
        font-size: 18px !important;
        line-height: 1.5 !important;
        font-weight: 500 !important;
    }
}

/* Step 3: Navigation buttons - mobile friendly */
@media screen and (max-width: 768px) {

    /* Navigation container */
    div.exam-nav-buttons,
    .exam-nav-buttons,
    div.flex.items-center.justify-between.exam-nav-buttons {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100% !important;
    }

    /* Previous and Next buttons - full width */
    .exam-nav-buttons>button {
        width: 100% !important;
        min-height: 48px !important;
        justify-content: center !important;
        padding: 0.75rem 1rem !important;
        font-size: 16px !important;
    }

    /* Action buttons container */
    div.exam-action-buttons,
    .exam-action-buttons,
    div.flex.items-center.exam-action-buttons {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.75rem !important;
        order: 2 !important;
    }

    /* Clear Response, Mark Review, Save & Next - full width */
    .exam-action-buttons>button {
        width: 100% !important;
        min-height: 48px !important;
        padding: 0.75rem 1rem !important;
        font-size: 16px !important;
        justify-content: center !important;
    }

    /* Progress bar container */
    .exam-nav-buttons+div,
    div.mt-4>div.flex.items-center.justify-between.progress-info {
        flex-direction: column !important;
        gap: 0.5rem !important;
        align-items: flex-start !important;
    }
}

/* Step 4: Compact header for mobile */
@media screen and (max-width: 768px) {

    /* Main header */
    header.exam-header,
    header.bg-white.shadow-lg.exam-header {
        padding: 0.75rem 1rem !important;
    }

    /* Header inner container */
    .exam-header>div.flex.items-center.justify-between {
        flex-direction: column !important;
        gap: 0.75rem !important;
        padding: 0 !important;
    }

    /* Logo and title */
    .exam-header img {
        width: 2rem !important;
        height: 2rem !important;
    }

    .exam-header h1 {
        font-size: 13px !important;
        line-height: 1.2 !important;
    }

    .exam-header p {
        font-size: 10px !important;
    }

    /* Timer box */
    .exam-header div[style*="background-color: #3B82F6"] {
        padding: 0.5rem 0.75rem !important;
        font-size: 12px !important;
    }

    /* Submit button */
    .exam-header button {
        min-height: 44px !important;
        padding: 0.625rem 1rem !important;
        font-size: 14px !important;
    }
}

/* Step 5: Smaller screens - even more adjustments */
@media screen and (max-width: 480px) {

    .question-text {
        font-size: 18px !important;
    }

    .option-item span.text-gray-800 {
        font-size: 16px !important;
    }

    .exam-nav-buttons button,
    .exam-action-buttons button {
        font-size: 14px !important;
    }
}

/* Step 6: Ensure mobile spacing is consistent */
@media screen and (max-width: 768px) {

    /* Space between sections */
    .exam-question-area>div.space-y-6 {
        gap: 1rem !important;
    }

    .exam-question-area>div.space-y-6>div {
        margin-bottom: 1rem !important;
    }
}

/* Step 7: Hide unnecessary elements on mobile */
@media screen and (max-width: 768px) {

    /* Hide any desktop-only decorations */
    .hidden-mobile {
        display: none !important;
    }
}