@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=Outfit:wght@400;500;600&display=swap');

/* ═══════════════════════════════════════════════════════
   DASHBOARD LAYOUT + SIDEBAR — BrutForce Aviation
   Desktop ≥ 1024px : fixed 240px sidebar always visible
   Tablet  640–1023px: 210px sidebar always visible
   Mobile  < 640px   : hidden sidebar, 3-dash topbar
                       tap hamburger → slides in
═══════════════════════════════════════════════════════ */

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

/* ════════════════════════════════════════
   LAYOUT SHELL
════════════════════════════════════════ */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    /* Do not create a stacking context — would trap fixed sidebar */
    isolation: auto;
    transform: none;
}

.dashboard-content {
    flex: 1;
    margin-left: 240px;
    min-height: 100vh;
    background: #f5f6f8;
    transition: margin-left 0.3s cubic-bezier(.4,0,.2,1);
}

/* ════════════════════════════════════════
   SIDEBAR — DESKTOP
════════════════════════════════════════ */
.dashboard-sidebar {
    width: 240px;
    background: #ffffff;
    border-right: 1px solid #e8edf2;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s cubic-bezier(.4,0,.2,1),
                box-shadow 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}

.dashboard-sidebar::-webkit-scrollbar       { width: 4px; }
.dashboard-sidebar::-webkit-scrollbar-track { background: transparent; }
.dashboard-sidebar::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }

/* ── LOGO AREA ── */
.sidebar-logo-wrap {
    padding: 22px 22px 18px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.sidebar-logo-link {
    display: block;
    text-decoration: none;
}

.sidebar-logo {
    width: 100%;
    max-width: 148px;
    height: auto;
    display: block;
    /* Original logo is dark/near-black on transparent — shows perfectly on white sidebar */
    opacity: 0.82;
    transition: opacity 0.2s;
}

.sidebar-logo:hover { opacity: 1; }

/* ── NAV SECTION LABELS ── */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px 8px;
    display: flex;
    flex-direction: column;
}

.sidebar-nav-label {
    display: block;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #c8d2de;
    padding: 0 10px;
    margin-bottom: 4px;
    font-family: 'DM Sans', sans-serif;
    user-select: none;
}

/* ── NAV ITEMS ── */
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 400;
    color: #64748b;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 2px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.sidebar-nav-item:hover {
    background: #f8fafc;
    color: #1e293b;
}

.sidebar-nav-item.active {
    background: #eef2ff;
    color: #4f5fe0;
    font-weight: 500;
}

/* Active left accent bar */
.sidebar-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px;
    background: #4f5fe0;
    border-radius: 0 3px 3px 0;
}

.sidebar-nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.sidebar-nav-item:hover .sidebar-nav-icon,
.sidebar-nav-item.active .sidebar-nav-icon {
    opacity: 1;
}

/* Logout */
.sidebar-nav-logout { margin-top: 4px; }
.sidebar-nav-logout:hover { background: #fff5f5; color: #dc2626; }

/* ── USER FOOTER ── */
.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    background: #fff;
}

.sidebar-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c7d2fe 0%, #a5b4fc 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600;
    color: #4338ca;
    flex-shrink: 0;
    font-family: 'DM Sans', sans-serif;
    user-select: none;
}

.sidebar-user-name {
    font-size: 13px; font-weight: 500;
    color: #1e293b;
    font-family: 'DM Sans', sans-serif;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px; color: #94a3b8;
    margin-top: 1px;
    font-family: 'DM Sans', sans-serif;
}

/* ════════════════════════════════════════
   MOBILE TOPBAR — hidden on desktop
════════════════════════════════════════ */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 58px;
    background: #ffffff;
    border-bottom: 1px solid #e8edf2;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    z-index: 501 !important; /* above sidebar so hamburger stays tappable */
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}

.mobile-topbar-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.topbar-logo-img {
    height: 36px;
    width: auto;
    opacity: 0.82;
    transition: opacity 0.2s;
}

.topbar-logo-img:hover { opacity: 1; }

/* ── 3-DASH HAMBURGER BUTTON ── */
.mobile-menu-btn {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: transparent;
    border: 1.5px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    padding: 0;
    transition: border-color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.mobile-menu-btn:hover {
    background: #f0f4ff;
    border-color: #4f5fe0;
}

.mobile-menu-btn span {
    display: block;
    width: 18px;
    height: 1.8px;
    background: #475569;
    border-radius: 2px;
    transition: transform 0.28s cubic-bezier(.4,0,.2,1),
                opacity 0.2s,
                width 0.2s;
    transform-origin: center;
}

/* Hamburger → X when open */
.mobile-menu-btn.open span:nth-child(1) {
    transform: translateY(6.8px) rotate(45deg);
}
.mobile-menu-btn.open span:nth-child(2) {
    opacity: 0;
    width: 0;
}
.mobile-menu-btn.open span:nth-child(3) {
    transform: translateY(-6.8px) rotate(-45deg);
}

/* ════════════════════════════════════════
   OVERLAY
════════════════════════════════════════ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    z-index: 499 !important; /* just below sidebar */
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: overlayIn 0.2s ease;
}

.sidebar-overlay.visible { display: block; }

@keyframes overlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ════════════════════════════════════════
   TABLET  640px – 1023px
════════════════════════════════════════ */
@media (max-width: 1023px) {
    .dashboard-sidebar  { width: 210px; }
    .dashboard-content  { margin-left: 210px; }
    .sidebar-logo       { max-width: 132px; }
    .sidebar-nav-item   { font-size: 13px; padding: 9px 10px; }
    .sidebar-user-name  { font-size: 12px; }
}

/* ════════════════════════════════════════
   MOBILE  < 640px
════════════════════════════════════════ */
@media (max-width: 639px) {

    /* Show topbar */
    .mobile-topbar { display: flex; }

    /* Sidebar off-screen by default */
    .dashboard-sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: none;
        top: 0;
        z-index: 500 !important; /* must beat any page content stacking context */
    }

    /* Slide in when open */
    .dashboard-sidebar.open {
        transform: translateX(0);
        box-shadow: 6px 0 40px rgba(0,0,0,0.16);
        z-index: 500 !important;
    }

    /* Content fills full width, clears topbar height */
    .dashboard-content {
        margin-left: 0;
        padding-top: 58px;
    }

    /* Sidebar logo area gets extra top padding to clear topbar */
    .sidebar-logo-wrap {
        padding: 20px 20px 16px;
        border-bottom: 1px solid #f1f5f9;
    }

    .sidebar-logo { max-width: 148px; }

    .sidebar-nav-item {
        font-size: 14px;
        padding: 12px 12px;
        border-radius: 10px;
        gap: 12px;
    }

    .sidebar-nav-icon {
        width: 18px; height: 18px;
    }

    .sidebar-footer {
        padding: 16px 20px;
    }

    .sidebar-avatar {
        width: 36px; height: 36px;
        font-size: 13px;
    }
}