/**
 * SOLVUH Design System - Layout
 * ==============================
 * Application shell and layout styles
 */

/* ========================================
   APP SHELL
   ======================================== */
#app {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.app-shell {
    display: flex;
    height: 100%;
    width: 100%;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100%;
    background: var(--surface-925);
    border-right: 1px solid var(--surface-800);
    display: flex;
    flex-direction: column;
    transition: all var(--transition-slow);
    z-index: var(--z-sticky);
}

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

.sidebar-header {
    flex-shrink: 0;
    padding: var(--space-4);
    border-bottom: 1px solid var(--surface-800);
}

.sidebar-actions {
    padding: var(--space-3);
    border-bottom: 1px solid var(--surface-800);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3);
}

.sidebar-footer {
    flex-shrink: 0;
    padding: var(--space-3);
    border-top: 1px solid var(--surface-800);
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.logo-icon {
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo-text {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--surface-100);
    letter-spacing: -0.025em;
}

.logo-tag {
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--primary-500);
    background: rgba(34, 197, 94, 0.15);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    margin-left: var(--space-2);
}

/* New Chat/Session Button */
.new-chat-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    border: none;
    border-radius: var(--radius-lg);
    color: white;
    font-size: var(--font-size-base);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.new-chat-btn:hover {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.new-chat-btn .kbd-group {
    margin-left: auto;
}

/* Navigation */
.nav-section {
    margin-bottom: var(--space-4);
}

.nav-section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--surface-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--space-2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--surface-300);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.nav-item:hover {
    background: var(--surface-800);
    color: var(--surface-100);
}

.nav-item.active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--primary-400);
}

.nav-icon {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    color: var(--surface-500);
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
    color: inherit;
}

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

.nav-badge {
    flex-shrink: 0;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 var(--space-1);
    background: var(--surface-700);
    border-radius: var(--radius-full);
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--surface-300);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item.active .nav-badge {
    background: rgba(34, 197, 94, 0.2);
    color: var(--primary-400);
}

/* ========================================
   MAIN AREA
   ======================================== */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface-975);
}

/* Header */
.header {
    flex-shrink: 0;
    height: var(--header-height);
    padding: 0 var(--space-4);
    background: var(--surface-925);
    border-bottom: 1px solid var(--surface-800);
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.breadcrumb-item {
    font-size: var(--font-size-sm);
    color: var(--surface-400);
}

.breadcrumb-item:last-child {
    color: var(--surface-200);
    font-weight: 500;
}

.breadcrumb-separator {
    color: var(--surface-600);
}

.header-spacer {
    flex: 1;
}

/* Page Container */
.page-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ========================================
   RIGHT PANEL
   ======================================== */
.right-panel {
    width: var(--right-panel-width);
    min-width: var(--right-panel-width);
    height: 100%;
    background: var(--surface-925);
    border-left: 1px solid var(--surface-800);
    display: flex;
    flex-direction: column;
    transition: all var(--transition-slow);
}

.right-panel.collapsed {
    width: 0;
    min-width: 0;
    border-left: none;
    overflow: hidden;
}

.panel-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 var(--space-2);
    border-bottom: 1px solid var(--surface-800);
}

.panel-tabs {
    flex: 1;
    display: flex;
}

.panel-tab {
    flex: 1;
    padding: var(--space-3) var(--space-2);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--surface-400);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.panel-tab:hover {
    color: var(--surface-200);
}

.panel-tab.active {
    color: var(--primary-400);
    border-bottom-color: var(--primary-500);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
}

/* ========================================
   CONTENT LAYOUTS
   ======================================== */

/* Full page layout */
.page {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page-header {
    flex-shrink: 0;
    padding: var(--space-6);
    border-bottom: 1px solid var(--surface-800);
}

.page-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--surface-100);
    margin-bottom: var(--space-2);
}

.page-description {
    font-size: var(--font-size-md);
    color: var(--surface-400);
}

.page-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
}

.page-footer {
    flex-shrink: 0;
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--surface-800);
}

/* Centered content */
.centered-content {
    max-width: var(--max-content-width);
    margin: 0 auto;
    width: 100%;
}

/* Grid layouts */
.grid {
    display: grid;
    gap: var(--space-4);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Split layout */
.split-layout {
    display: flex;
    height: 100%;
    overflow: hidden;
}

.split-main {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.split-sidebar {
    width: 20rem;
    border-left: 1px solid var(--surface-800);
    overflow-y: auto;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1280px) {
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
    .right-panel {
        position: fixed;
        right: 0;
        top: 0;
        height: 100%;
        z-index: var(--z-modal);
        transform: translateX(100%);
    }

    .right-panel.open {
        transform: translateX(0);
    }

    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        z-index: var(--z-modal);
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: 1fr; }

    .split-layout {
        flex-direction: column;
    }

    .split-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--surface-800);
    }
}
