/* ========================================
   VOID — Minimal AI Interface
   Black & White, Fullscreen, Clean
   ======================================== */

:root {
    --bg: #0a0a0a;
    --surface: #141414;
    --surface-2: #1a1a1a;
    --border: rgba(255,255,255,0.08);
    --border-strong: rgba(255,255,255,0.15);
    --text: #e8e8e8;
    --text-dim: #777;
    --text-muted: #555;
    --white: #fff;
    --font: 'Inter', system-ui, sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --r: 16px;
    --r-sm: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%; width: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---- App Shell ---- */
.app {
    height: 100vh; width: 100vw;
    display: flex; flex-direction: column;
    position: relative;
}

/* ---- Sidebar overlay ---- */
.sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 800;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s var(--ease);
}
.sidebar-overlay.visible {
    opacity: 1; pointer-events: all;
}

/* ---- Sidebars ---- */
.sidebar {
    position: fixed; top: 0; bottom: 0;
    width: 320px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 900;
    display: flex; flex-direction: column;
    transition: transform 0.4s var(--ease);
}
.left-sidebar {
    left: 0;
    transform: translateX(-100%);
}
.left-sidebar.open { transform: translateX(0); }
.right-sidebar {
    right: 0; left: auto;
    border-right: none;
    border-left: 1px solid var(--border);
    transform: translateX(100%);
}
.right-sidebar.open { transform: translateX(0); }

.sidebar-head {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.sidebar-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
}
.sidebar-body {
    flex: 1; overflow-y: auto;
    padding: 1rem 1.25rem;
}

/* History items */
.history-item {
    padding: 0.75rem 1rem;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 0.25rem;
}
.history-item:hover, .history-item.active { background: var(--surface-2); }
.hi-row { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.hi-title { font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.hi-date  { font-size: 0.7rem; color: var(--text-muted); font-family: var(--mono); margin-top: 2px; }
.del-btn:hover { color: #ff5555 !important; background: rgba(255,0,0,0.1); }

/* Settings fields */
.field { margin-bottom: 1.5rem; }
.field label { display: block; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-dim); margin-bottom: 0.5rem; }
.field-input { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text); padding: 0.75rem 1rem; font-family: var(--mono); font-size: 0.8rem; outline: none; appearance: none; transition: border 0.2s; }
.field-input:focus { border-color: var(--border-strong); }
.select-wrap { position: relative; }
.select-wrap select { cursor: pointer; padding-right: 2.5rem; }
.select-chevron { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-dim); }

/* Toggle rows */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.toggle-title { font-size: 0.85rem; color: var(--text); }
.toggle-desc { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
.toggle { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
    position: absolute; inset: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: 0.3s;
}
.toggle-track::before {
    content: ''; position: absolute;
    width: 16px; height: 16px;
    left: 2px; bottom: 2px;
    background: var(--text-dim);
    border-radius: 50%;
    transition: 0.3s;
}
.toggle input:checked + .toggle-track { border-color: var(--white); background: rgba(255,255,255,0.12); }
.toggle input:checked + .toggle-track::before { transform: translateX(18px); background: var(--white); }

/* ---- Main ---- */
.main {
    flex: 1; display: flex; flex-direction: column;
    height: 100vh; width: 100%;
    position: relative;
}

/* Top bar */
.top-bar {
    height: 56px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg);
    z-index: 10;
}
.model-tag {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-dim);
    padding: 0.2rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Buttons */
.btn-icon {
    background: none; border: none;
    color: var(--text-dim);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0.5rem; border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}
.btn-icon:hover { color: var(--text); background: var(--surface); }
.btn-icon:disabled { opacity: 0.25; pointer-events: none; }
.btn-icon.tiny { padding: 0.25rem; }

/* ---- Content area ---- */
.content-area {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    display: flex; flex-direction: column;
}

/* Scrollbar */
.content-area::-webkit-scrollbar { width: 4px; }
.content-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* Welcome */
.welcome {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
}
.welcome h1 {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 6px;
    color: var(--text-dim);
    animation: fadeInUp 1.2s var(--ease);
}
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Messages ---- */
.messages {
    flex: 1;
    padding: 2rem 1.5rem;
    display: flex; flex-direction: column;
    gap: 1.75rem;
}

.msg { max-width: 800px; width: 100%; margin: 0 auto; animation: msgIn 0.35s var(--ease); }
@keyframes msgIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.msg-user { }
.msg-bot  { }

