/* apps/web/public/css/sidebar.css */
#app {
    display: flex;
    min-height: 100vh;
    background: var(--bg-color);
}

#sidebar {
    width: 280px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: all 0.3s ease;
}

.sidebar-brand {
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand img {
    width: 32px;
    height: 32px;
}

.sidebar-brand h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-color);
    letter-spacing: -0.5px;
    margin: 0;
}

.sidebar-brand h1 span {
    color: var(--main-color);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--main-color) 30%, transparent) transparent;
}

/* Custom sleek scrollbar for sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--main-color) 30%, transparent);
    border-radius: 3px;
}

.nav-group {
    margin-bottom: 1.5rem;
}

.nav-group-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    padding-left: 1rem;
    font-weight: 700;
    
    /* Sticky Frozen Header */
    position: sticky;
    top: -1rem; /* Adjust to stay at top of padding */
    z-index: 10;
    background: rgba(13, 17, 23, 0.95);
    backdrop-filter: blur(8px);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    margin-top: -0.5rem;
}

.sidebar-nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 0.85rem 1rem;
    background: transparent;
    border: none;
    color: var(--sub-color);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    margin-bottom: 4px;
}

.sidebar-nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
}

.sidebar-nav-btn.active {
    background: var(--highlight);
    color: var(--main-color);
    font-weight: 600;
}

.sidebar-nav-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.sidebar-nav-btn:hover svg,
.sidebar-nav-btn.active svg {
    opacity: 1;
}

.context-item select option {
    background: #0d1117;
    color: #c9d1d9;
    padding: 8px;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* App Header (Identity Bar) */
.app-header {
    height: 60px;
    background: rgba(13, 17, 23, 0.4);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem 0 1rem;
    position: sticky;
    top: 0;
    z-index: 900;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-info-block {
    font-size: 0.9rem;
    color: var(--text-color);
}

.logout-link {
    color: var(--sub-color);
    opacity: 0.8;
    text-decoration: none;
    margin-left: 0.5rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.logout-link:hover {
    color: #ff4d4d;
    opacity: 1;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

.header-select:hover {
    border-color: var(--main-color);
}

.icon-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-color);
    padding: 8px;
    margin-right: 1rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--main-color);
}

/* Adjust main content for header */
.main-content {
    flex: 1;
    margin-left: 280px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.footer-icon-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--main-color);
    border-color: var(--main-color);
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
    max-width: calc(100vw - 280px);
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .sidebar-toggle {
        display: flex;
    }

    #sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    }

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

    .main-content {
        margin-left: 0;
        max-width: 100vw;
        padding: 1rem;
    }

    .app-header {
        padding: 0 1rem;
    }

    .global-user-status {
        font-size: 0.8rem;
        padding: 4px 8px;
    }

    .header-right {
        gap: 0.5rem;
    }

    .header-select {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
}

/* Global User Welcome & Sync Panel */
.global-user-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-color);
}

.global-user-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.global-user-status .status-dot.disconnected {
    background-color: #ff4d4d;
    box-shadow: 0 0 8px #ff4d4d;
}

.global-user-status .status-dot.waiting {
    background-color: #ffab00;
    box-shadow: 0 0 8px #ffab00;
}

.global-user-status .status-dot.connected {
    background-color: #00ff88;
    box-shadow: 0 0 8px #00ff88;
}

.global-user-status .user-info-text {
    display: flex;
    align-items: center;
    gap: 6px;
}

.global-user-status .sync-btn-compact {
    background: var(--main-color);
    color: #000;
    border: none;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.global-user-status .sync-btn-compact:hover {
    transform: scale(1.05);
    background: var(--text-color);
    color: #000;
}

