/* Modern Volvo-Apple Style Sidebar CSS */

/* Modern Sidebar Styles - High Specificity */
body .modern-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, #1a1a1a 0%, #2d2d2d 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
}

body .modern-sidebar.collapsed {
    width: 80px;
}

.modern-sidebar.collapsed .nav-text,
.modern-sidebar.collapsed .logo-text,
.modern-sidebar.collapsed .nav-section-title,
.modern-sidebar.collapsed .user-info,
.modern-sidebar.collapsed .theme-text {
    opacity: 0;
    transform: translateX(-10px);
}

.modern-sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.75rem;
}

.modern-sidebar.collapsed .sidebar-header {
    padding: 1rem 0.5rem;
}

/* Sidebar Header */
.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.logo-icon svg {
    width: 20px;
    height: 20px;
}

.logo-text h2 {
    margin: 0;
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.logo-text span {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-toggle-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section-title {
    padding: 0 1rem 0.5rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.3s ease;
}

.nav-items {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin: 0 0.5rem;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.1), rgba(0, 86, 179, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 12px;
}

.nav-item:hover::before {
    opacity: 1;
}

.nav-item:hover {
    color: white;
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.2), rgba(0, 86, 179, 0.2));
    color: white;
    border: 1px solid rgba(0, 123, 255, 0.3);
}

.nav-item.active .nav-indicator {
    opacity: 1;
    transform: scaleY(1);
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.nav-item:hover .nav-icon {
    transform: scale(1.1);
}

.nav-text {
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-indicator {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 20px;
    background: linear-gradient(180deg, #007bff, #0056b3);
    border-radius: 2px;
    opacity: 0;
    transition: all 0.3s ease;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Theme Toggle */
.theme-toggle-container {
    display: flex;
    justify-content: center;
}

.theme-toggle-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    justify-content: center;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.theme-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-text {
    font-weight: 500;
    transition: all 0.3s ease;
}

/* User Menu */
.user-menu-container {
    position: relative;
}

.user-menu-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 12px;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.user-menu-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: all 0.3s ease;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.user-chevron {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.user-menu-container.active .user-chevron {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.user-menu-container.active .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.user-dropdown-item:last-child {
    border-bottom: none;
}

.user-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.user-dropdown-item.logout:hover {
    color: #ff4757;
}

.user-dropdown-item i {
    width: 16px;
    font-size: 0.9rem;
}

.user-dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.25rem 0;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dark Theme Styles */
body.dark-theme .modern-sidebar {
    background: linear-gradient(180deg, #1a1a1a 0%, #2d2d2d 100%);
}

body.light-theme .modern-sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border-right-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .logo-text h2,
body.light-theme .nav-text,
body.light-theme .user-name {
    color: #2c3e50;
}

body.light-theme .logo-text span,
body.light-theme .nav-section-title,
body.light-theme .user-role {
    color: rgba(44, 62, 80, 0.6);
}

body.light-theme .nav-item {
    color: rgba(44, 62, 80, 0.7);
}

body.light-theme .nav-item:hover,
body.light-theme .nav-item.active {
    color: #2c3e50;
}

body.light-theme .sidebar-toggle-btn,
body.light-theme .theme-toggle-btn,
body.light-theme .user-menu-btn {
    background: rgba(0, 0, 0, 0.1);
    color: rgba(44, 62, 80, 0.7);
}

body.light-theme .sidebar-toggle-btn:hover,
body.light-theme .theme-toggle-btn:hover,
body.light-theme .user-menu-btn:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #2c3e50;
}

/* Responsive */
@media (max-width: 768px) {
    .modern-sidebar {
        width: 100%;
        transform: translateX(-100%);
    }
    
    .modern-sidebar.mobile-open {
        transform: translateX(0);
    }
    
    body .modern-sidebar.collapsed {
        width: 100%;
    }
}

/* Smooth transitions for all elements */
* {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}