﻿/* =========================
   APP LAYOUT ROOT
   ========================= */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg-primary);
}

/* =========================
   SIDEBAR
   ========================= */
.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: #0f172a;
    border-right: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

/* =========================
   NAV HEADER
   ========================= */
.nav-header {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e3a8a;
    border-bottom: 1px solid #1d4ed8;
    padding: 0.75rem;
}

.sidebar-logo {
    max-width: 170px;
    max-height: 48px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* =========================
   ACCESS LABEL
   ========================= */
.nav-access {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.5rem 1rem;
    background: #172554;
    border-bottom: 1px solid #1e3a8a;
}

    .nav-access .nav-text {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        color: #dbeafe;
        font-size: 0.85rem;
        font-weight: 600;
        margin: 0;
    }

/* =========================
   NAV LINKS CONTAINER
   ========================= */
.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.75rem;
    flex: 1;
    overflow-y: auto;
}

/* =========================
   NAV ITEMS / LINKS
   ========================= */
.nav-item {
    display: flex;
    flex-direction: column;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.8rem 0.9rem;
    border-radius: 10px;
    color: #cbd5e1;
    text-decoration: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

    .nav-link:hover,
    .nav-link:focus {
        background: #1e293b;
        color: #ffffff;
        text-decoration: none;
    }

    .nav-link.active {
        background: #2563eb;
        color: #ffffff;
        box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
    }

    a.nav-link.active {
        background: #059669;
        color: #ffffff;
        box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
    }

    /* icons */
    .navicon,
    .nav-link svg,
    .nav-link i {
        width: 20px;
        height: 20px;
        min-width: 20px;
        min-height: 20px;
        flex-shrink: 0;
        color: #93c5fd;
    }

    .nav-link.active .navicon,
    .nav-link.active svg,
    .nav-link.active i {
        color: #ffffff;
    }

.actionicon {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    flex-shrink: 0;
    color: #94a3b8;
}

.nav-link.active .actionicon {
    color: #ffffff;
}

/* nav text should always show now */
.nav-text {
    opacity: 1;
    width: auto;
    overflow: visible;
    white-space: normal;
}

/* =========================
   SUBMENUS
   ========================= */
.submenu {
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.25rem;
    margin-left: 0.75rem;
    padding-left: 0.75rem;
    border-left: 1px solid #334155;
}

    .submenu.show {
        display: flex;
    }

    .submenu .nav-link {
        padding: 0.65rem 0.8rem;
        font-size: 0.9rem;
        color: #94a3b8;
        border-radius: 8px;
    }

        .submenu .nav-link:hover,
        .submenu .nav-link:focus {
            background: #172033;
            color: #ffffff;
        }

        .submenu .nav-link.active {
            background: #1d4ed8;
            color: #ffffff;
        }

        .submenu a.nav-link.active {
            background: #047857;
            color: #ffffff;
        }

.nested-submenu > .submenu {
    margin-left: 0.5rem;
    padding-left: 0.75rem;
    border-left: 1px solid #3b4a63;
}

/* =========================
   IMPERSONATION DOT
   ========================= */
.impersonate-nav-active {
    color: #ffffff !important;
}

.impersonate-nav-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 999px;
    margin-left: 0.35rem;
    flex-shrink: 0;
}

/* =========================
   NAV FOOTER
   ========================= */
.nav-footer {
    padding: 0.75rem;
    border-top: 1px solid #1e293b;
    background: #0f172a;
}

.logout-button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 0.9rem;
    border-radius: 10px;
    border: 1px solid #334155;
    color: #cbd5e1;
    background: transparent;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
}

    .logout-button:hover {
        background: #1e293b;
        color: #ffffff;
        text-decoration: none;
    }

/* =========================
   MAIN CONTENT
   ========================= */
