/* ===== Updated Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width-closed);
    padding: 1rem;
    background: white;
    backdrop-filter: blur(20px);
    border-right: 1px solid #e2e8f0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    /* Remove transition from default state to prevent page load animation */
}

.sidebar:not(.close) {
    width: var(--sidebar-width-opened);
}

/* Add transition only after page load to prevent initial animation */
.page-loaded .sidebar {
    transition: all var(--animation-medium) var(--ease-smooth);
}

.sidebar.close {
    padding: var(--space-md) var(--space-xs);
}

/* Sidebar Header */
.sidebar__header {
    padding: var(--space-lg) 0 var(--space-lg) 0;
    margin-bottom: 2rem;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--space-sm);
    min-height: 60px;
}

.sidebar.close .sidebar__brand {
    justify-content: center;
}

/* Enhanced Brand Icon with Better Logo Management */
.brand__icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 8px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    position: relative;
    /* Remove transition from default state */
}

/* Add transition only after page load */
.page-loaded .brand__icon {
    transition: all 0.3s ease;
}

.sidebar:not(.close) .brand__icon {
    width: 100%;
    max-width: 200px;
    height: auto;
    min-height: 48px;
    max-height: 80px; /* Limit maximum height for very tall logos */
    aspect-ratio: auto;
}

.brand__icon img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Changed from cover to contain for better logo display */
    border-radius: inherit;
    padding: 2px; /* Small padding to prevent edge clipping */
    /* Remove transition from default state */
}

/* Add transition only after page load */
.page-loaded .brand__icon img {
    transition: all 0.3s ease;
}

.sidebar.close .brand__icon {
    width: 48px;
    height: 48px;
}

.sidebar.close .brand__icon img {
    object-fit: contain;
    width: 100%;
    height: 100%;
    padding: 2px;
}

/* Fallback icon styling */
.brand__icon i {
    font-size: 24px;
    color: #718096;
    /* Remove transition from default state */
}

/* Add transition only after page load */
.page-loaded .brand__icon i {
    transition: all 0.3s ease;
}

.sidebar.close .brand__icon i {
    font-size: 20px;
}

/* Logo Link Styling */
.program-logo-link,
.company-logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 8px;
    background: white;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    position: relative;
    /* Remove transition from default state */
}

/* Add transition only after page load */
.page-loaded .program-logo-link,
.page-loaded .company-logo-link {
    transition: all 0.2s ease;
}

.sidebar:not(.close) .program-logo-link,
.sidebar:not(.close) .company-logo-link {
    width: 100%;
    max-width: 200px;
    height: auto;
    min-height: 48px;
    max-height: 80px;
    aspect-ratio: auto;
}

.program-logo-link img,
.company-logo-link img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: inherit;
    padding: 2px;
}

.sidebar.close .program-logo-link,
.sidebar.close .company-logo-link {
    width: 48px;
    height: 48px;
}

.sidebar.close .program-logo-link img,
.sidebar.close .company-logo-link img {
    object-fit: contain;
    width: 100%;
    height: 100%;
    padding: 2px;
}

/* Logo link hover effect - subtle border change only */
.program-logo-link:hover,
.company-logo-link:hover {
    border-color: #cbd5e0;
    text-decoration: none;
}

/* Company/Program Logo Specific Styling */
.brand__icon.company-logo,
.brand__icon.program-logo {
    background: #f8f9fa;
    border: 2px solid #e2e8f0;
}

.brand__icon.company-logo img,
.brand__icon.program-logo img {
    object-fit: contain;
    padding: 4px;
}

.sidebar.close .brand__icon.company-logo img,
.sidebar.close .brand__icon.program-logo img {
    padding: 3px;
}

/* Rectangular Logo Adjustments */
.brand__icon.horizontal-logo {
    aspect-ratio: 2/1;
}

.brand__icon.vertical-logo {
    aspect-ratio: 1/2;
    max-height: 96px;
}

.sidebar.close .brand__icon.horizontal-logo,
.sidebar.close .brand__icon.vertical-logo {
    width: 48px;
    height: 48px;
    aspect-ratio: 1/1;
}

/* Auto-detect logo orientation and adjust */
.brand__icon img[style*="aspect-ratio"] {
    width: 100%;
    height: auto;
}

