/* === Variables, reset, body, scrollbar, dark mode === */

*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f3f4f6;
    --bg-tertiary: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --user-bg: #2563eb;
    --user-text: #ffffff;
    --accent: #2563eb;
    --panel-width: 28vw;
    --chat-width: 44vw;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #111827;
        --bg-secondary: #1f2937;
        --bg-tertiary: #374151;
        --text-primary: #f9fafb;
        --text-secondary: #9ca3af;
        --border-color: #374151;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Center chat — always fixed width, always centered */
.main {
    width: var(--chat-width);
    flex-shrink: 0;
    flex-grow: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Side panels — fixed position, toggle in/out, don't move chat */
.panel-left,
.panel-right {
    position: fixed;
    top: 0;
    width: var(--panel-width);
    height: 100vh;
    height: 100dvh;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 50;
    transition: transform 0.2s ease;
}

.panel-left {
    left: 0;
    border-right: 1px solid var(--border-color);
    transform: translateX(-100%);
}

.panel-left.open {
    transform: translateX(0);
}

.panel-right {
    right: 0;
    border-left: 1px solid var(--border-color);
    transform: translateX(100%);
}

.panel-right.open {
    transform: translateX(0);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-secondary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-primary); }

/* Mobile: chat fills screen, panels overlay */
@media (max-width: 900px) {
    .main {
        width: 100%;
    }
    .panel-left, .panel-right {
        width: 85vw;
    }
}
