/* ===== ENHANCED SIDEBAR VARIABLES - HARMONIZED WITH LOGIN ===== */
:root {
    --sidebar-width-lg: 260px;
    --sidebar-collapsed-width: 72px;
    --header-height: 64px;
    /* Colors - Brand Identity from Login */
    --sidebar-primary: #c49a5e; /* Gold */
    --sidebar-primary-dark: #b8893f;
    --sidebar-secondary: #ec4899; /* Pink */
    --sidebar-background: rgba(15, 23, 42, 0.65);
    --sidebar-card-bg: transparent;
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-text: #ffffff;
    --sidebar-text-muted: #94a3b8;
    --sidebar-hover: rgba(196, 154, 94, 0.15);
    --sidebar-active: linear-gradient(135deg, #c49a5e 0%, #b8893f 100%);
    /* New rgba variables */
    --sidebar-white-15: rgba(255, 255, 255, 0.15);
    --sidebar-white-08: rgba(255, 255, 255, 0.08);
    --sidebar-white-06: rgba(255, 255, 255, 0.6);
    --sidebar-white-05: rgba(255, 255, 255, 0.05);
    --sidebar-white-07: rgba(255, 255, 255, 0.07);
    --sidebar-white-10: rgba(255, 255, 255, 0.1);
    --sidebar-white-12: rgba(255, 255, 255, 0.12);
    --sidebar-white-20: rgba(255, 255, 255, 0.2);
    --sidebar-white-25: rgba(255, 255, 255, 0.25);
    --sidebar-white-30: rgba(255, 255, 255, 0.3);
    --sidebar-white-40: rgba(255, 255, 255, 0.4);
    --sidebar-white-60: rgba(255, 255, 255, 0.6);
    --sidebar-white-80: rgba(255, 255, 255, 0.8);
    --sidebar-black-10: rgba(0, 0, 0, 0.1);
    --sidebar-black-20: rgba(0, 0, 0, 0.2);
    --sidebar-black-60: rgba(0, 0, 0, 0.6);
    --sidebar-black-30: rgba(0, 0, 0, 0.3);
    --sidebar-black-40: rgba(0, 0, 0, 0.4);
    --sidebar-primary-05: rgba(196, 154, 94, 0.05);
    --sidebar-primary-15: rgba(196, 154, 94, 0.15);
    --sidebar-primary-20: rgba(196, 154, 94, 0.2);
    --sidebar-primary-25: rgba(196, 154, 94, 0.25);
    --sidebar-primary-30: rgba(196, 154, 94, 0.3);
    --sidebar-primary-40: rgba(196, 154, 94, 0.4);
    --sidebar-primary-dark-20: rgba(184, 137, 63, 0.2);
    --sidebar-primary-08: rgba(196, 154, 94, 0.08);
    --sidebar-primary-dark-10: rgba(184, 137, 63, 0.1);
    --sidebar-primary-50: rgba(196, 154, 94, 0.5);
    --sidebar-white-70: rgba(255, 255, 255, 0.7);
    --sidebar-white-80: rgba(255, 255, 255, 0.8);
    --sidebar-white-90: rgba(255, 255, 255, 0.9);
    /* Enhanced Effects - Optimized */
    --sidebar-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-transition-fast: all 0.15s ease-out;
    --sidebar-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    --sidebar-shadow-hover: 0 12px 40px rgba(196, 154, 94, 0.2);
    --sidebar-border-radius: 14px;
    --sidebar-border-radius-lg: 16px;
    /* Typography */
    --sidebar-font-family: 'Vazir', 'IRANSans', sans-serif;
    --sidebar-font-size-xs: 0.75rem;
    --sidebar-font-size-sm: 0.875rem;
    --sidebar-font-size-base: 1rem;
    --sidebar-font-size-lg: 1.125rem;
    --sidebar-font-weight-normal: 400;
    --sidebar-font-weight-medium: 500;
    --sidebar-font-weight-semibold: 600;
    --sidebar-font-weight-bold: 700;
    /* Enhanced Gradients */
    --sidebar-gradient-primary: linear-gradient(135deg, #c49a5e 0%, #b8893f 100%);
    --sidebar-gradient-secondary: linear-gradient(135deg, rgba(196, 154, 94, 0.1) 0%, rgba(236, 72, 153, 0.15) 100%);
}

/* ===== ENHANCED SIDEBAR CORE ===== */
.sidebar {
    width: var(--sidebar-width-lg);
    height: 100dvh;
    position: fixed;
    right: 0;
    top: 0;
    background: var(--sidebar-card-bg);
    border-left: 1px solid var(--sidebar-border);
    box-shadow: var(--sidebar-shadow);
    display: flex;
    flex-direction: column;
    transition: var(--sidebar-transition);
    z-index: 1050;
    overflow: hidden;
}

/* ===== ENHANCED BRAND SECTION ===== */
.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    /* Adjusted padding */
    border-bottom: 1px solid var(--sidebar-border);
    background: var(--sidebar-card-bg);
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

.sidebar-brand .hero-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    /* Remove any margin */
}

.sidebar-brand .hero-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sidebar-brand::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--sidebar-gradient-secondary);
    opacity: 0;
    transition: var(--sidebar-transition);
    z-index: -1;
}