.brand__content {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

/* Add transition only after page load */
.page-loaded .brand__content {
    transition: opacity var(--animation-medium) var(--ease-smooth);
}

.brand__text {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--color-text-primary);
    font-family: var(--font-headings);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.5px;
}

/* Add transition only after page load */
.page-loaded .brand__text {
    transition: opacity var(--animation-medium) var(--ease-smooth);
}

.brand__subtitle {
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--color-text-secondary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* Add transition only after page load */
.page-loaded .brand__subtitle {
    transition: opacity var(--animation-medium) var(--ease-smooth);
}

.sidebar.close .brand__text,
.sidebar.close .brand__subtitle,
.sidebar.close .brand__content {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Removed hover scaling effects for cleaner look */

/* Menu Bar */
.menu-bar {
    flex: 1;
    overflow-y: auto;
    padding-bottom: var(--space-md);
}

.menu {
    height: 100%;
}

.menu-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Navigation Links */
.nav-link {
    margin: 0;
}

.nav-link a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #718096;
    font-size: 0.9em;
    font-weight: 500;
    font-family: var(--font-general);
    position: relative;
    min-height: 36px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 2px;
    /* Remove transition from default state */
}

/* Add transition only after page load */
.page-loaded .nav-link a {
    transition: all 0.2s ease;
}

.nav-link a:hover,
.nav-link a.active {
    color: #2d3748;
    background: #ebebeb;
}

.link__icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.link__icon i {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.link__text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    font-family: var(--font-general);
    font-weight: 500;
}

/* Add transition only after page load */
.page-loaded .link__text {
    transition: all var(--animation-medium) var(--ease-smooth);
}

/* Closed sidebar styles */
.sidebar.close .link__text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.close .nav-link a {
    justify-content: center;
    padding: 10px;
    gap: 0;
    min-width: 40px;
    width: 40px;
    margin: 0 auto 4px auto;
}

.sidebar.close .link__icon {
    margin: 0;
}

.sidebar.close .nav-link a:hover,
.sidebar.close .nav-link a.active {
    color: #2d3748;
    background: #ebebeb;
}

/* Mobile Sidebar */
.mobile-sidebar {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .desktop-sidebar {
        display: none;
    }

    .mobile-sidebar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100vw;
        height: 60px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        border-top: 1px solid var(--color-gray-medium);
        z-index: 1000;
    }

    .mobile-menu {
        display: flex;
        width: 100%;
        justify-content: space-around;
        align-items: center;
        padding: 0;
        margin: 0;
        list-style: none;
    }

    .mobile-menu .nav-link {
        flex: 1;
        text-align: center;
    }

    .mobile-menu .nav-link a {
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 18px;
        color: var(--color-text-secondary);
        text-decoration: none;
        height: 100%;
        padding: var(--space-sm) 0;
        border-radius: var(--border-radius-md);
        transition: all var(--animation-medium) var(--ease-smooth);
        position: relative;
    }

    .mobile-menu .nav-link a::before {
        content: '';
        position: absolute;
        top: -3px;
        left: 50%;
        transform: translateX(-50%);
        width: 30px;
        height: 3px;
        background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
        border-radius: 2px;
        opacity: 0;
        transition: all var(--animation-medium) var(--ease-smooth);
        box-shadow: 0 0 10px var(--color-primary);
    }

    .mobile-menu .nav-link a i {
        stroke-width: 2;
        width: 20px;
        height: 20px;
    }

    .mobile-menu .nav-link a.active::before,
    .mobile-menu .nav-link a:hover::before {
        opacity: 1;
        box-shadow: 0 0 15px var(--color-primary), 0 0 5px var(--color-primary);
    }

    .mobile-menu .nav-link a.active,
    .mobile-menu .nav-link a:hover {
        color: var(--color-primary);
        background: rgba(79, 195, 247, 0.05);
        transform: translateY(-2px);
    }
}

/* Page Layout */
.page {
    max-width: var(--width-container);
    margin: 0 auto;
}

/* Add transition only after page load */
.page-loaded .page {
    transition: all var(--animation-medium) var(--ease-smooth);
}

.sidebar.close ~ .page {
    margin-left: var(--sidebar-width-closed);
}

/* Mobile Layout */
@media (max-width: 768px) {
    .page {
        margin-left: 0;
        padding-bottom: 70px;
    }

    .sidebar.close ~ .page {
        margin-left: 0;
    }
}




