/* 
 * Sidebar Navigation Styles
 * For accessing all 90+ features
 */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    display: block !important;
    background: linear-gradient(180deg, #1e3a5f 0%, #0f172a 100%);
    color: white;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width var(--transition-slow);
    z-index: 1000;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 3px; }

/* Brand Header */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all var(--transition-base);
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding: 1.5rem 0.5rem;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.brand-text {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    white-space: nowrap;
    transition: opacity var(--transition-base);
}

.sidebar.collapsed .brand-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Toggle Button */
.sidebar-toggle {
    position: absolute;
    top: 1.75rem;
    right: -15px;
    width: 30px;
    height: 30px;
    background: var(--color-primary);
    border: 3px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    z-index: 10;
}

.sidebar-toggle:hover {
    transform: scale(1.1);
    background: var(--color-primary-dark);
}

.sidebar-toggle-icon {
    width: 10px;
    height: 10px;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(45deg);
    margin-right: -2px;
    transition: transform var(--transition-base);
}

.sidebar.collapsed .sidebar-toggle-icon {
    transform: rotate(-135deg);
    margin-right: 0;
    margin-left: -2px;
}

/* Search */
.sidebar-search {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar.collapsed .sidebar-search {
    opacity: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.9rem;
    font-family: var(--font-primary);
    transition: all var(--transition-base);
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--color-primary);
}

.search-icon {
    position: absolute;
    left: 1.75rem;
    top: 1.75rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Navigation */
.sidebar-nav {
    padding: 0.5rem 0;
}

.nav-category {
    margin-bottom: 0.25rem;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all var(--transition-base);
    user-select: none;
}

.category-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.category-icon-text {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.category-icon {
    width: 24px;
    text-align: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.category-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: opacity var(--transition-base);
}

.sidebar.collapsed .category-name {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.category-count {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    transition: opacity var(--transition-base);
}

.sidebar.collapsed .category-count {
    opacity: 0;
    width: 0;
}

.category-arrow {
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    transition: all var(--transition-base);
}

.nav-category.open .category-arrow::before {
    content: '−';
}

.category-arrow::before {
    content: '+';
}

.sidebar.collapsed .category-arrow {
    opacity: 0;
}

/* Nav Items */
.nav-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

.nav-category.open .nav-items {
    max-height: 2000px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem 0.65rem 3.25rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    transition: all var(--transition-base);
    cursor: pointer;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar.collapsed .nav-item {
    padding: 0.65rem 0;
    justify-content: center;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border-left-color: var(--color-primary);
}

.nav-item.active {
    background: rgba(0, 166, 232, 0.15);
    color: var(--color-primary-light);
    border-left-color: var(--color-primary);
    font-weight: 600;
}

.nav-item-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.nav-item-text {
    white-space: nowrap;
    transition: opacity var(--transition-base);
}

.sidebar.collapsed .nav-item-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Badges in nav items */
.nav-item-badge {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    background: var(--color-accent);
    border-radius: var(--radius-full);
    font-weight: 600;
}

.sidebar.collapsed .nav-item-badge {
    display: none;
}

/* Footer */
.sidebar-footer {
    position: sticky;
    bottom: 0;
    padding: 1rem;
    background: linear-gradient(180deg, transparent 0%, rgba(15, 23, 42, 0.95) 50%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar.collapsed .sidebar-footer {
    padding: 1rem 0.5rem;
}

.footer-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
}

.footer-user:hover {
    background: rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
    transition: opacity var(--transition-base);
}

.sidebar.collapsed .user-info {
    opacity: 0;
    width: 0;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .nav-item,
.sidebar.collapsed .category-header {
    position: relative;
}

.nav-item-tooltip {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(30, 58, 95, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    white-space: nowrap;
    font-size: 0.875rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
    z-index: 1001;
    box-shadow: var(--shadow-lg);
}

.sidebar.collapsed .nav-item:hover .nav-item-tooltip,
.sidebar.collapsed .category-header:hover .nav-item-tooltip {
    opacity: 1;
}

/* Mobile Overlay */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}