.sidebar-brand:hover::before {
    opacity: 1;
}

/* ===== ENHANCED BRAND LOGO ===== */
.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--sidebar-border-radius-lg);
    object-fit: cover;
    margin-left: 1rem;
    box-shadow: 0 4px 16px rgba(108, 95, 252, 0.2);
    border: 2px solid var(--sidebar-border);
    transition: var(--sidebar-transition);
    background: var(--sidebar-gradient-primary);
    padding: 2px;
}

.brand-logo:hover {
    box-shadow: 0 6px 24px rgba(108, 95, 252, 0.3);
    border-color: var(--sidebar-primary);
    transform: scale(1.05);
    /* Subtle zoom effect */
}

.brand-text {
    color: var(--sidebar-text);
    font-family: var(--sidebar-font-family);
    font-size: var(--sidebar-font-size-lg);
    font-weight: var(--sidebar-font-weight-bold);
    transition: var(--sidebar-transition);
}

/* ===== ENHANCED SCROLLABLE CONTENT ===== */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    /* MODIFIED: Increased padding for better spacing */
    scrollbar-width: thin;
    scrollbar-color: rgba(108, 95, 252, 0.3) transparent;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    background: transparent;
    position: relative;
}

/* ===== SEARCH BOX ===== */
.sidebar-search {
    margin-bottom: 1.75rem;
    /* MODIFIED: Increased bottom margin */
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--sidebar-card-bg);
    padding: 0.5rem 0;
    border-radius: var(--sidebar-border-radius);
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--sidebar-white-08);
    border: 1px solid var(--sidebar-white-15);
    border-radius: var(--sidebar-border-radius);
    /* MODIFIED: Standardized border radius */
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    backdrop-filter: blur(10px);
    will-change: background, border-color, box-shadow;
}

.search-container:focus-within {
    background: var(--sidebar-white-12);
    border-color: var(--sidebar-primary);
    box-shadow: 0 0 0 3px rgba(108, 95, 252, 0.2);
}

.search-icon {
    position: absolute;
    right: 0.75rem;
    color: var(--sidebar-white-06);
    font-size: 0.875rem;
    z-index: 2;
    pointer-events: none;
}

.search-input {
    width: 100%;
    background: transparent;
    border: none;
    padding: 0.75rem 2.5rem 0.75rem 0.75rem;
    color: var(--sidebar-text);
    font-family: var(--sidebar-font-family);
    font-size: var(--sidebar-font-size-sm);
    outline: none;
    direction: rtl;
}

.search-input::placeholder {
    color: var(--sidebar-white-05);
    font-size: var(--sidebar-font-size-xs);
}

.search-clear {
    position: absolute;
    left: 0.5rem;
    background: var(--sidebar-white-10);
    border: none;
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--sidebar-white-07);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
    font-size: 0.75rem;
    opacity: 0;
    transform: scale(0.8);
}

.search-clear.show-clear-button {
    display: flex;
    opacity: 1;
    transform: scale(1);
}

.search-clear:hover {
    background: var(--sidebar-white-20);
    color: white;
}

/* Search Highlight */
.nav-link.search-highlight {
    background: linear-gradient(135deg, var(--sidebar-primary-25) 0%, var(--sidebar-primary-dark-20) 50%, var(--sidebar-primary-15) 100%);
    border-color: var(--sidebar-white-30);
    animation: searchPulse 1.5s ease-in-out infinite;
    color: white;
}

.nav-link.search-highlight .nav-text {
    color: white;
    font-weight: var(--sidebar-font-weight-semibold);
}

@keyframes searchPulse {

    0%,
    100% {
        box-shadow: 0 4px 12px var(--sidebar-primary-20), 0 2px 6px var(--sidebar-black-10);
    }

    50% {
        box-shadow: 0 8px 20px var(--sidebar-primary-40), 0 4px 12px var(--sidebar-primary-dark-20);
    }
}

/* No Results */
.search-no-results {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--sidebar-white-80);
}

