* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    height: 100vh;
    overflow: hidden;
    background: #f0f2f5;
}

/* ??? MAIN LAYOUT ??? */
.main-container {
    display: flex;
    height: 100vh;
    position: relative;
}

/* ??? OVERLAY ??? */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

    .overlay.active {
        display: block;
    }

/* ??? SIDEBAR (desktop) ??? */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #00003A 0%, #3A003A 100%);
    color: white;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow: hidden;
    /* no global scroll — sections manage their own */
}

/* ??? LOGO ??? */
.logo-container {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.brand-logo {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 6px;
    color: white;
}

.logo-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 4px;
    text-transform: uppercase;
}

/* ??? SCROLLABLE MIDDLE ??? */
.sidebar-scroll-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* ??? MENU SECTION (tenant nav) ??? */
.menu-section {
    padding: 10px 0;
}

/* ??? ADMIN SECTION ??? */
.admin-section {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 0;
}

.admin-label {
    padding: 10px 20px 6px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
}

/* ??? BOTTOM MENU (anchored) ??? */
.bottom-menu {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 0;
    flex-shrink: 0;
    /* never squished */
}

/* ??? SHARED MENU STYLES ??? */
ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    color: white;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}

    .menu-item:hover {
        background: rgba(255, 255, 255, 0.1);
        color: white;
    }

    .menu-item.active-page {
        background: rgba(255, 255, 255, 0.15);
    }

.menu-item-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-item i {
    font-size: 16px;
}

.chevron {
    transition: transform 0.3s ease;
    font-size: 13px;
}

    .chevron.rotated {
        transform: rotate(90deg);
    }

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.2);
}

    .submenu.active {
        max-height: 600px;
    }

    .submenu .menu-item {
        padding-left: 40px;
    }

/* ??? SCROLLBAR ??? */
.sidebar-scroll-area::-webkit-scrollbar {
    width: 4px;
}

.sidebar-scroll-area::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-scroll-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
}

/* ??? CONTENT AREA ??? */
.content-area {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ??? MOBILE HEADER ??? */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(180deg, #00003A 0%, #3A003A 100%);
    color: white;
    flex-shrink: 0;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 26px;
    cursor: pointer;
}

.mobile-logo {
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 1px;
}

.content-iframe {
    flex: 1;
    border: none;
    width: 100%;
    background: #f0f2f5;
}

/* ??? MOBILE OVERRIDES ??? */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        /* KEY: sidebar is a flex column with fixed height */
        height: 100vh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        /* children control their own scroll */
    }

        .sidebar.active {
            transform: translateX(0);
        }

    .content-area {
        margin-left: 0;
    }

    .mobile-header {
        display: flex;
    }

    /* Scrollable middle fills available space between logo and bottom-menu */
    .sidebar-scroll-area {
        flex: 1;
        min-height: 0;
        /* crucial — allows flex child to shrink below content size */
        overflow-y: auto;
    }

    /* Bottom menu always visible, never pushed off screen */
    .bottom-menu {
        flex-shrink: 0;
        background: linear-gradient(180deg, #00003A 0%, #3A003A 100%);
        /* subtle separator shadow so it stands out */
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.3);
    }
}
