/* Navigation V2 - MindShift Layout Logic */

/* ═══════════════════════════════════════════════════════════ */
/* SIDEBAR NAVIGATION (Desktop Only) */
/* ═══════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
    .sidebar-nav {
        display: none !important;
    }
}

/* Desktop sidebar behavior */
@media (min-width: 768px) {
    .sidebar-nav {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        background: var(--bg-sidebar, #ffffff);
        border-right: 1px solid var(--border-light, #efefef);
        z-index: 1000;
        flex-direction: column;
        transition: width 0.3s ease;
    }
}

/* Minimized state */
.sidebar-nav.minimized {
    width: 80px;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    border-bottom: 1px solid var(--cool-gray, #efefef);
    min-height: 64px;
    overflow: hidden; /* prevent logo bleeding outside */
}

/* Logo wrapper — collapses fully when minimized */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--slate, #262626);
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    /* animate collapse */
    max-width: 180px;
    opacity: 1;
    transition: max-width 0.28s ease, opacity 0.2s ease;
    flex-shrink: 1;
    min-width: 0;
}

/* SVG logo image — fixed size, never overflows */
.sidebar-logo i {
    font-size: 1.4rem;
    color: #7C3AED;
    flex-shrink: 0;
}

.sidebar-logo-text {
    overflow: hidden;
    text-overflow: ellipsis;
    transition: max-width 0.28s ease, opacity 0.2s ease;
    max-width: 140px;
}

/* ── When minimized: slide logo out, keep only the toggle ── */
.sidebar-nav.minimized .sidebar-logo {
    max-width: 0;
    opacity: 0;
    pointer-events: none;
}

/* Center the toggle button when logo is hidden */
.sidebar-nav.minimized .sidebar-header {
    justify-content: center;
    padding: 0;
}

.sidebar-toggle-btn {
    background: transparent;
    border: none;
    font-size: 1.15rem;
    color: var(--slate, #262626);
    cursor: pointer;
    padding: 9px;
    border-radius: 8px;
    transition: background 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
}

.sidebar-mobile-close {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid var(--cool-gray, #efefef);
    border-radius: 10px;
    background: var(--white, #ffffff);
    color: var(--slate, #262626);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sidebar-toggle-btn:hover {
    background: var(--cool-gray, #efefef);
}

/* Sidebar Menu */
.sidebar-menu {
    flex: 1;
    min-height: 0;
    padding: 20px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: var(--cool-gray, #efefef);
    border-radius: 4px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    color: var(--lavender, #8e8e8e);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
}

.sidebar-item i {
    font-size: 1.3rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.sidebar-item-text {
    transition: opacity 0.3s ease;
    overflow: hidden;
}

.sidebar-nav.minimized .sidebar-item-text {
    opacity: 0;
    width: 0;
}

.sidebar-item:hover {
    background: rgba(124, 58, 237, 0.05);
    color: #7C3AED;
}

.sidebar-item.active {
    background: rgba(124, 58, 237, 0.1);
    color: #7C3AED;
    font-weight: 600;
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #7C3AED;
    border-radius: 0 4px 4px 0;
}

/* Sidebar Footer */
.sidebar-footer {
    border-top: 1px solid var(--cool-gray, #efefef);
    padding: 20px 0;
    flex-shrink: 0;
}

/* ── Sidebar Logout Button ─────────────────────────────────── */
/* Inherits all .sidebar-item styles; reset button defaults */
.sidebar-logout-btn {
    width: 100%;
    background: transparent;
    border: none;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    /* Remove default button radius / outline */
    border-radius: 0;
    outline: none;
}

.sidebar-logout-btn:hover {
    background: rgba(237, 73, 86, 0.06) !important;
    color: #ed4956 !important;
}

.sidebar-logout-btn:hover i {
    color: #ed4956 !important;
}

/* Dark theme */
body.theme-charcoal .sidebar-logout-btn:hover {
    background: rgba(237, 73, 86, 0.1) !important;
    color: #f87171 !important;
}

body.theme-charcoal .sidebar-logout-btn:hover i {
    color: #f87171 !important;
}

/* ── Bottom Nav Logout Button ──────────────────────────────── */
.nav-logout-btn {
    background: transparent;
    border: none;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    outline: none;
    border-radius: 0;
    padding: 0;
}

.nav-logout-btn:hover,
.nav-logout-btn:hover i {
    color: #ed4956 !important;
}

body.theme-charcoal .nav-logout-btn:hover,
body.theme-charcoal .nav-logout-btn:hover i {
    color: #f87171 !important;
}

/* Adjust minimized sidebar items */
.sidebar-nav.minimized .sidebar-item {
    justify-content: center;
    padding: 14px 10px;
}

/* ═══════════════════════════════════════════════════════════ */
/* MAIN CONTENT ADJUSTMENT FOR SIDEBAR */
/* ═══════════════════════════════════════════════════════════ */

/* Mobile: No sidebar padding */
body {
    padding-left: 0;
    transition: padding-left 0.3s ease;
}

/* Desktop: Add left padding for sidebar */
@media (min-width: 768px) {
    body {
        padding-left: 280px;
    }
    
    body:has(.sidebar-nav.minimized) {
        padding-left: 80px;
    }
    
    /* Hide top bar on desktop since sidebar has logo/nav */
    .dash-top-bar {
        display: none;
    }
}

/* ═══════════════════════════════════════════════════════════ */
/* GLOBAL RESETS */
/* ═══════════════════════════════════════════════════════════ */

/* 1. Global Sidebar/Drawer Removal (Old Sidebar) */
.sidebar:not(.sidebar-nav), 
.collapse-btn, 
.menu-toggle:not(.sidebar-toggle-btn), 
.menu-toggle-btn,
#sidebar:not(#sidebarNav),
.sidebar-controls,
.mobile-top-bar .menu-toggle-btn {
    display: none !important;
}

/* 2. Layout Resets */
.container {
    display: block !important;
    width: 100% !important;
}

.main-content {
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 600px !important;
    padding-bottom: 100px !important; /* Spacing for bottom nav on mobile */
}

@media (min-width: 768px) {
    .main-content {
        padding-bottom: 40px !important; /* Less padding on desktop (no bottom nav) */
    }
}

@media (min-width: 1024px) {
    .main-content {
        max-width: 850px !important;
    }
}

/* ═══════════════════════════════════════════════════════════ */
/* BOTTOM TAB NAVIGATION (Mobile Only) */
/* ═══════════════════════════════════════════════════════════ */

.bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 75px !important;
    background: var(--white, #ffffff) !important;
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    padding: 0 4px !important;
    z-index: 9999 !important;
    border-top: 1px solid var(--cool-gray, #efefef) !important;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.02) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: smooth !important;
    scrollbar-width: none !important;
}

.bottom-nav::-webkit-scrollbar {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════ */
/* REDESIGNED MOBILE DRAWER (Mobile Only) */
/* ═══════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
    .bottom-nav {
        display: none !important;
    }

    .mobile-drawer {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 320px;
        max-width: 85vw;
        background: var(--bg-sidebar, #ffffff);
        z-index: 10000;
        display: flex;
        flex-direction: column;
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    }

    body.mobile-sidebar-open .mobile-drawer {
        transform: translateX(0);
        visibility: visible;
    }

    /* Backdrop */
    .mobile-sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
    }

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

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

    /* Drawer Header */
    .drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px;
        min-height: 70px;
        border-bottom: 1px solid var(--border-light);
        flex-shrink: 0;
    }

    .drawer-logo {
        display: flex;
        align-items: center;
        gap: 12px;
        font-weight: 700;
        font-size: 1.2rem;
    }

    .drawer-logo i {
        color: var(--primary-teal);
        font-size: 1.5rem;
    }

    .drawer-logo-text {
        background: linear-gradient(90deg, var(--primary-teal), var(--primary-indigo));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .drawer-close-btn {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;
        background: var(--bg-main);
        color: var(--text-secondary);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background 0.2s;
    }

    /* Scroll Area */
    .drawer-scroll-area {
        flex: 1;
        overflow-y: auto;
        padding: 16px 0 40px; /* Added significant bottom padding */
        scrollbar-width: thin;
    }

    /* Sections */
    .drawer-section {
        margin-bottom: 24px;
    }

    .drawer-section-title {
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--text-muted);
        padding: 0 20px 8px;
        letter-spacing: 0.05em;
    }

    /* Drawer Items */
    .drawer-item {
        display: flex;
        align-items: center;
        gap: 16px;
        padding: 0 20px;
        min-height: 52px; /* User asked for min 48px */
        color: var(--text-secondary);
        text-decoration: none;
        transition: all 0.2s ease;
        position: relative;
    }

    .drawer-item-icon {
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .drawer-item i {
        font-size: 1.35rem; /* ~22-24px */
        width: 24px;
        text-align: center;
    }

    .drawer-item-text {
        font-size: 1rem;
        font-weight: 500;
        flex: 1;
    }

    .drawer-item-arrow {
        font-size: 0.8rem;
        opacity: 0.2;
        transition: transform 0.2s;
    }

    .drawer-item:active {
        background: var(--bg-main);
    }

    .drawer-item.active {
        background: #EEF2FF;
        color: var(--primary-indigo);
    }

    .drawer-item.active::after {
        content: '';
        position: absolute;
        left: 0;
        top: 8px;
        bottom: 8px;
        width: 4px;
        background: var(--primary-teal);
        border-radius: 0 4px 4px 0;
    }

    .drawer-item.active .drawer-item-icon i {
        color: var(--primary-indigo);
    }

    .drawer-item.active .drawer-item-arrow {
        opacity: 1;
        color: var(--primary-indigo);
        transform: translateX(4px);
    }

    /* Special Item: Emergency */
    .drawer-item--emergency {
        color: #EF4444 !important;
        background: rgba(239, 68, 68, 0.05);
        margin: 0 10px 10px;
        border-radius: 12px;
        min-height: 56px;
    }

    .drawer-item--emergency i {
        color: #EF4444 !important;
    }

    .drawer-item--emergency.active {
        background: #FEE2E2 !important;
    }

    /* Footer Items (Inside Scroll Area) */
    .drawer-footer {
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid var(--border-light);
    }

    .drawer-divider {
        height: 1px;
        background: var(--border-light);
        margin: 8px 20px 12px;
    }

    .drawer-logout-btn {
        width: 100%;
        border: none;
        background: transparent;
        cursor: pointer;
        font-family: inherit;
        color: #EF4444 !important;
    }

    .drawer-logout-btn .drawer-item-icon i {
        color: #EF4444 !important;
    }

    /* Mobile Toggle Button */
    .mobile-sidebar-toggle {
        position: fixed;
        top: 11px;
        left: 12px;
        width: 44px;
        height: 44px;
        border: none;
        background: #ffffff;
        color: var(--text-primary);
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1001; /* Above standard page content but below drawer */
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
        cursor: pointer;
        transition: transform 0.2s;
    }

    .mobile-sidebar-toggle:active {
        transform: scale(0.92);
    }

    .mobile-sidebar-toggle i {
        font-size: 1.3rem;
    }
}

/* Desktop styles to hide mobile-only elements */
@media (min-width: 768px) {
    .mobile-drawer,
    .mobile-sidebar-backdrop,
    .mobile-sidebar-toggle {
        display: none !important;
    }

    .main-content {
        padding-bottom: 20px !important; /* Remove extra bottom padding on desktop */
    }

    .bottom-nav {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
        pointer-events: none !important;
    }
}

/* Global Hide for bottom-nav to ensure it never appears unless explicitly requested */
.bottom-nav {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Ensures smooth appearance across all pages - Mobile only */
@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
    .bottom-nav {
        background: rgba(255, 255, 255, 0.98) !important;
        -webkit-backdrop-filter: blur(10px) saturate(180%) !important;
        backdrop-filter: blur(10px) saturate(180%) !important;
    }
}

/* Smiley spacer — hidden in scrollable full nav */
.nav-smiley-spacer {
    display: none !important;
}

.bottom-nav .nav-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--lavender, #8e8e8e) !important;
    text-decoration: none !important;
    font-size: 0.68rem !important;
    font-weight: 500 !important;
    gap: 5px !important;
    flex: 0 0 auto !important;
    min-width: 56px !important;
    max-width: 70px !important;
    padding: 8px 6px !important;
    transition: transform 0.2s ease, color 0.2s ease !important;
    position: relative !important;
}

.bottom-nav .nav-item:hover {
    color: #5a5a5a !important;
}

.bottom-nav .nav-item i {
    font-size: 1.5rem !important;
    transition: transform 0.2s ease !important;
}

.bottom-nav .nav-item:hover i {
    transform: scale(1.1) !important;
}

.bottom-nav .nav-item.active {
    color: var(--slate, #000000) !important; /* IG Style active icon is often black */
}

.bottom-nav .nav-item.active i {
    transform: scale(1.05) !important;
}

.bottom-nav .nav-item:active {
    transform: scale(0.9);
}

/* 4. Auth Gate & Design Normalization */
.auth-main-wrapper {
    background: var(--bg-blue, #ffffff) !important;
}

.card {
    border-radius: 16px !important;
    border: 1px solid var(--cool-gray, #efefef) !important;
    box-shadow: none !important;
    background: var(--white, #ffffff) !important;
}

/* Normalize Headings */
h1, h2, h3 {
    font-family: 'Outfit', sans-serif !important;
    color: var(--slate, #262626) !important;
}


.mobile-spacer {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════ */
/* PUBLIC TOP NAVBAR — help, mission, policies (desktop only) */
/* ═══════════════════════════════════════════════════════════ */

/* Remove sidebar padding for public pages */
body.public-page {
    padding-left: 0 !important;
}

body.public-page .main-content {
    padding-bottom: 40px !important;
    max-width: 960px !important; /* wider for public content pages */
}

/* Top navbar — hidden on mobile, shown on desktop */
.public-topnav {
    display: none;
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid var(--cool-gray, #efefef);
    z-index: 10000;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

@media (min-width: 768px) {
    .public-topnav {
        display: flex;
    }

    /* Hide mobile top bar on desktop for public pages */
    body.public-page .mobile-top-bar {
        display: none !important;
    }
}

.public-topnav .topnav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--slate, #262626);
    font-size: 1.15rem;
    font-weight: 700;
    text-decoration: none;
    flex-shrink: 0;
}

.public-topnav .topnav-logo i {
    font-size: 1.4rem;
    color: #7C3AED;
}

.public-topnav .topnav-links {
    display: flex;
    align-items: center;
    gap: 2px;
}

.public-topnav .topnav-link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    color: var(--lavender, #8e8e8e);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.public-topnav .topnav-link i {
    font-size: 0.85rem;
}

.public-topnav .topnav-link:hover {
    background: rgba(124, 58, 237, 0.06);
    color: #7C3AED;
}

.public-topnav .topnav-link.active {
    background: rgba(124, 58, 237, 0.1);
    color: #7C3AED;
    font-weight: 600;
}

.public-topnav .topnav-link-cta {
    background: #7C3AED;
    color: #ffffff !important;
    padding: 8px 20px;
    border-radius: 10px;
    margin-left: 8px;
    font-weight: 600;
}

.public-topnav .topnav-link-cta:hover {
    background: #6d28d9 !important;
    color: #ffffff !important;
}

body.public-page .bottom-nav {
    justify-content: space-evenly !important;
    padding: 0 10px !important;
    overflow-x: hidden !important;
}

body.public-page .bottom-nav .nav-item {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 7px 2px !important;
    gap: 3px !important;
}

body.public-page .bottom-nav .nav-item i {
    font-size: 1.35rem !important;
}

body.public-page .bottom-nav .nav-item span {
    font-size: 0.62rem !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

/* ═══════════════════════════════════════════════════════════ */
/* EMERGENCY NAV ITEM ACCENT */
/* ═══════════════════════════════════════════════════════════ */

.sidebar-item--emergency,
.nav-item--emergency {
    color: #dc2626 !important;
}

.sidebar-item--emergency i,
.nav-item--emergency i {
    color: #dc2626 !important;
}

.sidebar-item--emergency:hover,
.nav-item--emergency:hover {
    background: #fff1f1 !important;
    color: #b91c1c !important;
}

.sidebar-item--emergency:hover i,
.nav-item--emergency:hover i {
    color: #b91c1c !important;
}

.sidebar-item--emergency.active,
.nav-item--emergency.active {
    background: #fee2e2 !important;
    color: #b91c1c !important;
}
