/**
 * 🚀 UNIFIED SIDEBAR STYLES 🚀
 * Volvo Apple Design - Einheitliche Sidebar für alle Admin-Seiten
 * 
 * Features:
 * - Volvo Apple Design System
 * - Dark/Light mode support
 * - Smooth animations
 * - Responsive design
 * - Consistent styling across all pages
 */

:root {
    /* 🎨 Volvo Apple Design System */
    --volvo-blue: #003057;
    --volvo-light-blue: #4a90a4;
    --volvo-accent: #0078d4;
    --volvo-success: #10b981;
    --volvo-warning: #f59e0b;
    --volvo-error: #ef4444;
    --volvo-info: #3b82f6;
    
    /* 🌞 Light Theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f4;
    --text-primary: #1a1a1a;
    --text-secondary: #5f6368;
    --text-tertiary: #9aa0a6;
    --border-primary: #e8eaed;
    --border-secondary: #dadce0;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --shadow-heavy: rgba(0, 0, 0, 0.25);
    
    /* 🧱 Spacing System */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    
    /* 📐 Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* 🎭 Shadows */
    --shadow-sm: 0 1px 3px var(--shadow-light);
    --shadow-md: 0 4px 12px var(--shadow-medium);
    --shadow-lg: 0 8px 24px var(--shadow-medium);
    --shadow-xl: 0 16px 48px var(--shadow-heavy);
    
    /* 🎬 Animations */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 🌙 Dark Theme */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #202124;
    --bg-tertiary: #2d2e32;
    --text-primary: #ffffff;
    --text-secondary: #e8eaed;
    --text-tertiary: #9aa0a6;
    --border-primary: #3c4043;
    --border-secondary: #5f6368;
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --shadow-heavy: rgba(0, 0, 0, 0.6);
}

/* Dark Theme Sidebar Overrides */
[data-theme="dark"] .smart-sidebar {
    background: linear-gradient(180deg, 
        rgba(26, 26, 26, 0.95) 0%, 
        rgba(32, 33, 36, 0.9) 50%,
        rgba(45, 46, 50, 0.85) 100%);
    border-right: 1px solid rgba(60, 64, 67, 0.8);
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .nav-section.collapsible {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .nav-section-header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .nav-section-header:hover {
    background: linear-gradient(135deg, rgba(0, 48, 87, 0.15), rgba(0, 48, 87, 0.08));
    border-color: rgba(0, 48, 87, 0.4);
}

[data-theme="dark"] .nav-item.main-item {
    background: linear-gradient(135deg, rgba(0, 48, 87, 0.08), rgba(0, 48, 87, 0.03));
    border: 1px solid rgba(0, 48, 87, 0.15);
}

[data-theme="dark"] .nav-item.sub-item {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .nav-item.sub-item:hover {
    background: rgba(0, 48, 87, 0.12);
    border-color: rgba(0, 48, 87, 0.25);
}

/* 🧭 Smart Sidebar - Volvo Apple Design */
.smart-sidebar {
    width: 300px;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(248, 249, 250, 0.9) 50%,
        rgba(241, 243, 244, 0.85) 100%);
    border-right: 1px solid rgba(232, 234, 237, 0.8);
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: all var(--transition-normal);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    backdrop-filter: blur(20px) saturate(180%);
    overflow: hidden;
}

.smart-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.8) 50%, 
        transparent 100%);
}

.sidebar-header {
    padding: var(--space-xl);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--volvo-blue), var(--volvo-accent));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: var(--shadow-md);
}

.logo-text h1 {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin: 0;
}

.logo-text span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* 🎛️ Theme Toggle */
.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-full);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    background: var(--volvo-accent);
    color: white;
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* 🧭 Navigation */
.smart-nav {
    flex: 1;
    padding: var(--space-lg);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--space-xl);
}

.nav-section-title {
    padding: 0 var(--space-md) var(--space-sm);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
}

.nav-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    position: relative;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--bg-secondary);
    color: var(--volvo-blue);
    transform: translateX(4px);
    text-decoration: none;
}

.nav-item.active {
    background: linear-gradient(135deg, var(--volvo-blue), var(--volvo-accent));
    color: white;
    box-shadow: var(--shadow-md);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -var(--space-lg);
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--volvo-accent);
    border-radius: var(--radius-full);
}

/* Professional Navigation Groups - Enterprise Grade */
.nav-section.professional-group {
    margin-bottom: var(--space-lg);
    position: relative;
}

.nav-group-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    background: transparent;
    border: none;
    margin-bottom: var(--space-sm);
    position: relative;
}

.nav-group-trigger:hover {
    background: rgba(0, 48, 87, 0.03);
}

.nav-group-label {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.nav-group-text {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.nav-group-badge {
    background: var(--volvo-blue);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    line-height: 1.1;
    letter-spacing: 0.5px;
}

.nav-group-toggle {
    opacity: 0.4;
    transition: all var(--transition-fast);
}

.nav-group-toggle i {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.nav-group-trigger.active .nav-group-toggle {
    opacity: 1;
    transform: rotate(180deg);
}

.nav-group-trigger.active .nav-group-toggle i {
    color: var(--volvo-blue);
}

.nav-group-menu {
    max-height: 0;
    overflow: hidden;
    transition: all var(--transition-medium);
    opacity: 0;
    padding-left: var(--space-xl);
    margin-bottom: var(--space-sm);
}

.nav-group-menu.expanded {
    max-height: 400px;
    opacity: 1;
}

/* Professional Navigation Items */
.nav-item.primary-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    transition: all var(--transition-medium);
    position: relative;
    background: linear-gradient(135deg, var(--volvo-blue), var(--volvo-accent));
    box-shadow: 0 4px 20px rgba(0, 48, 87, 0.15);
    overflow: hidden;
}

.nav-item.primary-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 0 2px 2px 0;
}

.nav-item.primary-item:hover {
    transform: translateX(4px) translateY(-1px);
    box-shadow: 0 8px 30px rgba(0, 48, 87, 0.25);
}

.nav-item.primary-item.active {
    box-shadow: 0 8px 30px rgba(0, 48, 87, 0.35);
}

.nav-item-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.nav-item-text {
    flex: 1;
    font-weight: inherit;
}

.nav-item-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transition: all var(--transition-fast);
}

.nav-item.primary-item:hover .nav-item-indicator {
    background: white;
    transform: scale(1.2);
}

.nav-item.secondary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
    position: relative;
    background: transparent;
    border: none;
}

.nav-item.secondary-item:hover {
    background: rgba(0, 48, 87, 0.05);
    color: var(--volvo-blue);
    transform: translateX(2px);
}

.nav-item.secondary-item.active {
    background: var(--volvo-blue);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 48, 87, 0.2);
}

.nav-item-status {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-tertiary);
    transition: all var(--transition-fast);
    opacity: 0;
}

.nav-item.secondary-item:hover .nav-item-status {
    background: var(--volvo-blue);
    opacity: 1;
    transform: scale(1.5);
}

.nav-item.secondary-item.active .nav-item-status {
    background: white;
    opacity: 1;
    transform: scale(1.5);
}

/* Development Section Styling */
.nav-section.professional-group.dev-section {
    border-top: 1px solid var(--border-primary);
    padding-top: var(--space-lg);
    margin-top: var(--space-lg);
}

.nav-section.professional-group.dev-section .nav-group-text {
    color: var(--volvo-warning);
}

.nav-section.professional-group.dev-section .nav-group-badge.dev-badge {
    background: var(--volvo-warning);
}

.nav-section.professional-group.dev-section .nav-group-trigger.active .nav-group-toggle i {
    color: var(--volvo-warning);
}

.nav-section.professional-group.dev-section .nav-item.secondary-item:hover {
    color: var(--volvo-warning);
}

.nav-section.professional-group.dev-section .nav-item.secondary-item:hover .nav-item-status {
    background: var(--volvo-warning);
}

.nav-section.professional-group.dev-section .nav-item.secondary-item.active {
    background: var(--volvo-warning);
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* 📱 Main Content Adjustment */
.admin-main {
    margin-left: 300px;
    transition: margin-left var(--transition-normal);
}

/* Sidebar collapsed state */
.smart-sidebar.collapsed {
    width: 80px;
}

.smart-sidebar.collapsed .logo-text,
.smart-sidebar.collapsed .nav-text,
.smart-sidebar.collapsed .nav-section-title {
    display: none;
}

.smart-sidebar.collapsed .nav-item {
    justify-content: center;
    padding: var(--space-md);
}

.smart-sidebar.collapsed + .admin-main {
    margin-left: 80px;
}

/* 📱 Responsive Design */
@media (max-width: 1024px) {
    .smart-sidebar {
        width: 260px;
    }
    
    .admin-main {
        margin-left: 260px;
    }
    
    .smart-sidebar.collapsed + .admin-main {
        margin-left: 80px;
    }
}

@media (max-width: 768px) {
    .smart-sidebar {
        position: fixed;
        left: -300px;
        transition: left var(--transition-normal);
        z-index: 2000;
    }
    
    .smart-sidebar.open {
        left: 0;
    }
    
    .admin-main {
        margin-left: 0 !important;
    }
    
    .smart-sidebar.collapsed + .admin-main {
        margin-left: 0 !important;
    }
}

/* 🎨 Custom Scrollbar */
.smart-sidebar::-webkit-scrollbar {
    width: 8px;
}

.smart-sidebar::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.smart-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: var(--radius-full);
}

.smart-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--volvo-accent);
}

/* 🎭 Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-secondary);
    border-radius: 50%;
    border-top-color: var(--volvo-accent);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 3000;
    background: var(--volvo-blue);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    width: 48px;
    height: 48px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mobile-menu-toggle:hover {
    background: var(--volvo-accent);
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
}

/* Overlay for mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    display: none;
}

@media (max-width: 768px) {
    .sidebar-overlay.active {
        display: block;
    }
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border-primary);
    margin-top: auto;
}

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

.user-menu-btn {
    width: 100%;
    background: none;
    border: none;
    padding: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
}

.user-menu-btn:hover {
    background: var(--bg-secondary);
    color: var(--volvo-blue);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--volvo-blue), var(--volvo-accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    text-align: left;
}

.user-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.user-role {
    display: block;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.user-chevron {
    font-size: 0.8rem;
    transition: transform var(--transition-fast);
}

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

.user-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-normal);
    margin-bottom: var(--space-sm);
}

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

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--border-primary);
}

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

.user-dropdown-item:hover {
    background: var(--bg-secondary);
    color: var(--volvo-blue);
    text-decoration: none;
}

.user-dropdown-item.logout:hover {
    color: var(--volvo-error);
}

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

.user-dropdown-divider {
    height: 1px;
    background: var(--border-primary);
    margin: var(--space-xs) 0;
}

/* Collapsed sidebar user menu */
.smart-sidebar.collapsed .user-info,
.smart-sidebar.collapsed .user-chevron {
    display: none;
}

.smart-sidebar.collapsed .user-menu-btn {
    justify-content: center;
    padding: var(--space-md);
}

.smart-sidebar.collapsed .user-dropdown {
    left: 80px;
    right: auto;
    width: 200px;
}
