/* Aetheria 2.0 System Framework: Master Geometry & Shells */
.glass-container {
    background: var(--card-glass);
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(24px);
    border-radius: 24px;
    width: 92vw;
    height: 88vh;
    display: flex;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

/* -- LEFT NAVIGATION SHELL -- */
.sidebar {
    width: 280px;
    border-right: 1px solid var(--border-glass);
    padding: 0; /* Removed outer padding for full-bleed header */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.sidebar-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto; /* Make sidebar contents independent scroll just in case */
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--header-height);
    padding: 0 24px;
    border-bottom: 1px solid var(--border-glass);
    box-sizing: border-box;
    flex-shrink: 0; /* PREVENTS FLEXBOX COMPRESSION */
}
.brand h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #fff 0%, #a0a5c0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.logo { font-size: 1.6rem; }

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}
.nav-item {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 14px 20px;
    border-radius: 12px;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    transform: translateX(4px);
}

/* Unified Collapsible Headers for UX flow */
.sidebar-header {
    display: flex; justify-content: space-between; align-items: center; 
    cursor: pointer; user-select: none; margin-bottom: 8px;
    padding: 6px 0; transition: all 0.2s;
}
.sidebar-header:hover .section-title { color: var(--accent); }
.sidebar-header .arrow-icon { 
    font-size: 0.7rem; transition: transform 0.3s ease; 
    color: var(--text-secondary); opacity: 0.5; 
}
.sidebar-header.collapsed .arrow-icon { transform: rotate(-90deg); }

.section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    display: flex; align-items: center; gap: 8px;
}

/* Shared Collapsible Container Block */
.collapsible-content {
    display: flex; flex-direction: column; overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s, margin 0.3s;
    max-height: 500px; /* Reasonable max */
    opacity: 1;
}
.sidebar-header.collapsed ~ .collapsible-content {
    max-height: 0 !important;
    opacity: 0;
    pointer-events: none;
    margin-bottom: 0 !important;
}

.sessions-section, .memories-section, .workspace-section {
    margin-bottom: 16px;
    display: flex; flex-direction: column;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 12px;
}

/* Ensure scrolling stays efficient when all expanded */
.sessions-list, .memories-list, .workspace-tree {
    display: flex; flex-direction: column; gap: 6px;
    overflow-y: auto; padding-right: 4px;
    max-height: 250px; /* Constrain height slightly for stacked stacking */
}

.session-btn, .tree-item {
    display: flex; justify-content: space-between; align-items: center;
    background: transparent; border: none; color: var(--text-secondary);
    padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 0.85rem;
    transition: all 0.2s ease; text-align: left; width: 100%;
}
.session-btn:hover, .tree-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--text-primary); }
.session-btn.active { background: rgba(255, 255, 255, 0.06); color: var(--text-primary); border-left: 2px solid var(--accent); }
.session-delete-btn {
    background: transparent; border: none; color: rgba(255, 255, 255, 0.3);
    cursor: pointer; padding: 2px 6px; border-radius: 4px; font-size: 0.8rem; transition: all 0.2s;
}
.session-delete-btn:hover { color: #ff7675; background: rgba(255, 118, 117, 0.15); }

/* Tree Structure Styles */
.tree-node { display: flex; flex-direction: column; }
.tree-item-content { display: flex; align-items: center; gap: 8px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-icon { font-size: 0.9rem; flex-shrink: 0; }
.tree-item-btn {
    background: none; border: none; color: inherit; cursor: pointer; font-size: inherit;
    padding: 0; text-align: left; display: flex; align-items: center; gap: 6px; width: 100%;
}
.tree-children { padding-left: 12px; border-left: 1px solid rgba(255,255,255,0.05); display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }

.action-btn-sm {
    background: transparent; border: none; color: rgba(255, 255, 255, 0.3);
    cursor: pointer; padding: 4px 6px; border-radius: 4px; font-size: 0.75rem; transition: all 0.2s;
}
.action-btn-sm:hover { color: var(--accent); background: rgba(255, 255, 255, 0.1); }


.memory-item {
    display: flex; justify-content: space-between; align-items: flex-start;
    background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 8px; padding: 6px 10px; font-size: 0.8rem; color: var(--text-secondary);
}
.memory-text {
    overflow-y: auto; max-height: 90px; word-break: break-word; white-space: pre-wrap; flex: 1;
    padding-right: 5px; line-height: 1.4;
}
.memory-text::-webkit-scrollbar { width: 4px; }
.memory-text::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
.memory-delete-btn { background: transparent; border: none; color: rgba(255, 255, 255, 0.3); cursor: pointer; font-size: 0.75rem; }
.memory-delete-btn:hover { color: #ff7675; }

/* Footer Metrics Card */
.status-card {
    background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-glass);
    border-radius: 16px; padding: 16px; display: flex; align-items: center; gap: 12px;
}
.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.status-dot.online { background: var(--success); box-shadow: 0 0 12px var(--success); }
.status-info { display: flex; flex-direction: column; }
.status-label { font-size: 0.75rem; color: var(--text-secondary); }
.status-value { font-size: 0.85rem; font-weight: 600; }
