/* ==========================================================================
   ANTI-GRAVITY V3.2 — RADAR LAYOUT
   Sidebar, Topbar, Main Workspace, Mobile Drawer & Bottom Bar Architecture
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. MASTER WRAPPER
   -------------------------------------------------------------------------- */
.radar-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* --------------------------------------------------------------------------
   2. FIXED SIDEBAR (Desktop)
   -------------------------------------------------------------------------- */
.radar-sidebar {
    width: var(--sidebar-width);
    background-color: var(--surface-bg);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-v3-sidebar);
    overflow-y: auto;
    overflow-x: hidden;
    border: 0;
    transition: transform var(--transition-smooth);
}

/* --- Sidebar Brand Header --- */
.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: var(--surface-deep);
    border-bottom: 1px solid var(--hairline);
    flex-shrink: 0;
}

.sidebar-brand-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.radar-logo-pulse {
    font-size: 18px;
    color: var(--accent-cyan);
    animation: pulse-glow 2s ease-in-out infinite;
}

.brand-text h1 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #fff;
    line-height: 1.2;
}

.brand-text span {
    font-size: 9px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.sidebar-close-btn {
    display: none;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-btn);
    transition: background var(--transition-fast);
}

.sidebar-close-btn:hover {
    background: var(--surface-hover);
}

/* --- Sidebar Navigation --- */
.sidebar-nav {
    padding: 14px 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-category {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 14px 10px 6px;
    letter-spacing: 0.5px;
    user-select: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-btn);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition-base);
    border: 0;
    cursor: pointer;
    background: transparent;
    width: 100%;
    text-align: left;
}

.nav-link:hover {
    background: var(--surface-hover);
    color: #fff;
}

.nav-link.active {
    background: var(--surface-card);
    color: var(--accent-cyan);
    box-shadow: var(--shadow-v3);
}

.nav-link i {
    width: 16px;
    text-align: center;
    font-size: 13px;
    flex-shrink: 0;
}

.nav-link span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Sidebar Footer --- */
.sidebar-footer {
    padding: 12px 16px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--hairline);
    flex-shrink: 0;
    user-select: none;
}

/* --------------------------------------------------------------------------
   3. MAIN WORKSPACE
   -------------------------------------------------------------------------- */
.radar-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

/* --------------------------------------------------------------------------
   4. STICKY TOPBAR
   -------------------------------------------------------------------------- */
.radar-topbar {
    height: var(--topbar-height);
    background: var(--surface-bg);
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-v3);
    border: 0;
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.mobile-menu-btn {
    display: none;
    background: var(--surface-card);
    border: 0;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-btn);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    transition: background var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--surface-hover);
}

/* --- Breadcrumb --- */
.topbar-breadcrumb {
    font-family: var(--font-mono);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.topbar-breadcrumb .root {
    color: var(--text-muted);
    white-space: nowrap;
}

.topbar-breadcrumb .separator {
    font-size: 9px;
    color: var(--text-muted);
}

.topbar-breadcrumb .current {
    color: var(--accent-cyan);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Topbar Right Cluster --- */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.status-badge-live {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent-green);
    background: #072814;
    padding: 5px 10px;
    border-radius: var(--radius-btn);
    border: 0;
    white-space: nowrap;
}

.pulse-dot {
    width: 7px;
    height: 7px;
    background: var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-green);
    animation: pulse-glow 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

.topbar-admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--surface-bg);
    padding: 5px 10px;
    border-radius: var(--radius-btn);
    border: 0;
    box-shadow: var(--shadow-v3);
}

.topbar-admin-badge i {
    font-size: 12px;
}

.btn-logout {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 15px;
    padding: 6px 10px;
    border-radius: var(--radius-btn);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.btn-logout:hover {
    color: var(--accent-red);
    background: var(--surface-card);
}

/* --- Auth Shield (Zero unauthenticated content flash) --- */
body.app-auth-verifying .radar-layout {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

#appBootLoader {
    position: fixed;
    inset: 0;
    background: var(--canvas-bg, #090d16);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

body:not(.app-auth-verifying) #appBootLoader {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   5. WORKSPACE CONTENT AREA
   -------------------------------------------------------------------------- */
.workspace-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex: 1;
}

/* --------------------------------------------------------------------------
   6. MOBILE BOTTOM BAR
   -------------------------------------------------------------------------- */
.mobile-bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--surface-bg);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);
    z-index: 50;
    border-top: 1px solid var(--hairline);
}

.bottom-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    background: transparent;
    border: 0;
    font-size: 10px;
    font-family: var(--font-mono);
    gap: 2px;
    cursor: pointer;
    transition: color var(--transition-fast);
    padding: 0;
}

.bottom-tab i {
    font-size: 16px;
}

.bottom-tab.active,
.bottom-tab:hover {
    color: var(--accent-cyan);
}

/* --------------------------------------------------------------------------
   7. MOBILE BACKDROP
   -------------------------------------------------------------------------- */
.radar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 90;
    animation: fade-in 0.2s ease;
}

.radar-backdrop.show {
    display: block;
}

/* --------------------------------------------------------------------------
   8. RESPONSIVE — MOBILE DRAWER (<= 960px)
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
    .radar-sidebar {
        width: 280px;
        max-width: 85vw;
        transform: translateX(-100%);
    }

    .radar-sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close-btn {
        display: flex;
    }

    .radar-main {
        margin-left: 0;
        padding-bottom: 70px;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .mobile-bottom-bar {
        display: flex;
    }

    .workspace-content {
        padding: 16px;
        gap: 16px;
    }

    .radar-topbar {
        padding: 0 16px;
    }

    .status-badge-live b {
        display: none;
    }
}

@media (max-width: 480px) {
    .workspace-content {
        padding: 12px;
        gap: 12px;
    }

    .topbar-breadcrumb .root {
        display: none;
    }

    .topbar-breadcrumb .separator:first-of-type {
        display: none;
    }
}