.main-content,
main {
    margin-left: 260px;
    width: calc(100% - 280px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

/* =========================
   TOPBAR
   ========================= */
.topbar {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    position: sticky;
    top: 0;
    z-index: 900;
}

.topbar-title {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

/* =========================
   PAGE CONTENT
   ========================= */
.page-content {
    flex: 1;
    padding: 15px 2rem 2rem 2rem;
    overflow-x: auto;
}

/* =========================
   FOOTER
   ========================= */
.footer,
.sticky-footer {
    position: fixed;
    bottom: 0;
    left: 260px;
    right: 0;
    padding: 0.5rem 2rem;
    border-top: 1px solid #1e293b;
    background: #0f172a;
    color: #94a3b8;
    font-size: 0.8rem;
    text-align: center;
    z-index: 500;
}

.sticky-footer p {
    margin: 0;
    line-height: 1.6;
    color: #94a3b8;
}

.sticky-footer a {
    color: #60a5fa;
    text-decoration: none;
}

.sticky-footer a:hover {
    text-decoration: underline;
}

/* =========================
   SCROLLBAR
   ========================= */
.nav-links::-webkit-scrollbar {
    width: 8px;
}

.nav-links::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 999px;
}

.nav-links::-webkit-scrollbar-track {
    background: transparent;
}

/* =========================
   SITE BANNERS (maintenance + impersonation)
   ========================= */
:root {
    --impersonation-banner-height: 0px;
    --maintenance-banner-height: 0px;
    --page-header-content-gap: 20px;
}

body:has(.impersonation-banner) {
    --impersonation-banner-height: 2.75rem;
}

body:has(.maintenance-banner) {
    --maintenance-banner-height: 5.5rem;
}

/* Impersonation is fixed full-width — pad content columns below it */
body:has(.impersonation-banner) .main-content,
body:has(.impersonation-banner) .page > main {
    padding-top: var(--impersonation-banner-height);
}

.site-banner-slot {
    flex-shrink: 0;
    position: sticky;
    top: var(--impersonation-banner-height);
    z-index: 1050;
    overflow: hidden;
    isolation: isolate;
}

.maintenance-banner {
    width: 100%;
    margin: 0;
    position: relative;
    z-index: 1050;
    overflow: hidden;
}

/* Fixed page headers sit below impersonation + in-flow maintenance banner */
.page-header-shell,
.main-content [class$="-header-shell"],
.page > main [class$="-header-shell"] {
    top: calc(var(--impersonation-banner-height) + var(--maintenance-banner-height)) !important;
}

/* =========================
   PAGE HEADER SPACING
   ========================= */
.page-header,
.analytics-header {
    margin-bottom: var(--page-header-content-gap) !important;
}

/* Header-only shells: gap before sibling body content (not when filters/search live inside) */
.main-content [class$="-header-shell"]:not(:has(.filters-container, .filters-bar, .filters-section, .filter-card, .search-section, .search-row, .summary-cards, .section-card, .amass-filter-bar, .status-filter-tabs, .filter-tabs)),
.page > main [class$="-header-shell"]:not(:has(.filters-container, .filters-bar, .filters-section, .filter-card, .search-section, .search-row, .summary-cards, .section-card, .amass-filter-bar, .status-filter-tabs, .filter-tabs)),
.page-header-shell:not(:has(.filters-container, .filters-bar, .filters-section, .filter-card, .search-section, .search-row, .summary-cards, .section-card, .amass-filter-bar, .status-filter-tabs, .filter-tabs)) {
    padding-bottom: var(--page-header-content-gap) !important;
}

.main-content [class$="-header-shell"]:not(:has(.filters-container, .filters-bar, .filters-section, .filter-card, .search-section, .search-row, .summary-cards, .section-card, .amass-filter-bar, .status-filter-tabs, .filter-tabs)) .page-header,
.page > main [class$="-header-shell"]:not(:has(.filters-container, .filters-bar, .filters-section, .filter-card, .search-section, .search-row, .summary-cards, .section-card, .amass-filter-bar, .status-filter-tabs, .filter-tabs)) .page-header,
.page-header-shell:not(:has(.filters-container, .filters-bar, .filters-section, .filter-card, .search-section, .search-row, .summary-cards, .section-card, .amass-filter-bar, .status-filter-tabs, .filter-tabs)) .page-header {
    margin-bottom: 0 !important;
}

/* Flex-column scroll pages (AMASS, FP&A Tasks, Dev sprints, etc.) */
.page-scroll-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 75px - var(--impersonation-banner-height) - var(--maintenance-banner-height));
    min-height: 0;
    overflow: hidden;
}

/* Keep header stack static; scroll only inside page-scroll-layout */
.main-content:has(.page-scroll-layout) {
    height: 100vh;
    min-height: 0;
    max-height: 100vh;
    overflow: hidden;
    box-sizing: border-box;
}

.page-content:has(.page-scroll-layout) {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.page-scroll-layout > .page-header-stack {
    flex-shrink: 0;
}

.page-header-stack {
    flex-shrink: 0;
    background: var(--bg-primary, #0f172a);
    padding-bottom: 0.75rem;
}

.page-header-stack > div:first-child,
.page-header-stack > .page-header:first-child {
    margin-bottom: var(--page-header-content-gap, 20px) !important;
}

/* Fixed-header page body offset (header shell height + gap) */
.page-body-offset {
    padding-top: calc(15px + 4.5rem + var(--page-header-content-gap, 20px));
}

/* Glass tickets — stop document scroll; only ticket rows scroll inside the page */
body:has(.glass-tickets-page) {
    overflow: hidden;
}

.main-content:has(.glass-tickets-page) {
    height: 100vh;
    min-height: 0;
    max-height: 100vh;
    overflow: hidden;
    box-sizing: border-box;
}

.page-content:has(.glass-tickets-page) {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width: 992px) {
    .sidebar {
        width: 240px;
    }

    .main-content {
        margin-left: 240px;
        width: calc(100% - 240px);
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }

    .app-layout {
        flex-direction: column;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .topbar,
    .page-content,
    .footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
