/* Sidebar Navigation Styles */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #ffffff;
    --sidebar-bg-dark: #1a202c;
    --sidebar-border: #e5e7eb;
    --sidebar-border-dark: #4a5568;
    --sidebar-text: #374151;
    --sidebar-text-dark: #e5e7eb;
    --sidebar-hover-bg: #f3f4f6;
    --sidebar-hover-bg-dark: #2d3748;
    --sidebar-active-bg: #fff0f3;
    --sidebar-active-color: #E8294D;
}

/* Sidebar Container */
.sidebar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.dark .sidebar-container {
    background: var(--sidebar-bg-dark);
    border-right-color: var(--sidebar-border-dark);
}

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

.dark .sidebar-header {
    border-bottom-color: var(--sidebar-border-dark);
}

.sidebar-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: #E8294D;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--sidebar-text);
}

.dark .sidebar-close {
    color: var(--sidebar-text-dark);
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

/* Navigation Groups */
.nav-group {
    margin-bottom: 1.5rem;
}

.nav-group-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #6B7280;
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.dark .nav-group-title {
    color: #9ca3af;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin: 0;
}

/* Nav Links */
.nav-link-sidebar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--sidebar-text);
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: 0.5rem;
    margin: 0.125rem 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: calc(100% - 1rem);
    text-align: left;
}

.dark .nav-link-sidebar {
    color: var(--sidebar-text-dark);
}

.nav-link-sidebar:hover,
.nav-link-sidebar.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-color);
}

.dark .nav-link-sidebar:hover,
.dark .nav-link-sidebar.active {
    background-color: rgba(232, 41, 77, 0.1);
}

.nav-link-sidebar svg {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

.nav-link-sidebar .link-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-link-sidebar .link-icon {
    font-size: 1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* Submenu styles */
.submenu-toggle {
    justify-content: space-between;
}

.submenu-toggle svg.chevron {
    transition: transform 0.2s ease;
}

.submenu-toggle[aria-expanded="true"] svg.chevron {
    transform: rotate(180deg);
}

.submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.submenu.open {
    max-height: 500px;
}

.submenu .nav-link-sidebar {
    padding-left: 3rem;
    font-size: 0.8125rem;
    font-weight: 400;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.dark .sidebar-footer {
    border-top-color: var(--sidebar-border-dark);
}

/* Dark Mode Toggle in Sidebar */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    color: var(--sidebar-text);
    font-size: 0.875rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.dark-mode-toggle:hover {
    background-color: var(--sidebar-hover-bg);
}

.dark .dark-mode-toggle {
    color: var(--sidebar-text-dark);
}

.dark .dark-mode-toggle:hover {
    background-color: var(--sidebar-hover-bg-dark);
}

/* Overlay for mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.dark .mobile-menu-toggle {
    background: #1a202c;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hamburger-icon {
    width: 24px;
    height: 2px;
    background: #374151;
    position: relative;
    display: block;
    transition: all 0.3s ease;
}

.dark .hamburger-icon {
    background: #e5e7eb;
}

.hamburger-icon::before,
.hamburger-icon::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background: #374151;
    transition: all 0.3s ease;
}

.dark .hamburger-icon::before,
.dark .hamburger-icon::after {
    background: #e5e7eb;
}

.hamburger-icon::before {
    top: -7px;
}

.hamburger-icon::after {
    bottom: -7px;
}

.mobile-menu-toggle.active .hamburger-icon {
    background: transparent;
}

.mobile-menu-toggle.active .hamburger-icon::before {
    top: 0;
    transform: rotate(45deg);
}

.mobile-menu-toggle.active .hamburger-icon::after {
    bottom: 0;
    transform: rotate(-45deg);
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .sidebar-container {
        transform: translateX(-100%);
        box-shadow: none;
    }
    
    .sidebar-container.active {
        transform: translateX(0);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    }
    
    .sidebar-close {
        display: block;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        padding-top: 4rem;
    }
}

@media (max-width: 640px) {
    :root {
        --sidebar-width: 280px;
    }
    
    .sidebar-container {
        width: var(--sidebar-width);
    }
    
    .main-content {
        padding-top: 3.5rem;
    }
}

/* Scrollbar styles for sidebar */
.sidebar-container::-webkit-scrollbar {
    width: 6px;
}

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

.sidebar-container::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.dark .sidebar-container::-webkit-scrollbar-thumb {
    background: #4a5568;
}

.sidebar-container::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.dark .sidebar-container::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* Accessibility focus styles */
.nav-link-sidebar:focus-visible,
.dark-mode-toggle:focus-visible,
.sidebar-close:focus-visible,
.mobile-menu-toggle:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Animation for menu items */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.nav-link-sidebar {
    animation: slideIn 0.2s ease forwards;
}

.nav-group:nth-child(1) .nav-link-sidebar { animation-delay: 0.05s; }
.nav-group:nth-child(2) .nav-link-sidebar { animation-delay: 0.1s; }
.nav-group:nth-child(3) .nav-link-sidebar { animation-delay: 0.15s; }
.nav-group:nth-child(4) .nav-link-sidebar { animation-delay: 0.2s; }