.no-results-content i {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results-content p {
    font-size: var(--sidebar-font-size-sm);
    margin: 0;
    font-weight: var(--sidebar-font-weight-medium);
    color: var(--sidebar-text);
}

/* Enhanced Scrollbar Styling */
.sidebar-content::-webkit-scrollbar {
    width: 8px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: var(--sidebar-primary-05);
    border-radius: var(--sidebar-border-radius);
    margin: 0.5rem 0;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--sidebar-gradient-primary);
    border-radius: var(--sidebar-border-radius);
    transition: background 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid transparent;
    background-clip: content-box;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: var(--sidebar-gradient-primary);
    box-shadow: 0 2px 8px var(--sidebar-shadow-hover);
}

/* ===== ENHANCED NAVIGATION SECTIONS - COMPACT ===== */
.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section:first-child .section-title {
    margin-top: 0;
}

.section-title {
    color: var(--sidebar-white-70);
    font-family: var(--sidebar-font-family);
    font-size: var(--sidebar-font-size-sm);
    font-weight: var(--sidebar-font-weight-bold);
    padding: 0.75rem 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    /* MODIFIED: Increased bottom margin */
    margin-top: 1rem;
    text-align: right;
    background: var(--sidebar-white-05);
    border-radius: var(--sidebar-border-radius);
    /* MODIFIED: Standardized border radius */
    border: 1px solid var(--sidebar-white-08);
    backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, text-shadow 0.2s ease;
    will-change: background, border-color, transform;
}

.section-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.toggle-icon {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
    color: var(--sidebar-white-06);
}

.section-toggle.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.nav-links-container {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.2s ease;
    opacity: 1;
}

.nav-links-container.collapsed {
    max-height: 0;
    opacity: 0;
}

.section-title::before {
    display: none;
}

.section-title:hover {
    color: white;
    background: var(--sidebar-white-08);
    border-color: var(--sidebar-white-15);
    text-shadow: 0 0 8px var(--sidebar-white-30);
}

.section-title:hover::before {
    /* Removed */
}

.section-toggle:hover .toggle-icon {
    color: white;
    transform: scale(1.1);
}



/* ===== SIMPLE NAVIGATION LINKS ===== */
.nav-link {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.2rem;
    /* MODIFIED: Increased padding */
    color: var(--sidebar-text);
    border-radius: var(--sidebar-border-radius);
    /* MODIFIED: Standardized border radius */
    gap: 1rem;
    /* MODIFIED: Increased gap */
    transition: color 0.2s ease, text-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    margin-bottom: 0.5rem;
    /* MODIFIED: Increased margin */
    position: relative;
    border: 1px solid var(--sidebar-white-15);
    box-sizing: border-box;
    background: linear-gradient(135deg, var(--sidebar-primary-15) 0%, var(--sidebar-primary-dark-10) 50%, var(--sidebar-primary-08) 100%);
    backdrop-filter: blur(10px);
    overflow: hidden;
    will-change: transform, box-shadow;
}

.nav-link:hover {
    color: white;
    text-shadow: 0 0 8px var(--sidebar-white-40);
    border-color: var(--sidebar-white-25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.nav-link:active {
    transform: translateY(0) scale(0.98);
    /* Press down effect */
    box-shadow: none;
}

.nav-link.active {
    background: linear-gradient(135deg, var(--sidebar-primary) 0%, var(--sidebar-primary-dark) 100%);
    color: white;
    font-weight: var(--sidebar-font-weight-bold);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--sidebar-border-radius);
    /* MODIFIED: Standardized border radius */
    backdrop-filter: blur(20px);
}

/* Shimmer Effect */
.nav-link::before {
    display: none;
}

.nav-link:hover::before {
    /* Removed */
}



/* Enhanced Navigation Icons */
.nav-link i {
    min-width: 1.75rem;
    width: 1.75rem;
    height: 1.75rem;
    font-size: 1rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--sidebar-border-radius);
    /* MODIFIED: Standardized border radius */
    background: var(--sidebar-white-10);
    border: 1px solid var(--sidebar-white-15);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    color: var(--sidebar-white-80);
    will-change: transform, background, box-shadow;
}

.nav-link:hover i {
    color: white;
    background: var(--sidebar-white-20);
    border-color: var(--sidebar-white-30);
    transform: scale(1.05);
    text-shadow: 0 0 12px var(--sidebar-white-60);
}

.nav-link.active i {
    color: white;
    background: linear-gradient(135deg, var(--sidebar-white-25) 0%, var(--sidebar-white-15) 100%);
    border-color: var(--sidebar-white-40);
    transform: scale(1.08);
    text-shadow: 0 0 12px var(--sidebar-white-70), 0 1px 3px var(--sidebar-black-30);
}



