/* UI Sidebar Component Styles */
.ui-sidebar {
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: var(--sidebar-bg, #2d3748);
    color: var(--sidebar-text, #e2e8f0);
    border-right: 1px solid var(--sidebar-border, #4a5568);
    transition: width 0.3s ease;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

/* Light theme */
.ui-sidebar.light {
    background-color: var(--sidebar-bg-light, #ffffff);
    color: var(--sidebar-text-light, #2d3748);
    border-right-color: var(--sidebar-border-light, #e2e8f0);
}

/* Dark theme */
.ui-sidebar.dark {
    background-color: var(--sidebar-bg-dark, #1a202c);
    color: var(--sidebar-text-dark, #e2e8f0);
    border-right-color: var(--sidebar-border-dark, #2d3748);
}

/* Position variants */
.ui-sidebar.position-left {
    border-right: 1px solid var(--sidebar-border, #4a5568);
    border-left: none;
}

.ui-sidebar.position-right {
    border-left: 1px solid var(--sidebar-border, #4a5568);
    border-right: none;
}

/* Collapsed state */
.ui-sidebar.collapsed {
    width: 60px !important;
    min-width: 60px;
}

.ui-sidebar.collapsed .sidebar-content {
    padding: 8px 4px;
}

.ui-sidebar.collapsed .sidebar-item-text {
    display: none;
}

.ui-sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding: 8px;
}

/* Toggle button */
.sidebar-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--sidebar-toggle-bg, #4a5568);
    color: var(--sidebar-toggle-text, #e2e8f0);
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    z-index: 101;
}

.sidebar-toggle:hover {
    background: var(--sidebar-toggle-hover-bg, #718096);
    transform: scale(1.1);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

/* Sidebar content */
.sidebar-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--sidebar-scrollbar, #4a5568) transparent;
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

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

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--sidebar-scrollbar, #4a5568);
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: var(--sidebar-scrollbar-hover, #718096);
}

/* Sidebar items */
.sidebar-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.sidebar-item:hover {
    background-color: var(--sidebar-item-hover, rgba(255, 255, 255, 0.1));
}

.sidebar-item.active {
    background-color: var(--sidebar-item-active, #4299e1);
    color: var(--sidebar-item-active-text, #ffffff);
}

.sidebar-item-icon {
    margin-right: 12px;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

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

/* Responsive design */
@media (max-width: 768px) {
    .ui-sidebar {
        width: 100% !important;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--sidebar-border, #4a5568);
    }
    
    .ui-sidebar.collapsed {
        width: 100% !important;
        height: 60px;
    }
    
    .sidebar-toggle {
        position: static;
        margin: 8px;
    }
}

/* Animation for smooth transitions */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

.ui-sidebar.animate-in {
    animation: slideIn 0.3s ease-out;
}

.ui-sidebar.animate-out {
    animation: slideOut 0.3s ease-in;
}

/* Focus and accessibility */
.sidebar-toggle:focus,
.sidebar-item:focus {
    outline: 2px solid var(--focus-color, #4299e1);
    outline-offset: 2px;
}

.sidebar-item:focus-visible {
    outline: 2px solid var(--focus-color, #4299e1);
    outline-offset: -2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ui-sidebar {
        border-width: 2px;
    }
    
    .sidebar-item {
        border: 1px solid transparent;
    }
    
    .sidebar-item:hover {
        border-color: currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ui-sidebar,
    .sidebar-toggle,
    .sidebar-item {
        transition: none;
    }
    
    .ui-sidebar.animate-in,
    .ui-sidebar.animate-out {
        animation: none;
    }
}