/* Sidebar styles */
.sidebar {
    height: 100%;
    width: 250px;
    position: fixed;
    z-index: 100;
    top: 0;
    left: 0;
    /*background: linear-gradient(180deg, #2e3135, #2b3033);*/
    overflow-x: hidden;
    padding-top: 0; /* remove extra space to let header bar stick to top */
    box-shadow: 2px 0 16px rgba(0,0,0,0.15);
    background: radial-gradient(650px 350px at 50% -10%, rgba(124, 77, 255, .18), transparent 60%), radial-gradient(480px 300px at 120% 0%, rgba(0, 209, 255, .16), transparent 60%), linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02)), linear-gradient(160deg, #0a0f1c, #0f1630);
    color: #e6f1ff;
}

/* Header user bar */
.sidebar-header {
    padding: 0;
}

.user-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    /*background: linear-gradient(135deg, color-mix(in oklab, var(--accent-color, #2e7d32) 92%, #2e7d32), var(--accent-color, #2e7d32));*/
    padding: 14px 16px;
    background: radial-gradient(650px 350px at 50% -10%, rgba(124, 77, 255, .18), transparent 60%), radial-gradient(480px 300px at 120% 0%, rgba(0, 209, 255, .16), transparent 60%), linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02)), linear-gradient(160deg, #0a0f1c, #0f1630);
    color: #e6f1ff;
}

.user-avatar img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.6);
    background: #fff;
}

.user-info .user-name a {
    color: #ffffff;
    text-decoration: none;
    font-size: 1.08rem;
    font-weight: 700;
}

.user-info .user-sub {
    color: #e6f5e6;
    font-size: 0.85rem;
    line-height: 1.1;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.user-info .user-sub .badge {
    font-size: 0.72rem;
    line-height: 1;
    padding: 0.2rem 0.35rem;
    border-radius: 0.4rem;
    transform: translateY(-1px);
}

.sidebar-nav {
    margin-top: 10px;
}

.sidebar-nav .nav-item {
    padding: 6px 8px 6px 16px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    border-radius: 8px;
    padding: 10px 12px;
    color: #f8f9fa;
    font-size: 1.03rem;
    transition: background-color .2s ease, color .2s ease, transform .15s ease;
}

.sidebar-nav .nav-link:hover {
    color: #d8f3dc;
    background-color: rgba(255,255,255,0.06);
    transform: translateX(2px);
}

.sidebar-nav .nav-link.active {
    background-color: rgba(255,255,255,0.12);
    color: #ffffff;
    border-left: 3px solid #ffffff44;
}

.nav-separator {
    list-style: none;
    margin: 8px 16px;
    padding: 0;
    border-top: 1px solid rgba(255,255,255,0.18);
}

/* Main content styles */
.main-content {
    margin-left: 250px;
    padding: 20px;
    transition: margin-left 0.3s ease;
}

/* Footer styles */
.footer {
    margin-left: 250px;
    transition: margin-left 0.3s ease;
}

/* Responsive styles */
@media (max-width: 768px) {
    .sidebar {
        width: 250px;
        padding-top: 0;
        /* Place sidebar below the mobile top bar (64px) */
        top: 64px;
        height: calc(100% - 64px);
        transform: translateX(-260px);
        transition: transform 0.3s ease;
        z-index: 1040; /* above backdrop */
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content, .footer {
        margin-left: 0; /* content should not be pushed on mobile */
    }
    
    /* No shifting when menu is open */
    .main-content.active, .footer.active {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1060;
        box-shadow: 0 6px 20px rgba(0,0,0,0.2);
        border-radius: 50%;
    }
}

/* Backdrop overlay behind mobile sidebar */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1030;
}
.sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 768px) {
    /* Keep the backdrop below the mobile top bar so the title row stays visible */
    .sidebar-backdrop {
        top: 64px;
        right: 0;
        bottom: 0;
        left: 0;
    }
}

/* Mobile top bar (authenticated mobile header) */
.mobile-topbar { display: none; }

@media (max-width: 768px) {
    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        position: sticky;
        top: 0;
        z-index: 1050;
        padding: 10px 16px;
        background: radial-gradient(650px 350px at 50% -10%, rgba(124, 77, 255, .18), transparent 60%), radial-gradient(480px 300px at 120% 0%, rgba(0, 209, 255, .16), transparent 60%), linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02)), linear-gradient(160deg, #0a0f1c, #0f1630);
        color: #e6f1ff;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .mobile-topbar .mobile-title {
        font-weight: 700;
        font-size: 1.1rem;
        color: #e6f1ff;
    }
    /* Ensure top spacing so content isn't hidden under the bar */
    .main-content { padding-top: 64px; }

    /* When toggle button is in the topbar, keep it inline, not floating */
    .mobile-topbar .sidebar-toggle {
        position: static;
        top: auto;
        left: auto;
        z-index: auto;
        box-shadow: none;
        border-radius: .5rem;
    }
}
