/* Sidebar Container */
.portal-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 240px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    /* Brand Match: Dark Navy to Slate */
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --- BRANDING SECTION --- */
.portal-sidebar .sidebar-branding {
    width: 100%;
    padding: 25px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    box-sizing: border-box;
}

.portal-sidebar .branding-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin: 0 auto 10px auto;
    border-radius: 8px;
    background: white;
    padding: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: block;
}

.portal-sidebar .branding-text {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff !important;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* --- NAVIGATION --- */
.portal-sidebar .sidebar-nav {
    flex-grow: 1;
    padding: 15px 0;
    overflow-y: auto;
}

.portal-sidebar .nav-section-title {
    padding: 0 20px;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.portal-sidebar .nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.portal-sidebar .nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    text-decoration: none;
}

.portal-sidebar .nav-item.active {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border-left-color: #64748b;
    /* Slate Accent */
    font-weight: 600;
}

.portal-sidebar .nav-icon {
    width: 20px;
    margin-right: 12px;
    text-align: center;
    font-size: 16px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portal-sidebar .nav-icon svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

/* --- USER PROFILE (Bottom) --- */
.sidebar-profile-link {
    text-decoration: none !important;
    display: block;
    transition: background 0.2s ease;
}

.sidebar-profile-link:hover .sidebar-profile {
    background: rgba(255, 255, 255, 0.05);
}

.portal-sidebar .sidebar-profile {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
}

.portal-sidebar .profile-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #64748b 0%, #334155 100%);
    /* Slate Gradient */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.portal-sidebar .profile-info {
    overflow: hidden;
}

.portal-sidebar .profile-name {
    font-size: 13px;
    font-weight: 600;
    color: white;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-sidebar .profile-email {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- MAIN CONTENT WRAPPER --- */
body.has-sidebar .portal-page-content,
body.has-sidebar .main-section,
body.has-sidebar .page-content-wrapper {
    margin-left: 240px !important;
    padding: 20px;
}

/* --- MOBILE RESPONSIVENESS --- */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 2000;
    background: #1e293b;
    /* Matches Slate/Navy */
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
}

@media (max-width: 768px) {
    .portal-sidebar {
        transform: translateX(-100%);
        backdrop-filter: blur(10px);
    }

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

    .mobile-menu-toggle {
        display: block;
    }

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

    body.has-sidebar .portal-page-content,
    body.has-sidebar .main-section,
    body.has-sidebar .page-content-wrapper {
        margin-left: 0 !important;
        padding-top: 60px;
    }
}