/* Simple Navigation Text */
.nav-text {
    color: inherit;
    font-family: var(--sidebar-font-family);
    font-size: var(--sidebar-font-size-xs);
    font-weight: var(--sidebar-font-weight-medium);
    transition: color 0.2s ease, text-shadow 0.2s ease, font-weight 0.2s ease, letter-spacing 0.2s ease;
    white-space: nowrap;
    line-height: 1.4;
}

.nav-link:hover .nav-text {
    color: white;
    text-shadow: 0 0 8px var(--sidebar-white-40);
    font-weight: var(--sidebar-font-weight-semibold);
    letter-spacing: 0.025em;
}

.nav-link.active .nav-text {
    color: white;
    font-weight: var(--sidebar-font-weight-bold);
    text-shadow: 0 2px 8px var(--sidebar-black-40), 0 0 16px var(--sidebar-white-70);
    letter-spacing: 0.05em;
}

/* ===== ENHANCED USER PROFILE ===== */
.user-profile {
    padding: 1.5rem;
    border-top: 1px solid var(--sidebar-border);
    background: var(--sidebar-card-bg);
    backdrop-filter: blur(12px);
    margin-top: auto;
    position: relative;
    overflow: hidden;
}

.user-profile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--sidebar-gradient-secondary);
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: -1;
}

.user-profile:hover::before {
    opacity: 1;
}

.user-content {
    display: flex;
    flex-direction: column;
    /* Stack elements vertically */
    align-items: center;
    /* Center horizontally */
    text-align: center;
    gap: 1rem;
    /* Consistent gap */
    position: relative;
    z-index: 2;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--sidebar-border-radius-lg);
    background: var(--sidebar-gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 16px var(--sidebar-primary-30);
    border: 2px solid var(--sidebar-border);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    font-weight: var(--sidebar-font-weight-bold);
    font-size: var(--sidebar-font-size-lg);
}

.user-avatar:hover {
    box-shadow: 0 6px 24px var(--sidebar-primary-40);
    transform: scale(1.05);
}

.user-info {
    transition: opacity 0.2s ease;
    overflow: hidden;
}

.user-name {
    color: var(--sidebar-text);
    font-family: var(--sidebar-font-family);
    font-weight: var(--sidebar-font-weight-semibold);
    font-size: var(--sidebar-font-size-base);
    margin-bottom: 0.25rem;
    line-height: 1.3;
    transition: color 0.2s ease;
}

.user-profile:hover .user-name {
    color: var(--sidebar-primary);
}

.user-role {
    color: var(--sidebar-text-muted);
    font-family: var(--sidebar-font-family);
    font-size: var(--sidebar-font-size-sm);
    font-weight: var(--sidebar-font-weight-normal);
    line-height: 1.3;
    transition: color 0.2s ease;
}

.user-profile:hover .user-role {
    color: var(--sidebar-text);
}

/* Enhanced User Actions */
.user-actions {
    display: flex;
    gap: 0.5rem;
}

.user-action-btn {
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: var(--sidebar-border-radius);
    /* MODIFIED: Standardized border radius */
    background: var(--sidebar-white-10);
    color: var(--sidebar-white-07);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    font-size: 0.875rem;
    border: 1px solid var(--sidebar-white-15);
    will-change: transform, background, border-color;
}

.user-action-btn:hover {
    background: var(--sidebar-white-20);
    color: white;
    border-color: var(--sidebar-white-25);
    transform: translateY(-2px);
}

.user-action-btn:active {
    transform: scale(0.95);
}

/* ===== ENHANCED COLLAPSED STATE ===== */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    overflow-x: hidden;
    box-shadow: var(--sidebar-shadow);
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
}

