/* wsp.ai - Sidebar Styles - Material Design 3 */

/* ============================================
   LEFT SIDEBAR - FILE NAVIGATOR
   ============================================ */

.sidebar {
    width: 280px;
    background-color: #1e1e1e;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
                min-width 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
                opacity 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    position: relative;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    opacity: 1;
    transform: translateX(0);
}

.left-sidebar {
    width: 392px;
    min-width: 200px;
    max-width: 600px;
    transform-origin: left center;
}

.left-sidebar.collapsed {
    width: 0;
    min-width: 0;
    max-width: 0;
    border-right: none;
    opacity: 0;
    transform: translateX(-20px);
    box-shadow: none;
    pointer-events: none;
}

.right-sidebar {
    width: 392px;
    min-width: 280px;
    max-width: 700px;
    border-right: none;
    border-left: 1px solid #333;
    transform-origin: right center;
}

.right-sidebar.collapsed {
    width: 0;
    min-width: 0;
    max-width: 0;
    border-left: none;
    opacity: 0;
    transform: translateX(20px);
    box-shadow: none;
    pointer-events: none;
}

/* Resize Handles */
.resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    background: transparent;
    z-index: 10;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.resize-handle::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    left: 50%;
    transform: translateX(-50%);
    background: transparent;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.resize-handle:hover::before {
    background: linear-gradient(
        to bottom,
        transparent,
        #90caf9 10%,
        #90caf9 90%,
        transparent
    );
    box-shadow: 0 0 8px rgba(144, 202, 249, 0.6);
    width: 3px;
}

.resize-handle.resizing::before {
    background: linear-gradient(
        to bottom,
        transparent,
        #2196f3 10%,
        #2196f3 90%,
        transparent
    );
    box-shadow: 0 0 12px rgba(33, 150, 243, 0.8);
    width: 4px;
}

.left-sidebar .resize-handle {
    right: -3px;
}

.right-sidebar .resize-handle {
    left: -3px;
}

.sidebar.collapsed .resize-handle {
    display: none;
}

/* Reopen Buttons (shown when collapsed) */
.reopen-button {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 80px;
    background-color: #252525;
    border: 1px solid #333;
    color: #b0b0b0;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: all var(--transition-fast);
    writing-mode: vertical-rl;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 1px;
    opacity: 0;
    animation: fadeInButton 0.3s ease-out 0.3s forwards;
}

@keyframes fadeInButton {
    from {
        opacity: 0;
        transform: translateY(-50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

.reopen-button:hover {
    background-color: #2a2a2a;
    color: #90caf9;
    width: 36px;
    box-shadow: 0 4px 12px rgba(144, 202, 249, 0.3);
}

.reopen-button.left {
    left: 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    border-left: none;
}

.reopen-button.right {
    right: 0;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    border-right: none;
}

.left-sidebar.collapsed ~ .reopen-button.left {
    display: flex;
}

.right-sidebar.collapsed ~ .reopen-button.right {
    display: flex;
}

/* Sidebar Content Animation */
.sidebar > * {
    transition: opacity 0.2s cubic-bezier(0.4, 0.0, 0.2, 1),
                transform 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.sidebar.collapsed > * {
    opacity: 0;
    transform: scale(0.95);
    transition-delay: 0s;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    border-bottom: 1px solid #333;
    background-color: #252525;
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 500;
    color: #b0b0b0;
    margin: 0;
}

/* Right Sidebar Header - Specific Layout */
.right-sidebar .sidebar-header {
    gap: var(--spacing-sm);
}

.right-sidebar .sidebar-header h3 {
    flex: 1;
    text-align: left;
}

/* Sidebar Tabs */
.sidebar-tabs {
    display: flex;
    gap: var(--spacing-xs);
}

.sidebar-tab {
    width: 48px;
    height: 48px;
    border: none;
    background: transparent;
    color: #b0b0b0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.sidebar-tab:hover {
    background-color: #2a2a2a;
    color: #90caf9;
    transform: translateY(-2px);
}

.sidebar-tab.active {
    color: #90caf9;
    background: transparent;
    border: 1px solid rgba(144, 202, 249, 0.3);
}

.sidebar-tab.active:hover {
    border-color: rgba(144, 202, 249, 0.5);
    background-color: rgba(144, 202, 249, 0.05);
}

.sidebar-tab.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background-color: var(--md-sys-color-primary);
    border-radius: 2px;
}

.sidebar-tab .material-symbols-outlined {
    font-size: 20px;
}

.icon-button-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.icon-button-small:hover {
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

/* Sidebar Search */
.sidebar-search {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background-color: #1b1b1b;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.sidebar-search input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface);
    font-size: 14px;
    outline: none;
}

.sidebar-search input::placeholder {
    color: var(--md-sys-color-on-surface-variant);
}

.sidebar-search .material-symbols-outlined {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 20px;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.quick-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--spacing-sm);
    background-color: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--radius-sm);
    color: var(--md-sys-color-on-surface);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quick-action-btn:hover {
    background-color: var(--md-sys-color-surface-container-high);
    border-color: var(--md-sys-color-primary);
    transform: translateY(-2px);
    box-shadow: var(--md-sys-elevation-2);
}

.quick-action-btn .material-symbols-outlined {
    font-size: 20px;
}

/* File Tree */
.file-tree {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-sm);
    scroll-behavior: smooth;
    background-color: #1b1b1b;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 6px var(--spacing-sm);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    user-select: none;
    position: relative;
}

.tree-item:hover {
    background-color: #2a2a2a;
    transform: translateX(2px);
}

.tree-item.active {
    background-color: rgba(33, 150, 243, 0.08);
    color: #90caf9;
    border: 1px solid rgba(33, 150, 243, 0.3);
    border-left: 3px solid #2196f3;
    padding-left: calc(var(--spacing-sm) - 3px);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(8px);
}

.tree-item.active .tree-icon {
    color: #90caf9;
}

.tree-icon {
    font-size: 20px;
    color: var(--md-sys-color-on-surface-variant);
}

.tree-label {
    flex: 1;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-toggle {
    font-size: 20px;
    color: var(--md-sys-color-on-surface-variant);
    transition: transform var(--transition-fast);
}

.tree-item.folder.expanded .tree-toggle {
    transform: rotate(0deg);
}

.tree-item.folder:not(.expanded) .tree-toggle {
    transform: rotate(-90deg);
}

.tree-children {
    padding-left: 20px;
}

.tree-children .tree-item {
    padding-left: 28px;
}

/* Context Library */
.context-library {
    border-top: 1px solid var(--md-sys-color-outline-variant);
    padding: var(--spacing-md);
    background-color: #252525;
}

.library-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--radius-xs);
    transition: all var(--transition-fast);
}

.library-header:hover {
    background-color: var(--md-sys-color-surface-container);
}

.library-header .material-symbols-outlined {
    font-size: 20px;
    color: var(--md-sys-color-tertiary);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
    .left-sidebar {
        width: 240px;
        min-width: 240px;
    }
    
    .right-sidebar {
        width: 320px;
        min-width: 320px;
    }
}

@media (max-width: 768px) {
    .left-sidebar,
    .right-sidebar {
        position: absolute;
        top: 0;
        bottom: 0;
        z-index: 999;
        box-shadow: var(--md-sys-elevation-4);
    }
    
    .left-sidebar {
        left: 0;
    }
    
    .right-sidebar {
        right: 0;
    }
}
