/**
 * Modern Sidebar v1.0 - Snelnotuleren
 * Professional dark theme with smooth animations
 */

/* ============================================
   CSS VARIABLES FOR SIDEBAR
   ============================================ */
:root {
    --sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --sidebar-border: rgba(255, 255, 255, 0.06);
    --sidebar-text: rgba(255, 255, 255, 0.7);
    --sidebar-text-muted: rgba(255, 255, 255, 0.4);
    --sidebar-text-active: #ffffff;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.05);
    --sidebar-active-bg: rgba(0, 187, 255, 0.15);
    --sidebar-active-border: #00BBFF;
    --sidebar-accent: #00BBFF;
    --sidebar-accent-glow: rgba(0, 187, 255, 0.3);
    --sidebar-section-border: rgba(255, 255, 255, 0.08);
    --sidebar-admin-accent: #f43f5e;
    --sidebar-admin-bg: rgba(244, 63, 94, 0.1);
}

/* ============================================
   SIDEBAR CONTAINER
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--sidebar-border);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

/* Subtle pattern overlay */
.sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
    opacity: 0.5;
}

/* ============================================
   SIDEBAR HEADER
   ============================================ */
.sidebar-header {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.sidebar-logo:hover {
    opacity: 0.9;
}

.sidebar-logo-img {
    display: block;
    height: 22px;
    width: auto;
}

.sidebar-logo-text {
    display: none; /* Hidden - using image logo instead */
    font-size: 22px;
    font-weight: 700;
    font-family: 'Urbanist', sans-serif;
    color: var(--sidebar-accent);
    letter-spacing: -0.02em;
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */
.sidebar-nav {
    flex: 1;
    padding: 8px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    z-index: 1;
}

/* Custom scrollbar for sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Navigation Sections */
.nav-section {
    margin-bottom: 8px;
}

.nav-section + .nav-section {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--sidebar-section-border);
}

.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-text-muted);
    padding: 8px 12px 6px;
    margin-bottom: 4px;
}

/* Admin section special styling */
.nav-section.admin-section .nav-section-title {
    color: var(--sidebar-admin-accent) !important;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-section.admin-section .nav-section-title::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--sidebar-admin-accent);
    border-radius: 50%;
    animation: pulse-admin 2s infinite;
}

@keyframes pulse-admin {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* ============================================
   NAVIGATION ITEMS
   ============================================ */
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 2px;
    position: relative;
    overflow: hidden;
}

/* Hover effect */
.nav-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--sidebar-hover-bg);
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: inherit;
}

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

.nav-item:hover {
    color: var(--sidebar-text-active);
}

/* Active state */
.nav-item.active {
    color: var(--sidebar-text-active);
    background: var(--sidebar-active-bg);
    font-weight: 600;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--sidebar-active-border);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 12px var(--sidebar-accent-glow);
}

/* Admin section nav items */
.nav-section.admin-section .nav-item.active {
    background: var(--sidebar-admin-bg);
}

.nav-section.admin-section .nav-item.active::after {
    background: var(--sidebar-admin-accent);
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.4);
}

/* Navigation Icons */
.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
    opacity: 1;
}

.nav-item.active .nav-icon {
    color: var(--sidebar-accent);
}

.nav-section.admin-section .nav-item.active .nav-icon {
    color: var(--sidebar-admin-accent);
}

/* Navigation Label */
.nav-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Navigation Badge */
.nav-badge {
    font-size: 11px;
    font-weight: 600;
    background: var(--sidebar-accent);
    color: #0f172a;
    padding: 2px 8px;
    border-radius: 10px;
    line-height: 1.4;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 0 12px var(--sidebar-accent-glow);
}

/* ============================================
   SIDEBAR FOOTER
   ============================================ */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--sidebar-section-border);
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    flex: 1;
    min-width: 0;
}

.user-menu:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--sidebar-section-border);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--sidebar-accent) 0%, #0ea5e9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px var(--sidebar-accent-glow);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--sidebar-text-active);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.user-email {
    font-size: 11px;
    color: var(--sidebar-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* Logout icon in user menu */
.user-menu-logout {
    width: 18px;
    height: 18px;
    color: var(--sidebar-text-muted);
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.user-menu:hover .user-menu-logout {
    color: var(--sidebar-admin-accent);
}

/* Logout button in sidebar footer */
.sidebar-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.sidebar-logout-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

.sidebar-logout-btn:hover .user-menu-logout {
    color: #ef4444;
}

/* ============================================
   SIDEBAR OVERLAY (MOBILE)
   ============================================ */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================
   MAIN CONTENT ADJUSTMENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   MOBILE MENU TOGGLE (BURGER)
   ============================================ */
.burger-menu,
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.burger-menu:hover,
.mobile-menu-toggle:hover {
    background: #f9fafb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.burger-menu span {
    display: block;
    width: 20px;
    height: 2px;
    background: #374151;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.burger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.burger-menu.active span:nth-child(2) {
    opacity: 0;
}

.burger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.3);
    }

    .main-content {
        margin-left: 0 !important;
        padding-top: 70px !important;
    }

    .burger-menu,
    .mobile-menu-toggle {
        display: flex !important;
    }
}

@media (max-width: 639px) {
    .sidebar {
        width: 100%;
        max-width: 300px;
    }
}

/* ============================================
   COLLAPSED STATE (FUTURE)
   ============================================ */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .user-info {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .user-menu {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .sidebar-logout-btn {
    display: none;
}

.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* ============================================
   BRAND BADGE (OPTIONAL)
   ============================================ */
.sidebar-brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(0, 187, 255, 0.15);
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    color: var(--sidebar-accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 8px;
}

/* ============================================
   TOOLTIP FOR COLLAPSED STATE
   ============================================ */
.nav-item[data-tooltip] {
    position: relative;
}

.sidebar.collapsed .nav-item[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1001;
}

.sidebar.collapsed .nav-item[data-tooltip]:hover::after {
    opacity: 1;
}