/* Only apply collapsed styles on desktop */
@media (min-width: 993px) {

    .sidebar.collapsed .nav-text,
    .sidebar.collapsed .user-info,
    .sidebar.collapsed .brand-text,
    .sidebar.collapsed .sidebar-search {
        opacity: 0;
        width: 0;
        transform: translateX(20px);
        overflow: hidden;
    }

    /* Center all elements in collapsed state */
    .sidebar.collapsed .sidebar-brand {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 1.25rem 0 !important;
        width: 100% !important;
        text-align: center !important;
        gap: 0;
        /* Reset gap to prevent spacing issues */
    }

    .sidebar.collapsed .brand-logo {
        margin: 0 !important;
        /* Remove all margins to allow for perfect centering */
    }

    .sidebar.collapsed .user-avatar {
        margin: 0;
        /* Remove all margins for perfect centering */
    }

    .sidebar.collapsed .user-profile {
        padding: 1.5rem 0;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        width: 100% !important;
    }

    .sidebar.collapsed .user-content {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.75rem;
        width: 100% !important;
        text-align: center !important;
    }

    .sidebar.collapsed .user-actions {
        flex-direction: column !important;
        gap: 0.5rem;
        margin: 0 auto !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        text-align: center !important;
    }

    .sidebar.collapsed .user-action-btn {
        margin: 0.25rem auto !important;
    }

    /* Center the entire sidebar content */
    /* START: اصلاح اسکرول افقی */
    .sidebar.collapsed .sidebar-content {
        width: 100%;
        /* Ensure content does not exceed sidebar width */
        overflow-x: hidden;
        /* Prevent horizontal scrolling */
        flex: 1;
        overflow-y: auto;
        padding: 1rem 0 1.5rem;
        scrollbar-width: thin;
        scrollbar-color: rgba(108, 95, 252, 0.3) transparent;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        background: transparent;
        position: relative;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: center !important;
    }

    /* END: اصلاح اسکرول افقی */

    .sidebar.collapsed .nav-section {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        margin-bottom: 1rem;
        text-align: center !important;
    }

    .sidebar.collapsed .nav-links-container {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        text-align: center !important;
    }

    /* === FIX START: Resize and show title in collapsed mode === */
    .sidebar.collapsed .section-title {
        writing-mode: vertical-lr;
        text-orientation: mixed;
        transform: rotate(180deg);
        padding: 0.75rem 0;
        height: 100px;
        /* A more compact height */
        width: 44px;
        /* Matches the width of the icons below */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0.5rem auto !important;
        font-size: var(--sidebar-font-size-xs);
        letter-spacing: normal;
        text-align: center !important;
        overflow: hidden;
        white-space: nowrap;
        background: var(--sidebar-white-05);
        border-radius: var(--sidebar-border-radius);
        border: 1px solid var(--sidebar-white-08);
        backdrop-filter: blur(8px);
        position: relative;
    }

    .sidebar.collapsed .section-title span {
        display: block;
        /* Ensure text is visible */
    }

    .sidebar.collapsed .section-title .toggle-icon {
        position: absolute;
        bottom: 0.5rem;
        left: 50%;
        transform: translateX(-50%) rotate(0deg);
        /* Reset rotation */
        margin-top: 0.5rem;
        opacity: 0.7;
    }

    .sidebar.collapsed .section-toggle.collapsed .toggle-icon {
        transform: translateX(-50%) rotate(90deg);
        /* Rotate when section is collapsed */
    }

    .sidebar.collapsed .section-title::before {
        display: none;
    }

    .sidebar.collapsed .section-title:hover {
        color: white;
        background: var(--sidebar-white-08);
        border-color: var(--sidebar-white-15);
        text-shadow: 0 0 8px var(--sidebar-white-30);
    }

    .sidebar.collapsed .section-toggle:hover .toggle-icon {
        color: white;
        transform: translateX(-50%) scale(1.1);
    }

    .sidebar.collapsed .section-toggle.collapsed:hover .toggle-icon {
        transform: translateX(-50%) rotate(90deg) scale(1.1);
    }

    /* === FIX END === */
}

/* Only apply collapsed nav-link styles on desktop */
@media (min-width: 993px) {
    .sidebar.collapsed .nav-links-container {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .sidebar.collapsed .nav-link {
        width: 44px;
        /* MODIFIED: Slightly larger for better touch/click target */
        height: 44px;
        /* MODIFIED: Slightly larger for better touch/click target */
        padding: 0;
        margin: 0.5rem auto !important;
        /* MODIFIED: Increased margin */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: relative;
        overflow: hidden;
        border-radius: var(--sidebar-border-radius);
        /* MODIFIED: Standardized border radius */
        background: linear-gradient(135deg, rgba(68, 129, 235, 0.15) 0%, rgba(4, 190, 254, 0.1) 50%, rgba(68, 129, 235, 0.08) 100%);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.15);
        backdrop-filter: blur(10px);
    }

    .sidebar.collapsed .nav-link:hover {
        box-shadow: 0 4px 16px rgba(108, 95, 252, 0.2);
        border-color: rgba(255, 255, 255, 0.25);
    }

    .sidebar.collapsed .nav-link i {
        margin: 0;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 1rem;
        background: transparent;
        border: none;
        width: auto;
        height: auto;
    }

    .sidebar.collapsed .nav-link.active {
        background: linear-gradient(135deg, var(--sidebar-primary) 0%, var(--sidebar-primary-dark) 100%);
        color: white;
        box-shadow: var(--sidebar-shadow-hover);
        border: 1px solid rgba(255, 255, 255, 0.4);
        backdrop-filter: blur(20px);
    }

    .sidebar.collapsed .nav-link.active i {
        color: white;
        transform: translate(-50%, -50%) scale(1.1);
        background: transparent;
        border: none;
    }
}

