/* Mobile navigation and bottom-sheet controls for public/content pages. */

.mobile-bottom-nav,
.mobile-more-backdrop,
.mobile-more-sheet,
.mobile-filter-trigger,
.mobile-list-filter-backdrop,
.mobile-list-filter-head,
.mobile-list-filter-actions {
    display: none;
}

@media (max-width: 760px) {
    body[data-page] {
        font-size: 15px;
    }

    body {
        padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
    }

    .mobile-bottom-item,
    .mobile-more-account,
    .mobile-more-close,
    .mobile-more-item,
    .mobile-filter-trigger,
    .list-tools button {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .mobile-bottom-item:focus:not(:focus-visible),
    .mobile-more-account:focus:not(:focus-visible),
    .mobile-more-close:focus:not(:focus-visible),
    .mobile-more-item:focus:not(:focus-visible),
    .mobile-filter-trigger:focus:not(:focus-visible),
    .list-tools button:focus:not(:focus-visible) {
        outline: none;
        box-shadow: none;
    }

    body.mobile-sheet-open {
        overflow: hidden;
    }

    .sidebar {
        position: sticky;
        top: 0;
        z-index: 34;
        display: block;
        min-height: 0;
        gap: 0;
        padding: 12px 16px 10px;
        background: rgba(250, 250, 250, .9);
        backdrop-filter: saturate(120%) blur(16px);
        -webkit-backdrop-filter: saturate(120%) blur(16px);
    }

    .sidebar-brand {
        padding: 0;
        border-bottom: 0;
    }

    .sidebar-brand .brand-wordmark {
        width: min(148px, 48vw);
    }

    .sidebar-brand p {
        margin-top: 2px;
        font-size: 11px;
    }

    .side-nav,
    .sidebar-footer {
        display: none;
    }

    .main-panel {
        padding: 14px 14px calc(96px + env(safe-area-inset-bottom, 0px));
    }

    .topbar {
        gap: 8px;
        margin-bottom: 14px;
    }

    .topbar h2 {
        font-size: 20px;
    }

    .topbar-actions {
        display: none;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        z-index: 70;
        width: min(430px, calc(100% - 24px));
        margin: 0 auto;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
        align-items: center;
        min-height: 52px;
        overflow: hidden;
        padding: 4px;
        border: 1px solid rgba(228, 228, 231, .88);
        border-radius: 999px;
        background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(247, 247, 249, .94));
        box-shadow: 0 12px 28px rgba(15, 23, 42, .13), 0 2px 7px rgba(15, 23, 42, .05), inset 0 1px 0 rgba(255, 255, 255, .9);
        isolation: isolate;
        backdrop-filter: saturate(140%) blur(18px);
        -webkit-backdrop-filter: saturate(140%) blur(18px);
    }

    .mobile-bottom-item {
        min-width: 0;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 0 7px;
        border: 0;
        border-radius: 999px;
        background: transparent;
        color: #6f717a;
        box-shadow: none;
        font-size: 11.5px;
        font-weight: 760;
        line-height: 1;
        letter-spacing: 0;
        text-decoration: none;
        white-space: nowrap;
        transform: none;
        transition: color .16s ease, background .16s ease, box-shadow .16s ease;
    }

    .mobile-bottom-item:hover,
    .mobile-bottom-item:focus-visible {
        color: #111827;
        background: rgba(244, 244, 245, .88);
        box-shadow: none;
        transform: none;
        text-decoration: none;
    }

    .mobile-bottom-item.active {
        color: #fff;
        background: linear-gradient(180deg, #111827, #090d18);
        box-shadow: 0 7px 16px rgba(17, 24, 39, .2), inset 0 1px 0 rgba(255, 255, 255, .1);
    }

    .mobile-bottom-item > span:not(.mobile-bottom-icon) {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        transform: translateY(.5px);
    }

    .mobile-bottom-icon {
        width: 16px;
        height: 16px;
        display: inline-grid;
        flex: 0 0 auto;
        place-items: center;
    }

    .mobile-bottom-icon .nav-svg {
        width: 16px;
        height: 16px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2.05;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .mobile-more-item-icon .nav-svg,
    .mobile-more-item-icon .account-menu-svg,
    .mobile-more-close svg {
        width: 17px;
        height: 17px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2.05;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .mobile-bottom-more {
        color: #111827;
        background: rgba(243, 244, 246, .92);
        box-shadow: inset 0 0 0 1px rgba(17, 24, 39, .035);
    }

    .mobile-bottom-more.active {
        color: #fff;
        background: linear-gradient(180deg, #111827, #090d18);
        box-shadow: 0 7px 16px rgba(17, 24, 39, .2), inset 0 1px 0 rgba(255, 255, 255, .1);
    }

    .mobile-more-backdrop,
    .mobile-list-filter-backdrop {
        position: fixed;
        inset: 0;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        z-index: 80;
        display: block;
        background: rgba(15, 23, 42, .34);
        opacity: 0;
        pointer-events: none;
        transition: opacity .18s ease;
    }

    body.mobile-more-open .mobile-more-backdrop,
    body.mobile-list-filter-open .mobile-list-filter-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-more-sheet {
        position: fixed;
        left: 50%;
        right: auto;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        z-index: 90;
        width: min(430px, calc(100% - 24px));
        max-height: min(70vh, 560px);
        display: grid;
        gap: 10px;
        overflow: auto;
        padding: 12px 14px 14px;
        border: 1px solid #ececee;
        border-radius: 16px;
        background: #fff;
        box-shadow: 0 22px 72px rgba(15, 23, 42, .24);
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
        transform: translate(-50%, 10px) scale(.98);
        transform-origin: 50% 100%;
        transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
    }

    body.mobile-more-open .mobile-more-sheet {
        opacity: 1;
        pointer-events: auto;
        visibility: visible;
        transform: translate(-50%, 0) scale(1);
    }

    .mobile-more-handle {
        display: none;
    }

    .mobile-more-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px;
    }

    .mobile-more-head h2 {
        font-size: 17px;
        line-height: 1.18;
    }

    .mobile-more-head p {
        margin-top: 2px;
        color: #74747e;
        font-size: 12px;
        line-height: 1.35;
    }

    .mobile-more-close {
        display: none;
        width: 36px;
        min-height: 36px;
        place-items: center;
        padding: 0;
        border-color: #ececee;
        border-radius: 50%;
        background: #fff;
        color: #111827;
        box-shadow: none;
    }

    .mobile-more-account {
        width: 100%;
        min-height: 56px;
        justify-content: flex-start;
        gap: 10px;
        padding: 8px 10px;
        border-color: #ececee;
        border-radius: 12px;
        background: #f7f7f8;
        color: #111827;
        box-shadow: none;
        text-align: left;
    }

    .mobile-more-account-avatar {
        width: 36px;
        height: 36px;
        display: grid;
        flex: 0 0 auto;
        place-items: center;
        overflow: hidden;
        border-radius: 10px;
        background: #111827;
        color: #fff;
        font-weight: 800;
    }

    .mobile-more-account-avatar img {
        width: 100%;
        height: 100%;
        display: block;
        object-fit: cover;
    }

    .mobile-more-account-copy {
        min-width: 0;
        display: grid;
        gap: 2px;
    }

    .mobile-more-account-copy strong {
        font-size: 13px;
        line-height: 1.25;
    }

    .mobile-more-account-copy strong,
    .mobile-more-account-copy small {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-more-account-copy small {
        color: #74747e;
        font-size: 11px;
        line-height: 1.25;
    }

    .mobile-more-section {
        display: grid;
        gap: 7px;
    }

    .mobile-more-section h3 {
        color: #74747e;
        font-size: 11px;
        font-weight: 800;
    }

    .mobile-more-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 7px;
    }

    .mobile-more-item {
        min-width: 0;
        min-height: 54px;
        display: grid;
        place-items: center;
        gap: 5px;
        padding: 6px 5px;
        border: 1px solid #ececee;
        border-radius: 11px;
        background: #fff;
        color: #111827;
        box-shadow: none;
        font-size: 12px;
        font-weight: 700;
        line-height: 1.15;
        text-decoration: none;
        text-align: center;
        transform: none;
    }

    @media (hover: hover) {
        .mobile-more-item:hover,
        .mobile-more-item:focus-visible {
            background: #f8f8f9;
            box-shadow: none;
            transform: none;
            text-decoration: none;
        }
    }

    .mobile-more-item.active {
        border-color: #111827;
        background: #111827;
        color: #fff;
    }

    @media (hover: none) {
        .mobile-bottom-item:hover,
        .mobile-bottom-item:active,
        .mobile-bottom-item:focus-visible {
            color: #6f717a;
            background: transparent;
            box-shadow: none;
            transform: none;
        }

        .mobile-bottom-more:hover,
        .mobile-bottom-more:active,
        .mobile-bottom-more:focus-visible {
            color: #111827;
            background: rgba(243, 244, 246, .92);
            box-shadow: inset 0 0 0 1px rgba(17, 24, 39, .035);
            transform: none;
        }

        .mobile-bottom-item.active:hover,
        .mobile-bottom-item.active:active,
        .mobile-bottom-item.active:focus-visible,
        .mobile-bottom-more.active:hover,
        .mobile-bottom-more.active:active {
            color: #fff;
            background: linear-gradient(180deg, #111827, #090d18);
            box-shadow: 0 7px 16px rgba(17, 24, 39, .2), inset 0 1px 0 rgba(255, 255, 255, .1);
        }

        .mobile-more-account:hover,
        .mobile-more-account:active {
            background: #f7f7f8;
            color: #111827;
            box-shadow: none;
            transform: none;
        }

        .mobile-more-close:hover,
        .mobile-more-close:active,
        .mobile-more-item:hover,
        .mobile-more-item:active,
        .mobile-filter-trigger:hover,
        .mobile-filter-trigger:active,
        .list-tools button:hover,
        .list-tools button:active {
            box-shadow: none;
            transform: none;
        }

        .mobile-more-item:hover,
        .mobile-more-item:active {
            background: #fff;
            color: #111827;
        }

        .mobile-more-item.active:hover,
        .mobile-more-item.active:active {
            background: #111827;
            color: #fff;
        }
    }

    .mobile-more-item-icon {
        width: 19px;
        height: 19px;
        display: inline-grid;
        place-items: center;
    }

    .mobile-more-item-wide {
        grid-column: span 2;
    }

    .list-toolbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 7px;
        min-height: 0;
        margin-bottom: 10px;
        padding-bottom: 10px;
    }

    .list-search {
        min-width: 0;
        max-width: none;
        flex-basis: auto;
    }

    .list-search input {
        min-height: 38px;
        padding: 8px 13px;
        border-radius: 13px;
        font-size: 13px;
    }

    .mobile-filter-trigger {
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        padding: 0 11px;
        border-color: #dededf;
        border-radius: 999px;
        background: #fff;
        color: #111827;
        box-shadow: 0 1px 2px rgba(15, 15, 25, .035);
        font-size: 11.5px;
        font-weight: 800;
    }

    .mobile-filter-trigger small {
        max-width: 78px;
        overflow: hidden;
        color: #74747e;
        font-size: 10.5px;
        font-weight: 700;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .list-tools {
        position: fixed;
        left: 50%;
        right: auto;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        z-index: 92;
        width: min(430px, calc(100% - 24px));
        display: grid;
        justify-content: stretch;
        justify-items: center;
        align-content: start;
        gap: 7px;
        max-height: min(68vh, 520px);
        overflow: auto;
        padding: 8px 14px 14px;
        border: 1px solid #ececee;
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 22px 64px rgba(15, 23, 42, .22);
        opacity: 0;
        pointer-events: none;
        transform: translate(-50%, 10px) scale(.98);
        transform-origin: 50% 100%;
        visibility: hidden;
        transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
    }

    .list-toolbar.mobile-filter-open .list-tools {
        opacity: 1;
        pointer-events: auto;
        transform: translate(-50%, 0) scale(1);
        visibility: visible;
    }

    .mobile-list-filter-head {
        position: sticky;
        top: -8px;
        z-index: 1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        justify-self: stretch;
        gap: 12px;
        margin: -8px -14px 2px;
        padding: 9px 14px 8px;
        border-bottom: 1px solid #f0f1f3;
        background: #fff;
    }

    .mobile-list-filter-head strong {
        font-size: 15px;
        font-weight: 400;
        line-height: 1.2;
    }

    .mobile-list-filter-head button {
        display: none;
    }

    .mobile-list-filter-actions {
        display: none !important;
    }

    .list-tools .chip-strip {
        width: fit-content;
        max-width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        overflow: visible;
        padding: 0;
    }

    .list-tools .chip-btn {
        min-height: 31px;
        padding: 0 10px;
        font-size: 11.5px;
    }

    .list-tools .chip-count {
        min-width: 18px;
        height: 16px;
        padding: 0 5px;
        font-size: 10px;
    }

    .list-tools .segmented.tiny {
        width: fit-content;
        max-width: 100%;
        justify-self: center;
        align-self: center;
        min-height: 34px;
        padding: 2px;
    }

    .list-tools .segmented.tiny button {
        flex: 0 0 auto;
        min-width: 82px;
        min-height: 30px;
        padding: 0 13px;
        font-size: 12px;
    }

    .course-detail .lesson-filter-panel .chip-strip {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
}

@media (max-width: 380px) {
    .mobile-bottom-item {
        gap: 4px;
        padding: 0 6px;
        font-size: 11.5px;
    }

    .mobile-bottom-icon {
        width: 16px;
        height: 16px;
    }

    .mobile-more-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
