/* =====================================================================
   LET on phones + LET as an installed app (PWA)               19 Nov 2026
   Loaded by Views/Shared/_LetPwa.cshtml (head of the student layouts) on
   every student page, whether or not the PWA switch is on.

   Every selector starts with "html" so it outranks the inline <style>
   blocks of Index.cshtml / pv_Assignmentv2.cshtml that come later in the
   page. Nothing here applies above 991px - desktop is unchanged.

   html.let-app = running as the installed app (set by _LetPwa.cshtml from
   display-mode standalone; ?letapp=1 previews it in any browser for that tab).
   ===================================================================== */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* ---------------------------------------------------------------- 991px and down
   The v2 view pins .let-sidebar with position:sticky + max-height:100vh for the
   desktop left column. Once the sidebar collapses to a full-width block above the
   content (<= 1024px) that rule made it STICK to the top of the screen and cover
   the page while scrolling. On phones/tablets it is a normal block again. */
@media (max-width: 991px) {
    html body .let-v2-root .let-sidebar {
        position: static !important;
        top: auto !important;
        max-height: none !important;
        overflow: visible !important;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px 12px !important;
        background: var(--let-white, #fff);
    }
    html body .let-v2-root .let-main-content { min-width: 0; width: 100%; }

    /* Sections: ONE swipeable row of chips instead of 2-4 wrapped lines */
    html body .let-v2-root .let-sidebar-section { margin: 0 !important; min-width: 0; }
    html body .let-v2-root .let-sidebar-section:first-child { flex: 1 1 100%; }
    html body .let-v2-root .let-sidebar-section:first-child .let-sidebar-label { display: none; }
    html body .let-v2-root .let-sidebar-nav {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
        gap: 8px !important;
        padding: 2px 2px 4px !important;
        margin: 0 !important;
    }
    html body .let-v2-root .let-sidebar-nav::-webkit-scrollbar { display: none; }
    html body .let-v2-root .let-sidebar-link {
        flex: 0 0 auto !important;
        width: auto !important;
        white-space: nowrap;
        scroll-snap-align: start;
        border: 1px solid var(--let-gray-200, #E5E7EB);
        border-radius: 999px !important;
        background: var(--let-white, #fff);
        padding: 8px 14px !important;
        font-size: 13px !important;
        min-height: 38px;
    }
    html body .let-v2-root .let-sidebar-link.active {
        border-color: var(--let-primary, #0A6BCB);
        background: var(--let-primary-light, #EBF5FF);
        color: var(--let-primary, #0A6BCB);
    }

    /* Trainer / Attendance / Qubits score: small cards side by side */
    html body .let-v2-root .let-sidebar-divider { display: none !important; }
    html body .let-v2-root .let-sidebar-section:not(:first-child) {
        flex: 1 1 140px;
        border: 1px solid var(--let-gray-200, #E5E7EB);
        border-radius: 12px;
        padding: 8px 6px 6px;
        background: var(--let-white, #fff);
    }
    html body .let-v2-root .let-sidebar-section:not(:first-child) .let-sidebar-label {
        padding: 0 6px !important;
        margin-bottom: 4px !important;
        font-size: 11px;
    }
    html body .let-v2-root .let-sidebar-trainer { margin: 0 !important; padding: 2px 6px; }

    /* Course switcher: the chip had min-width 280px + 24px margins = wider than a 320-360px phone */
    html body .let-v2-root #letV2CourseSwitcher { margin: 12px !important; gap: 8px !important; }
    html body .let-v2-root #letV2CourseSwitcher > .let-v2-course-chip { min-width: 0 !important; flex: 1 1 100% !important; }
}

/* ---------------------------------------------------------------- 768px and down */
@media (max-width: 768px) {
    html body { overflow-x: clip; }
    html body .let-v2-root img,
    html body .let-v2-root video,
    html body .let-v2-root iframe { max-width: 100%; }
    html body .let-v2-root { -webkit-tap-highlight-color: rgba(10, 107, 203, .12); }

    /* iOS zooms the page on focus when an input's text is under 16px */
    html body .let-v2-root input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    html body .let-v2-root select,
    html body .let-v2-root textarea,
    html body .chat input,
    html body .chat textarea,
    html body .modal input:not([type="checkbox"]):not([type="radio"]),
    html body .modal select,
    html body .modal textarea { font-size: 16px !important; }

    /* Room at the bottom so the Veeru button never sits on the last row */
    html body .let-v2-root .let-main-content { padding-bottom: 96px !important; }

    /* Bottom action bar: two even columns of buttons instead of a ragged wrap */
    html body .let-v2-root .let-v2-action-bar { padding: 12px !important; margin: 16px 0 24px !important; gap: 8px !important; }
    html body .let-v2-root .let-v2-action-bar .let-action-btn {
        flex: 1 1 calc(50% - 8px);
        justify-content: center;
        text-align: center;
        white-space: normal;
        padding: 10px 12px;
        min-height: 42px;
    }

    /* Tabs: bigger touch targets, still one swipeable row */
    html body .let-v2-root .let-tab-btn { min-height: 42px; white-space: nowrap; }

    /* ---------------- header (#SmMenu = the phone header of _HeaderStudent) ----------------
       Row 1 was logo + Explore + How LET Works + Edit profile + FAQ + language,
       wrapping onto 2-3 uneven lines. Now: one line, logo pinned left, the rest swipe. */
    html body #SmMenu > .container-fluid {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    html body #SmMenu .row.smhtWebinar {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 8px;
        margin: 0 !important;
        padding: 8px 0 !important;
        align-items: center !important;
    }
    html body #SmMenu .row.smhtWebinar::-webkit-scrollbar { display: none; }
    html body #SmMenu .row.smhtWebinar > [class*="col"] {
        flex: 0 0 auto !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    html body #SmMenu .row.smhtWebinar > [class*="col"]:first-child {
        position: sticky;
        left: 0;
        z-index: 2;
        background: #fff;
        padding-right: 6px !important;
    }
    html body #SmMenu .logoDiv img { height: 32px !important; width: auto !important; }
    html body #SmMenu .webedtprfl .d-flex { gap: 8px; flex-wrap: nowrap !important; }
    html body #SmMenu .navLinks,
    html body #SmMenu .smrtmrgin { margin: 0 !important; padding: 0 !important; }
    html body #SmMenu .dropdownCoursess,
    html body #SmMenu .LETVideo,
    html body #SmMenu .EditProfileBtn,
    html body #SmMenu .FAQBtn {
        display: inline-flex !important;
        align-items: center;
        gap: 6px;
        width: auto !important;
        margin: 0 !important;
        padding: 7px 12px !important;
        border: 1px solid #D6E4F0 !important;
        border-radius: 999px !important;
        background: #fff !important;
        color: #0A6BCB !important;
        font-size: 13px !important;
        font-weight: 500;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        min-height: 34px;
    }
    html body #SmMenu .LETVideo span { width: auto !important; }

    /* Row 2: "Welcome, <name> (<id>)" on the left, profile menu on the right */
    html body #SmMenu .container-fluid .row:nth-child(2) {
        margin: 0 !important;
        padding: 6px 0 !important;
        flex-wrap: nowrap !important;
        border-bottom: 1px solid #E5E7EB;
    }
    html body #SmMenu .wenrCrnterTextSm {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 2px 6px;
        text-align: left !important;
        min-width: 0;
    }
    html body #SmMenu .wenrCrnterTextSm > div { display: inline-flex; justify-content: flex-start !important; }
    html body #SmMenu .wenrCrnterTextSm .webfntSmsev {
        font-size: 14px;
        max-width: 60vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
        vertical-align: bottom;
    }

    /* ---------------- popups ---------------- */
    html body .faq-boxx { width: calc(100% - 16px) !important; max-height: calc(100% - 24px) !important; border-radius: 16px; }
    html body #accordionExample { height: auto !important; max-height: calc(100vh - 150px); }
    html body .faqHeader h2 { font-size: 18px; }
    html body .let-qa-modal { width: calc(100% - 16px) !important; max-height: calc(100vh - 24px); overflow-y: auto; }
    html body .let-video-modal { padding: 8px; }
    html body .modal-dialog:not(.modal-fullscreen) { margin: 8px auto; max-width: calc(100% - 16px); }
    html body .modal-content { max-height: calc(100vh - 16px); overflow-y: auto; }
}

/* ---------------------------------------------------------------- installed app only */
html.let-app .let-pwa-install { display: none !important; }

/* Long-press on a button should not pop the text-selection / "copy link" menu in an app */
html.let-app button,
html.let-app .let-sidebar-link,
html.let-app .let-tab-btn,
html.let-app .let-action-btn,
html.let-app .let-hero-btn {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Fixed bottom buttons clear the iPhone home bar (0 on phones without one) */
html.let-app .let-v2-chat-fab,
html.let-app #prime.fab2 { margin-bottom: env(safe-area-inset-bottom, 0px); }

@media (max-width: 768px) {
    /* "Explore All Courses" opens the public website in a browser - clutter inside the app */
    html.let-app body #SmMenu .webAllCrs { display: none !important; }
}