/* ===== ENHANCED CLOSE BUTTON ===== */
.sidebar-close {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--sidebar-border-radius);
    color: var(--sidebar-text-muted);
    width: 44px;
    height: 44px;
    position: absolute;
    left: 1rem;
    top: 1rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1060;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(12px);
    overflow: hidden;
}

.sidebar-close i {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 1.25rem;
}

.sidebar-close:hover {
    background: rgba(244, 63, 94, 0.15); /* Danger/close red glow */
    color: #f43f5e;
    box-shadow: 0 4px 20px rgba(244, 63, 94, 0.3);
    border-color: rgba(244, 63, 94, 0.5);
    transform: translateY(-2px) scale(1.05);
}

.sidebar-close:hover i {
    transform: rotate(180deg) scale(1.15);
}

.sidebar-close:active {
    transform: translateY(1px) scale(0.95);
    box-shadow: 0 2px 10px rgba(244, 63, 94, 0.2);
}

/* ===== ENHANCED MAIN CONTENT ===== */
.main-content {
    margin-right: var(--sidebar-width-lg);
    transition: var(--sidebar-transition);
    min-height: 100vh;
    position: relative;
}

.main-content.expanded {
    margin-right: var(--sidebar-collapsed-width);
}

/* ===== ENHANCED TOP BAR ===== */
.top-bar {
    background: var(--sidebar-card-bg);
    backdrop-filter: blur(20px);
    height: var(--header-height);
    padding: 0 1.5rem;
    position: fixed;
    top: 0;
    right: var(--sidebar-width-lg);
    left: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--sidebar-transition);
    border-bottom: 1px solid var(--sidebar-border);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

.main-content.expanded .top-bar {
    right: var(--sidebar-collapsed-width);
}

/* ===== ENHANCED MOBILE OVERLAY ===== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: var(--sidebar-black-60);
    backdrop-filter: blur(8px);
    z-index: 1049;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ===== ENHANCED RESPONSIVE STYLES ===== */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(100%);
        box-shadow: -8px 0 32px var(--sidebar-black-20);
        width: min(300px, 85vw);
        position: fixed;
        right: 0;
        top: 0;
        height: 100vh;
        height: 100dvh;
        /* Use dvh for better mobile support */
        z-index: 1050;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        overflow-x: hidden;
    }

    .sidebar-search {
        position: static;
        margin-bottom: 1rem;
    }

    .sidebar.show {
        transform: translateX(0) !important;
        display: flex !important;
        visibility: visible !important;
        animation: slideInFromRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .main-content {
        margin-right: 0 !important;
    }

    .top-bar {
        right: 0 !important;
    }

    .sidebar-close {
        display: flex;
    }

    .nav-link {
        padding: 1.25rem 1.5rem;
        margin-bottom: 0.75rem;
    }

    .nav-link i {
        font-size: 1.25rem;
    }

    .nav-text {
        font-size: var(--sidebar-font-size-base);
    }
}

/* ===== ENHANCED ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes bounce {

    0%,
    20%,
    60%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-3px);
    }

    80% {
        transform: translateY(-1px);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(108, 95, 252, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(108, 95, 252, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(108, 95, 252, 0);
    }
}

@keyframes activeGlow {
    0% {
        box-shadow: 0 20px 50px rgba(68, 129, 235, 0.6), 0 12px 30px rgba(4, 190, 254, 0.4), 0 6px 16px rgba(0, 0, 0, 0.3), inset 0 3px 0 rgba(255, 255, 255, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    }

    100% {
        box-shadow: 0 25px 60px rgba(68, 129, 235, 0.8), 0 15px 40px rgba(4, 190, 254, 0.6), 0 8px 20px rgba(0, 0, 0, 0.4), inset 0 4px 0 rgba(255, 255, 255, 0.6), inset 0 -3px 0 rgba(0, 0, 0, 0.3);
    }
}

@keyframes iconPulse {
    0% {
        transform: scale(1.3) rotate(-5deg) translateZ(15px);
        text-shadow: 0 0 20px rgba(255, 255, 255, 1), 0 0 12px rgba(4, 190, 254, 0.9), 0 2px 4px rgba(0, 0, 0, 0.5);
    }

    100% {
        transform: scale(1.35) rotate(-3deg) translateZ(20px);
        text-shadow: 0 0 25px rgba(255, 255, 255, 1), 0 0 15px rgba(4, 190, 254, 1), 0 3px 6px rgba(0, 0, 0, 0.6);
    }
}


/* ===== PERFECT MODERN TOGGLE BUTTON (REFACTORED) ===== */
.toggle-btn {
    background: rgba(196, 154, 94, 0.05); /* Subtle gold tint */
    border: 1px solid rgba(196, 154, 94, 0.2);
    border-radius: 50%; /* Perfect circle */
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-inline-end: 1rem;
    backdrop-filter: blur(12px);
    position: relative;
    z-index: 1060;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), inset 0 0 10px rgba(196, 154, 94, 0.05);
}

