/* ============================================
   Sidebar Styles - استایل‌های سایدبار حرفه‌ای
   ============================================ */

.sidebar {
    position: fixed !important;
    right: 0 !important;
    top: 0 !important;
    width: var(--sidebar-width) !important;
    height: 100vh !important;
    background: linear-gradient(180deg, #1a1625 0%, #0f0a1a 100%) !important;
    color: var(--sidebar-text) !important;
    z-index: 1000 !important;
    transition: var(--transition) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Mobile: Sidebar should be above overlay */
@media (max-width: 768px) {
    .sidebar {
        z-index: 2000 !important;
    }
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width) !important;
    min-width: var(--sidebar-collapsed-width) !important;
    max-width: var(--sidebar-collapsed-width) !important;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #475569 0%, #334155 100%);
    border-radius: 4px;
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #64748b 0%, #475569 100%);
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.75rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    min-height: var(--header-height);
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    font-size: 1.375rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.5px;
}

.logo i {
    font-size: 1.75rem;
    background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(124, 58, 237, 0.4));
}

.sidebar.collapsed .logo span {
    display: none !important;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center !important;
    padding: 1.5rem 0.5rem !important;
}

.sidebar.collapsed .logo {
    justify-content: center !important;
}

.sidebar-toggle {
    display: block !important;
    color: var(--sidebar-text) !important;
    font-size: 1.25rem !important;
    padding: 0.625rem !important;
    border-radius: 0.5rem !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
    border: none !important;
    background: rgba(255, 255, 255, 0.05) !important;
    visibility: visible !important;
    opacity: 1 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
    transform: scale(1.05) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
}

.sidebar-toggle:active {
    transform: scale(0.95) !important;
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 1.25rem 0.75rem;
}

.nav-menu {
    padding: 0;
    margin: 0;
    list-style: none;
}

.nav-item {
    margin: 0.375rem 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem 1.25rem;
    color: rgba(203, 213, 225, 0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 0.75rem;
    margin: 0 0.5rem;
    text-decoration: none;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 4px;
    height: 0;
    background: linear-gradient(180deg, #a78bfa 0%, #7c3aed 100%);
    border-radius: 2px 0 0 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover {
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.2) 0%, rgba(124, 58, 237, 0.08) 100%);
    color: white;
    transform: translateX(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.nav-link:hover::before {
    transform: translateY(-50%) scaleY(1);
    height: 60%;
}

.nav-link i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    transition: all 0.3s ease;
    color: rgba(203, 213, 225, 0.8);
}

.nav-link:hover i {
    color: #a78bfa;
    transform: scale(1.1);
}

.nav-item.active .nav-link {
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.3) 0%, rgba(124, 58, 237, 0.15) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
    border: 1px solid rgba(124, 58, 237, 0.4);
}

.nav-item.active .nav-link::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(1);
    width: 4px;
    height: 60%;
    background: linear-gradient(180deg, #a78bfa 0%, #7c3aed 100%);
    border-radius: 2px 0 0 2px;
    box-shadow: 0 0 8px rgba(124, 58, 237, 0.6);
}

.nav-item.active .nav-link i {
    color: #a78bfa;
    transform: scale(1.15);
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .nav-link {
    justify-content: center !important;
    padding: 0.875rem !important;
    gap: 0 !important;
}

.sidebar.collapsed .nav-link i {
    margin: 0 auto !important;
}

/* Nav Divider */
.nav-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
    margin: 1.5rem 1.25rem;
    position: relative;
}

.nav-divider::before {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    transform: translateX(50%);
    width: 40px;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
}

.sidebar.collapsed .nav-divider {
    margin: 1.5rem 0.75rem;
}

/* Sidebar Overlay for Mobile - باید زیر sidebar باشد */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 999 !important;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* در موبایل overlay باید زیر sidebar باشد - z-index کمتر از sidebar */
@media (max-width: 768px) {
    .sidebar-overlay {
        z-index: 1998 !important;
    }
    
    .sidebar {
        z-index: 2000 !important;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        transform: translateX(100%);
        z-index: 2000 !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5) !important;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: block !important;
    }
    
    .main-content {
        margin-right: 0 !important;
        width: 100% !important;
    }
}

