/* ==========================================================================
   Mobile drawer (st-popup) redesign — additive, does not modify dashcore.css
   Scoped to the mobile nav section; desktop navbar untouched.
   ========================================================================== */

.st-nav .st-nav-section.st-nav-mobile .mnav-overlay {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(6, 10, 18, .55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .24s ease-out;
}

.st-nav .st-nav-section.st-nav-mobile.st-popup-active .mnav-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* ---- Drawer frame ---- */
.st-nav .st-nav-section.st-nav-mobile .st-popup {
    position: fixed;
    inset: 0;
    z-index: 1050;
    perspective: none;
    -webkit-perspective: none;
    /* NOTE: do NOT add overflow/clip-path here — the navbar ancestor creates
       a containing block for this fixed frame (it is only as tall as the
       navbar), so clipping would cut the drawer body off. */
}

.st-nav .st-nav-section.st-nav-mobile .st-popup .st-popup-container.mnav {
    width: min(88vw, 360px);
    max-width: min(88vw, 360px);
    height: 100dvh;
    flex-grow: 0;
    margin-left: auto;
    border-radius: 20px 0 0 20px;
    padding: 0 16px 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    white-space: normal;
    font-size: 1rem;
    line-height: 1.5;

    background:
        radial-gradient(420px 300px at 100% 0%, rgba(99, 91, 255, .14), transparent 70%),
        var(--dc-tertiary-bg);
    border-left: 1px solid var(--dc-border-color);
    box-shadow: -18px 0 50px rgba(0, 0, 0, .25);

    /* hidden state (dashcore default is a rotate3d flip — replace with a soft fade).
       Must NOT translate on X: any rightward offset overflows the 90px-tall fixed
       frame, and that overflow EXPANDS the mobile layout viewport
       (innerWidth 399 instead of 375), shifting the whole page. */
    transform: none;
    -webkit-transform: none;
    opacity: 0;
    transition: opacity .24s ease-out;
    will-change: opacity;
}

.st-nav .st-nav-section.st-nav-mobile.st-popup-active .st-popup .st-popup-container.mnav {
    transform: none;
    -webkit-transform: none;
    opacity: 1;
    pointer-events: auto;
}

/* prevent page scroll while the drawer is open */
body:has(.st-popup-active) {
    overflow: hidden;
}

/* ---- Header ---- */
.mnav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 62px;
    margin: 0 -16px;
    padding: 0 16px;
    border-bottom: 1px solid var(--dc-border-color);
}

.mnav-brand {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.mnav-brand .logo {
    height: 26px;
    width: auto;
}

/* dashcore's close button is a 51px hitbox with an "x" built from pseudos */
.st-nav .st-popup .st-popup-close-button.mnav-close {
    position: relative;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    transition: background-color .18s ease;
}

.st-nav .st-popup .st-popup-close-button.mnav-close:hover {
    background: rgba(99, 91, 255, .12);
}

.st-nav .st-popup .st-popup-close-button.mnav-close::before,
.st-nav .st-popup .st-popup-close-button.mnav-close::after {
    left: 10px;
    right: 10px;
    top: 19px;
    height: 2px;
    border-radius: 2px;
    background: var(--dc-body-color);
}

/* ---- Nav links ---- */
.mnav-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 0 0;
}

.st-nav .st-popup a.mnav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    padding: 8px 12px;
    border-radius: 12px;
    color: var(--dc-emphasis-color);
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color .18s ease, color .18s ease;
}

.st-nav .st-popup a.mnav-link:hover {
    background: rgba(99, 91, 255, .08);
    color: var(--dc-emphasis-color);
}

.mnav-link-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 14px;
    color: #8b7cff;
    background: rgba(99, 91, 255, .12);
}

.mnav-link-text {
    flex: 1 1 auto;
    min-width: 0;
}

.mnav-chevron {
    font-size: 11px;
    opacity: .45;
}

.st-nav .st-popup a.mnav-link--active,
.st-nav .st-popup a.mnav-link--active:hover {
    background: linear-gradient(92deg, #635BFF, #3478F6);
    color: #fff;
    box-shadow: 0 6px 18px rgba(99, 91, 255, .30);
}

.st-nav .st-popup a.mnav-link--active .mnav-link-icon {
    background: rgba(255, 255, 255, .18);
    color: #fff;
}

.st-nav .st-popup a.mnav-link--active .mnav-chevron {
    opacity: .8;
}

/* ---- CTA block ---- */
.mnav-cta {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 20px;
}

.mnav-cta form {
    margin: 0;
}

.st-nav .st-popup .mnav-cta-btn,
.st-nav .st-popup a.mnav-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 50px;
    padding: 10px 16px;
    border: 0;
    border-radius: 14px;
    font-size: 15.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: filter .18s ease, background-color .18s ease, color .18s ease;
}

.mnav-cta-btn--primary {
    background: linear-gradient(92deg, #635BFF, #3478F6);
    color: #fff;
    box-shadow: 0 8px 22px rgba(99, 91, 255, .32);
}

.mnav-cta-btn--primary:hover {
    filter: brightness(1.08);
    color: #fff;
}

.mnav-cta-btn--ghost {
    background: transparent;
    border: 1px solid var(--dc-border-color) !important;
    color: var(--dc-emphasis-color);
}

.mnav-cta-btn--ghost:hover {
    background: rgba(99, 91, 255, .08);
}

.mnav-cta-btn--danger {
    background: rgba(255, 0, 128, .10);
    color: var(--dc-danger);
}

.mnav-cta-btn--danger:hover {
    background: rgba(255, 0, 128, .16);
}

/* ---- Settings ---- */
.mnav-settings {
    margin-top: auto;
    padding-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.mnav-settings-label {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .05em;
    color: var(--dc-secondary-color);
}

.mnav-seg {
    display: flex;
    gap: 3px;
    padding: 3px;
    border-radius: 12px;
    border: 1px solid var(--dc-border-color);
    background: rgba(128, 138, 160, .08);
}

.st-nav .st-popup .mnav-seg .mnav-seg-btn {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--dc-secondary-color);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.st-nav .st-popup .mnav-seg .mnav-seg-btn:hover {
    color: var(--dc-emphasis-color);
}

.st-nav .st-popup .mnav-seg .mnav-seg-btn[aria-pressed="true"],
.st-nav .st-popup .mnav-seg .mnav-seg-btn.mnav-seg-btn--active {
    background: linear-gradient(92deg, #635BFF, #3478F6);
    color: #fff;
    box-shadow: 0 3px 10px rgba(99, 91, 255, .30);
}

/* ---- Light theme adjustments ---- */
[data-bs-theme="light"] .st-nav .st-nav-section.st-nav-mobile .st-popup .st-popup-container.mnav {
    background:
        radial-gradient(420px 300px at 100% 0%, rgba(99, 91, 255, .08), transparent 70%),
        #ffffff;
    box-shadow: -18px 0 45px rgba(20, 30, 60, .12);
}

[data-bs-theme="light"] .mnav-link-icon {
    color: #635BFF;
    background: rgba(99, 91, 255, .10);
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    .st-nav .st-nav-section.st-nav-mobile .st-popup .st-popup-container.mnav,
    .st-nav .st-nav-section.st-nav-mobile .mnav-overlay {
        transition: none;
    }
}