.toggle-btn:hover {
    background: rgba(196, 154, 94, 0.15);
    border-color: rgba(196, 154, 94, 0.5);
    box-shadow: 0 6px 20px rgba(196, 154, 94, 0.25), inset 0 0 15px rgba(196, 154, 94, 0.1);
    transform: translateY(-2px) scale(1.05);
}

.toggle-btn:active {
    transform: translateY(1px) scale(0.95);
    background: rgba(196, 154, 94, 0.25);
    box-shadow: 0 2px 10px rgba(196, 154, 94, 0.15);
}

@media (max-width: 992px) {
    .toggle-btn {
        margin-inline-end: 0;
        z-index: 1070;
    }
}

/* ===== PERFECT MODERN HAMBURGER ICON (REFACTORED) ===== */
.hamburger-icon {
    position: relative;
    width: 24px;
    height: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}

.hamburger-line {
    width: 24px;
    height: 2.5px;
    background-color: var(--sidebar-text);
    border-radius: 4px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease, background-color 0.3s ease;
    transform-origin: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Hover State (Non-Active) */
.toggle-btn:hover .hamburger-icon {
    transform: scale(1.1);
}

.toggle-btn:hover .hamburger-line {
    background-color: #ffffff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.toggle-btn:not(.active):hover .hamburger-line:nth-child(1) {
    transform: translateY(-2px);
}

.toggle-btn:not(.active):hover .hamburger-line:nth-child(3) {
    transform: translateY(2px);
}

/* Active State (Perfect X Morph) */
.toggle-btn.active .hamburger-icon {
    transform: rotate(180deg);
}

.toggle-btn.active .hamburger-line {
    background-color: var(--sidebar-primary);
    box-shadow: 0 0 15px var(--sidebar-primary-40);
}

.toggle-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(7.75px) rotate(45deg);
}

.toggle-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.toggle-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-7.75px) rotate(-45deg);
}

/* Hover State (Active X) */
.toggle-btn.active:hover .hamburger-icon {
    transform: rotate(180deg) scale(1.15);
}

.toggle-btn.active:hover .hamburger-line {
    background-color: #ffffff;
    box-shadow: 0 0 20px var(--sidebar-primary-50);
}

/* Click/Active Feedback */
.toggle-btn:active .hamburger-icon {
    transform: scale(0.9);
    transition: transform 0.1s ease;
}

/* Enhanced Particle effect animations */
@keyframes enhancedParticleBurst {
    0% {
        opacity: 1;
        transform: scale(0) rotate(0deg) translateZ(0);
        filter: brightness(1.5) blur(0px);
    }

    25% {
        opacity: 0.9;
        transform: scale(1.2) rotate(90deg) translateZ(10px);
        filter: brightness(1.8) blur(1px);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.8) rotate(180deg) translateZ(15px);
        filter: brightness(2) blur(1.5px);
    }

    75% {
        opacity: 0.4;
        transform: scale(2.2) rotate(270deg) translateZ(20px);
        filter: brightness(1.5) blur(2px);
    }

    100% {
        opacity: 0;
        transform: scale(2.8) rotate(360deg) translateZ(25px);
        filter: brightness(1) blur(3px);
    }
}

/* ===== ENHANCED INTERACTIVE EFFECTS ===== */

/* Enhanced Section Dividers */
.nav-section:not(:last-child)::after {
    content: '';
    display: block;
    width: 90%;
    /* MODIFIED: Increased width */
    height: 1px;
    background: var(--sidebar-border);
    /* MODIFIED: Simplified for elegance */
    margin: 1.75rem auto 0;
    /* MODIFIED: Adjusted margin */
    opacity: 0.5;
    /* MODIFIED: Added opacity for subtlety */
}

/* Ultra-Enhanced Focus States for Accessibility */
.nav-link:focus-visible,
.toggle-btn:focus-visible,
.sidebar-close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--sidebar-primary), 0 0 0 6px var(--sidebar-primary-30), 0 0 20px var(--sidebar-primary-40);
    border-radius: var(--sidebar-border-radius);
}

