/* Mobile Sidebar Overlay Components
   Loaded on all pages — styles for sidebar overlays on mobile (<1024px).
   Desktop rules hide these elements via _universal_grid.css. */

/* Backdrop — dims content when a sidebar overlay is open */
.mobile-sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s;
}

.mobile-sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Close button — inside each sidebar overlay */
.mobile-sidebar-close {
    position: absolute;
    top: var(--spacing-2);
    right: var(--spacing-2);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: var(--font-size-2xl);
    color: var(--color-gray-600);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    z-index: 1;
}

.mobile-sidebar-close:hover,
.mobile-sidebar-close:focus-visible {
    color: var(--color-text-primary);
}

/* Mobile brand text in navbar */
.navbar-brand-mobile {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    text-decoration: none;
    white-space: nowrap;
    margin-left: var(--spacing-4);
}

.navbar-brand-mobile:hover {
    color: var(--color-accent);
    text-decoration: none;
}

/* Sidebar footer with nav links + CTA (mobile only) */
.sidebar-fixed-footer {
    display: none;
}

/* Nav links section inside sidebar footer */
.mobile-nav-links {
    display: none;
}

@media (max-width: 1023px) {
    /* Hide header create button on mobile — shown in footer instead */
    .sidebar-fixed-header .sidebar-action-button--header {
        display: none !important;
    }

    /* Footer: nav links + CTA pinned at bottom of sidebar */
    .sidebar-fixed-footer {
        display: block;
        flex-shrink: 0;
        padding: var(--spacing-3) var(--spacing-4);
        padding-bottom: calc(var(--spacing-3) + env(safe-area-inset-bottom));
        border-top: var(--border-width-1) solid var(--color-gray-200);
        background-color: var(--color-gray-100);
    }

    .sidebar-fixed-footer .sidebar-action-button {
        width: 100%;
    }

    /* Nav links row inside footer */
    .sidebar-fixed-footer .mobile-nav-links {
        display: flex;
        gap: var(--spacing-2);
        margin-bottom: var(--spacing-2);
    }

    /* Pill-style nav buttons */
    .sidebar-fixed-footer .mobile-nav-link {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        padding: var(--spacing-2) var(--spacing-3);
        background-color: var(--color-white);
        border: var(--border-width-1) solid var(--color-gray-200);
        border-radius: var(--radius-base);
        color: var(--color-gray-600);
        font-weight: var(--font-weight-medium);
        text-decoration: none;
    }

    .sidebar-fixed-footer .mobile-nav-link:hover,
    .sidebar-fixed-footer .mobile-nav-link:focus {
        color: var(--color-accent);
        background-color: var(--color-gray-200);
        text-decoration: none;
    }

    .sidebar-fixed-footer .mobile-nav-link.active {
        color: var(--color-accent);
        font-weight: var(--font-weight-bold);
    }
}

/* Scroll lock when sidebar overlay is open */
body.mobile-sidebar-active {
    overflow: hidden;
}

/* Safe-area inset for notched devices (right sidebar only — left sidebar handled by footer) */
@media (max-width: 1023px) {
    .site-right-sidebar.mobile-open {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
