/* Sidebar Styles - Improved Design */

body.has-sidebar {
    padding-left: 0;
}

body.sidebar-collapsed {
    padding-left: 0;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 1001;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 2px 6px rgba(38, 166, 154, 0.2);
}

.sidebar-toggle:hover svg {
    transform: scale(1.05);
}

.sidebar-toggle:active {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    left: 0;
    top: 0;
    transition: transform 0.3s ease;
    z-index: 999;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

/* Sidebar Header */
.sidebar-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    font-size: 3em;
    margin-bottom: 12px;
    text-align: center;
}

.sidebar h2 {
    font-size: 1.5em;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-primary);
    text-align: center;
}

.sidebar-subtitle {
    color: var(--text-tertiary);
    font-size: 0.9em;
    display: block;
    text-align: center;
}

/* Navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Home Link - Special Styling */
.nav-item-home {
    margin-bottom: 12px;
    font-weight: 600;
}

.nav-item-home:hover {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #fff;
    border-color: #2563eb;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.nav-item-home:active {
    transform: translateX(2px);
    box-shadow: 0 2px 6px rgba(38, 166, 154, 0.25);
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-section-title {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    font-weight: 600;
    padding-left: 4px;
}

/* Collapsible Nav Section */
.nav-section-collapsible .nav-section-title {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    margin-bottom: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.nav-section-collapsible .nav-section-title:hover {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-color: var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.nav-section-collapsible .nav-section-title:active {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.toggle-icon {
    font-size: 0.9em;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.7;
}

.nav-section-collapsible .nav-section-title:hover .toggle-icon {
    opacity: 1;
}

.nav-section-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    /* Always visible by default - no collapse */
}

.nav-section-collapsible.expanded .nav-section-content {
    margin-top: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9em;
    font-weight: 500;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.nav-item:hover {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #fff;
    border-color: #2563eb;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.nav-item:active {
    transform: translateX(2px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.nav-item.active {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #fff;
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.nav-icon {
    font-size: 1.2em;
    min-width: 20px;
    text-align: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body.has-sidebar {
        padding-left: 0;
    }

    .sidebar {
        width: 260px;
        z-index: 999;
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
    }

    .sidebar-toggle {
        left: 16px;
        top: 16px;
    }
}

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

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

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

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

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

.sidebar-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-tertiary);
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.sidebar-logout:hover {
    background: rgba(255, 107, 107, 0.1);
    border-color: var(--error);
    color: var(--error);
}

.sidebar-logout:active {
    background: rgba(255, 107, 107, 0.05);
}

.logout-icon {
    font-size: 1.2em;
}

/* CRITICAL SVG & LAYOUT FIXES - 2026-02-03 */

/* Make SVG icons visible */
.nav-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Prevent nav items from collapsing */
.nav-item {
    min-height: 40px;
}

/* Prevent content overflow */
.nav-section-content {
    overflow: hidden;
}

/* Ensure collapsed sections don't create black boxes */
.nav-section-collapsible:not(.expanded) .nav-section-content {
    max-height: 0 !important;
    opacity: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}