.toggle-btn:focus-visible .hamburger-icon {
    animation: focusPulse 1.5s ease-in-out infinite;
}

.toggle-btn:focus-visible .hamburger-line {
    box-shadow: 0 0 12px var(--sidebar-primary), 0 0 24px var(--sidebar-primary-30);
}

@keyframes focusPulse {

    0%,
    100% {
        transform: scale(1);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.05);
        filter: brightness(1.2);
    }
}

/* Enhanced Mobile Interactions */
@media (max-width: 768px) {
    .sidebar {
        width: min(280px, 90vw);
        /* Smaller width on very small screens */
    }

    .nav-link {
        padding: 1rem 1.25rem;
        margin-bottom: 0.5rem;
        font-size: 0.9rem;
    }

    .nav-link:active {
        transform: scale(0.98);
        background: var(--sidebar-hover);
    }

    .toggle-btn:active {
        transform: scale(0.9);
    }

    /* Optimize performance on mobile */
    .nav-link::after,
    .nav-link::before {
        display: none;
    }

    /* Reduce animation complexity on mobile */
    .nav-link.search-highlight {
        animation: none;
        background: var(--sidebar-primary-20);
    }

    /* Simplify transitions on mobile */
    .nav-link,
    .section-title,
    .search-container {
        transition: all 0.2s ease;
    }

    /* Prevent body scroll when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}

@keyframes rotate360 {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.icon-rotate {
    animation: rotate360 0.5s ease-out;
}

/* Disabled state for toggle button */
.toggle-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.toggle-btn:disabled .hamburger-icon {
    animation: none;
    filter: grayscale(1);
}

.toggle-btn:disabled .hamburger-line {
    background: var(--sidebar-text-muted);
    box-shadow: none;
}

/* Ultra-smooth performance optimizations and hardware acceleration */
.hamburger-icon,
.hamburger-line,
.toggle-btn {
    transform: translateZ(0);
    will-change: transform, opacity, filter, background, box-shadow, border-color;
}

/* Performance optimizations for smooth 60fps animations */
.hamburger-icon {
    isolation: isolate;
    transform-style: preserve-3d;
}

.hamburger-line {
    isolation: isolate;
    backface-visibility: hidden;
}

/* GPU acceleration hints */
.toggle-btn,
.hamburger-icon,
.hamburger-line {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000px;
    perspective: 1000px;
    -webkit-font-smoothing: antialiased;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .hamburger-line {
        border: 1px solid currentColor;
        background: currentColor;
    }

    .toggle-btn.active .hamburger-line {
        border-color: currentColor;
    }
}

/* Reduced motion support - Perfect X without animation */
@media (prefers-reduced-motion: reduce) {

    .hamburger-icon,
    .hamburger-line,
    .toggle-btn {
        animation: none !important;
        transition: none !important;
    }

    .toggle-btn.active .hamburger-line:nth-child(1),
    .toggle-btn:hover .hamburger-line:nth-child(1) {
        transform: translateY(9.25px) rotate(45deg) scale(1.1);
        transition: none;
    }

    .toggle-btn.active .hamburger-line:nth-child(2),
    .toggle-btn:hover .hamburger-line:nth-child(2) {
        opacity: 0;
        transform: scale(0);
        transition: none;
        width: 0;
    }

    .toggle-btn.active .hamburger-line:nth-child(3),
    .toggle-btn:hover .hamburger-line:nth-child(3) {
        transform: translateY(-9.25px) rotate(-45deg) scale(1.1);
        transition: none;
    }
}

/* ===== START: Collapsed Search Button Styles ===== */

/* Container for the collapsed search button, hidden by default */
.collapsed-search-container {
    display: none;
    padding-top: 1rem;
    /* Add some space from the brand logo */
}

/* Styles for the trigger button itself */
.collapsed-search-trigger {
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-radius: var(--sidebar-border-radius);
    background: linear-gradient(135deg, rgba(68, 129, 235, 0.15) 0%, rgba(4, 190, 254, 0.1) 50%, rgba(68, 129, 235, 0.08) 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: var(--sidebar-transition-fast);
    color: var(--sidebar-text);
}

.collapsed-search-trigger:hover {
    box-shadow: 0 4px 16px rgba(108, 95, 252, 0.2);
    border-color: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
    color: white;
}

.collapsed-search-trigger i {
    font-size: 1rem;
    transition: var(--sidebar-transition-fast);
}

/* Show the search button ONLY when the sidebar is collapsed on desktop */
@media (min-width: 993px) {
    .sidebar.collapsed .collapsed-search-container {
        display: block;
        /* Show the container */
    }
}

/* ===== END: Collapsed Search Button Styles ===== */