/* Sidebar Scrolling Styles */

/* Custom scrollbar for sidebar navigation */
#sidebar nav {
    /* Ensure smooth scrolling */
    scroll-behavior: smooth;
    
    /* Custom scrollbar for webkit browsers */
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.6) rgba(55, 65, 81, 0.3);
}

/* Webkit scrollbar styling */
#sidebar nav::-webkit-scrollbar {
    width: 6px;
}

#sidebar nav::-webkit-scrollbar-track {
    background: rgba(55, 65, 81, 0.3);
    border-radius: 3px;
}

#sidebar nav::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.6);
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

#sidebar nav::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.8);
}

/* Hide scrollbar on mobile for cleaner look while maintaining functionality */
@media (max-width: 768px) {
    #sidebar nav {
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
    }
    
    #sidebar nav::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }
}

/* Ensure proper spacing and layout */
#sidebar {
    /* Prevent content from being cut off */
    min-height: 100vh;
    max-height: 100vh;
}

/* Navigation menu styling */
#navigation-menu {
    /* Add padding for better touch targets on mobile */
    padding-bottom: 1rem;
}

/* Menu item hover effects */
#navigation-menu a {
    /* Ensure proper touch target size */
    min-height: 44px;
    display: flex;
    align-items: center;
}

/* Smooth transitions for menu items */
#navigation-menu a:hover {
    transform: translateX(2px);
    transition: all 0.2s ease;
}

/* Focus styles for accessibility */
#navigation-menu a:focus {
    outline: 2px solid rgba(99, 102, 241, 0.8);
    outline-offset: 2px;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    /* Increase touch target size on mobile */
    #navigation-menu a {
        min-height: 48px;
        padding: 12px 16px;
    }
    
    /* Adjust font size for better readability */
    #navigation-menu a span {
        font-size: 0.875rem;
    }
    
    /* Ensure sidebar takes full height on mobile */
    #sidebar {
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile browsers */
    }
}

/* Small screen optimizations */
@media (max-width: 480px) {
    /* Reduce sidebar width slightly on very small screens */
    #sidebar {
        width: 280px;
        max-width: 85vw;
    }
    
    /* Adjust padding for smaller screens */
    #sidebar .flex-shrink-0 {
        padding: 12px 16px;
    }
    
    #sidebar nav {
        padding: 8px 16px;
    }
}

/* Ensure proper z-index layering */
#sidebar {
    z-index: 50;
}

#sidebar-overlay {
    z-index: 40;
}

/* Toggle button specific styling */
#toggle-sidebar-btn {
    z-index: 60 !important;
    min-width: 44px;
    min-height: 44px;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: fixed !important;
    pointer-events: auto !important;
}

/* Ensure toggle button is always visible and clickable */
#toggle-sidebar-btn:active {
    transform: scale(0.95);
}

#toggle-sidebar-btn:focus {
    outline: 2px solid rgba(99, 102, 241, 0.8);
    outline-offset: 2px;
}

/* Prevent any elements from covering the toggle button */
#toggle-sidebar-btn::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    z-index: -1;
    pointer-events: none;
}

/* Animation for smooth sidebar transitions */
#sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Loading state for navigation menu */
#navigation-menu.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Empty state styling */
#navigation-menu:empty::after {
    content: "Loading menu...";
    display: block;
    text-align: center;
    padding: 2rem 1rem;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

/* Scrollbar fade effect for mobile */
@media (max-width: 768px) {
    #sidebar nav.scrollable {
        /* Add subtle fade at top and bottom to indicate scrollable content */
        mask-image: linear-gradient(
            to bottom,
            transparent 0%,
            black 12px,
            black calc(100% - 12px),
            transparent 100%
        );
        -webkit-mask-image: linear-gradient(
            to bottom,
            transparent 0%,
            black 12px,
            black calc(100% - 12px),
            transparent 100%
        );
    }
}

/* Scroll indicators */
#sidebar nav.scrollable::before,
#sidebar nav.scrollable::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 8px;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.3s ease;
}

#sidebar nav.scrollable::before {
    top: 0;
    background: linear-gradient(to bottom, rgba(55, 65, 81, 0.8), transparent);
    opacity: 0;
}

#sidebar nav.scrollable::after {
    bottom: 0;
    background: linear-gradient(to top, rgba(55, 65, 81, 0.8), transparent);
    opacity: 0;
}

/* Show scroll indicators based on scroll position */
#sidebar nav.scrollable.scrolled-top::before {
    opacity: 1;
}

#sidebar nav.scrollable.scrolled-bottom::after {
    opacity: 1;
}

/* Active menu item styling */
#navigation-menu li.active a {
    background-color: rgba(99, 102, 241, 0.2);
    border-left: 3px solid rgba(99, 102, 241, 0.8);
    padding-left: 13px; /* Adjust for border */
}

/* Smooth scrolling for the entire navigation */
#sidebar nav {
    scroll-behavior: smooth;
}

/* Enhanced touch scrolling on mobile */
@media (max-width: 768px) {
    #sidebar nav {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
}

/* Momentum scrolling for iOS */
#sidebar nav {
    -webkit-overflow-scrolling: touch;
}

/* Prevent horizontal scrolling */
#sidebar nav {
    overflow-x: hidden;
}

/* Ensure menu items don't break layout */
#navigation-menu a span {
    word-break: break-word;
    hyphens: auto;
}

/* Loading animation for menu items */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#navigation-menu li {
    animation: fadeInUp 0.3s ease forwards;
}

#navigation-menu li:nth-child(n) {
    animation-delay: calc(var(--item-index, 0) * 0.05s);
}

/* Scroll position memory */
#sidebar nav {
    scroll-snap-type: y proximity;
}

#navigation-menu li {
    scroll-snap-align: start;
} 