/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: relative;
    z-index: 100;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar.hidden {
    width: 0;
    border-right: none;
    overflow: hidden;
}

/* Sidebar Header */
.sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid #dee2e6;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.sidebar-toggle:hover {
    background: #e9ecef;
    color: #495057;
}

.sidebar-toggle i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

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

.sidebar.collapsed .sidebar-content {
    padding: 0;
}

/* Navigation Panel */
.nav-panel {
    padding: 16px;
    border-bottom: 1px solid #dee2e6;
}

.nav-panel h3 {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar.collapsed .nav-panel h3 {
    display: none;
}

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

.nav-list li {
    margin-bottom: 4px;
}

.nav-list a {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: #6c757d;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 13px;
    gap: 10px;
    position: relative;
}

.nav-list a:hover {
    background: #e9ecef;
    color: #495057;
}

.nav-list a.active {
    background: #667eea;
    color: #ffffff;
}

.nav-list a i {
    width: 16px;
    font-size: 12px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar.collapsed .nav-list a {
    justify-content: center;
    padding: 8px;
}

.sidebar.collapsed .nav-list a span {
    display: none;
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .nav-list a::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #212529;
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    margin-left: 8px;
    z-index: 1000;
}

.sidebar.collapsed .nav-list a:hover::after {
    opacity: 1;
    visibility: visible;
}

/* File Tree */
.file-tree {
    padding: 0 16px 16px;
    flex: 1;
}

.file-tree-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}

.file-tree-header h4 {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.file-tree-actions {
    display: flex;
    gap: 4px;
}

.file-tree-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 10px;
    transition: all 0.2s ease;
}

.file-tree-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.sidebar.collapsed .file-tree-header {
    display: none;
}

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

.file-item {
    margin-bottom: 2px;
}

.file-item a {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    color: #6c757d;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 12px;
    gap: 8px;
    position: relative;
}

.file-item a:hover {
    background: #e9ecef;
    color: #495057;
}

.file-item a.active {
    background: #667eea;
    color: #ffffff;
}

.file-item a i {
    width: 14px;
    font-size: 10px;
    text-align: center;
    flex-shrink: 0;
}

.file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-date {
    font-size: 10px;
    color: #adb5bd;
    margin-left: auto;
}

.sidebar.collapsed .file-name,
.sidebar.collapsed .file-date {
    display: none;
}

/* Ad Space */
.ad-space {
    padding: 16px;
    border-bottom: 1px solid #dee2e6;
}

.ad-placeholder {
    background: linear-gradient(45deg, #f8f9fa 25%, transparent 25%), 
                linear-gradient(-45deg, #f8f9fa 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f8f9fa 75%), 
                linear-gradient(-45deg, transparent 75%, #f8f9fa 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border: 2px dashed #dee2e6;
    border-radius: 6px;
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-size: 12px;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.sidebar.collapsed .ad-space {
    display: none;
}

/* AI Panel Toggle */
.ai-panel-toggle {
    padding: 16px;
    margin-top: auto;
}

.ai-toggle-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.ai-toggle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.ai-toggle-btn:active {
    transform: translateY(0);
}

.ai-toggle-btn i {
    font-size: 14px;
}

.sidebar.collapsed .ai-toggle-btn {
    padding: 12px;
}

.sidebar.collapsed .ai-toggle-btn span {
    display: none;
}

/* Recent Files */
.recent-files {
    padding: 0 16px 16px;
}

.recent-files h4 {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.recent-item {
    margin-bottom: 4px;
}

.recent-item a {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    color: #6c757d;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 11px;
    gap: 6px;
}

.recent-item a:hover {
    background: #e9ecef;
    color: #495057;
}

.recent-item i {
    width: 12px;
    font-size: 9px;
    text-align: center;
}

.sidebar.collapsed .recent-files {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar.collapsed {
        width: 280px;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .sidebar {
        background: #2d3748;
        border-right-color: #4a5568;
    }
    
    .sidebar-header {
        background: #1a202c;
        border-bottom-color: #4a5568;
    }
    
    .sidebar-toggle {
        color: #a0aec0;
    }
    
    .sidebar-toggle:hover {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .nav-panel {
        border-bottom-color: #4a5568;
    }
    
    .nav-panel h3 {
        color: #e2e8f0;
    }
    
    .nav-list a {
        color: #a0aec0;
    }
    
    .nav-list a:hover {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .file-tree-header h4 {
        color: #e2e8f0;
    }
    
    .file-tree-btn {
        color: #a0aec0;
    }
    
    .file-tree-btn:hover {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .file-item a {
        color: #a0aec0;
    }
    
    .file-item a:hover {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .ad-placeholder {
        background-color: #1a202c;
        border-color: #4a5568;
        color: #a0aec0;
    }
}

/* Accessibility */
.sidebar a:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.sidebar button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Animation Classes */
.sidebar-slide-in {
    animation: sidebarSlideIn 0.3s ease-out;
}

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

.sidebar-slide-out {
    animation: sidebarSlideOut 0.3s ease-in;
}

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