.msg-user .msg-body {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1rem 1.25rem;
    border-radius: var(--r) var(--r) 4px var(--r);
    display: inline-block;
    float: right;
    clear: both;
    max-width: 75%;
}

.msg-bot .msg-body {
    padding: 0.5rem 0;
    line-height: 1.75;
}

.msg-body p { margin-bottom: 1rem; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body ul, .msg-body ol { margin: 0.5rem 0 1rem 1.5rem; }
.msg-body a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* Thinking block - FOLDED DETAILS */
details.thinking-block {
    border-left: 2px solid var(--border-strong);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    color: var(--text-dim);
    font-size: 0.9rem;
    background: rgba(255,255,255,0.02);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
details.thinking-block[open] summary { margin-bottom: 0.75rem; }
.thinking-content { font-style: italic; }
.thinking-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    outline: none;
}

/* Message actions (resend, rewrite) */
.msg-actions {
    display: flex; gap: 0.5rem;
    margin-top: 0.5rem;
    justify-content: flex-end;
    clear: both;
}
.msg-action-btn {
    background: none; border: 1px solid var(--border);
    color: var(--text-dim);
    font-family: var(--font);
    font-size: 0.7rem;
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}
.msg-action-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface); }

/* Code blocks */
.code-wrap {
    position: relative;
    margin: 1.25rem 0;
    border-radius: var(--r-sm);
    background: #000;
    border: 1px solid var(--border);
    overflow: hidden;
}
.code-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.4rem 0.75rem;
    background: rgba(255,255,255,0.04);
    border-bottom: 1px solid var(--border);
}
.code-lang { font-family: var(--mono); font-size: 0.7rem; color: var(--text-muted); }
.copy-btn {
    background: none; border: none;
    color: var(--text-dim); font-family: var(--mono); font-size: 0.7rem;
    cursor: pointer; transition: color 0.15s;
}
.copy-btn:hover { color: var(--white); }
.code-wrap pre {
    padding: 1rem; margin: 0;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 0.82rem;
    line-height: 1.65;
    color: #ccc;
}
.code-wrap pre code { font-family: inherit; }

/* Tool call indicator */
.tool-indicator {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--r-sm);
    color: var(--text-dim);
    font-family: var(--mono);
    font-size: 0.8rem;
    margin-bottom: 1rem;
    max-width: 800px; width: 100%; margin-left: auto; margin-right: auto;
}
.tool-spinner {
    width: 14px; height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--text-dim);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Prompt area ---- */
.prompt-area {
    padding: 0 1.5rem 1.5rem;
    max-width: 832px;
    width: 100%;
    margin: 0 auto;
    position: relative;
}
.file-chip {
    display: flex; align-items: center; gap: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 0.4rem 0.75rem;
    margin-bottom: 0.75rem;
    width: fit-content;
}
.file-chip-icon { font-size: 1rem; }
.file-chip-name { font-family: var(--mono); font-size: 0.8rem; color: var(--text-dim); max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.prompt-box {
    display: flex; align-items: flex-end;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 0.4rem 0.5rem 0.4rem 1rem;
    transition: border 0.2s;
}
.prompt-box:focus-within { border-color: var(--border-strong); }

#prompt-input {
    flex: 1; background: none; border: none; color: var(--text);
    font-family: var(--font); font-size: 1rem;
    padding: 0.65rem 0; resize: none; outline: none;
    max-height: 200px; line-height: 1.5;
}
#prompt-input::placeholder { color: var(--text-muted); }

.send {
    background: var(--white); color: #000;
    border-radius: 50%;
    width: 38px; height: 38px; flex-shrink: 0;
}
.send:disabled { background: var(--surface-2); color: var(--text-muted); }
.send:not(:disabled):hover { opacity: 0.85; }

.stop {
    background: var(--white); color: #000;
    border-radius: 50%;
    width: 38px; height: 38px; flex-shrink: 0;
}
.stop:hover { opacity: 0.85; }

/* Typing indicator */
.typing { display: flex; gap: 5px; padding: 1rem 0; }
.dot {
    width: 6px; height: 6px;
    background: var(--text-dim);
    border-radius: 50%;
    animation: bop 1.2s infinite ease-in-out both;
}
.dot:nth-child(1) { animation-delay: -0.3s; }
.dot:nth-child(2) { animation-delay: -0.15s; }
@keyframes bop { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }
