/* ── Chat layout: sidebar + main ──────────────────────────────────────────── */

.chat-layout {
    display: flex;
    height: 100%;
    overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

.chat-sidebar {
    width: 260px;
    min-width: 260px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    overflow: hidden;
    flex-shrink: 0;
}

#chat-sidebar-header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#chat-sidebar-header .btn-new {
    width: 100%;
    text-align: center;
}

#chat-conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

/* ── Conversation list items ─────────────────────────────────────────────── */

.conversation-item {
    padding: 10px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    transition: background 0.12s;
    margin: 2px 6px;
}

.conversation-item:hover {
    background: var(--surface2);
}

.conversation-item.active {
    background: var(--accent-dim);
    color: var(--accent);
}

.conv-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.conv-delete {
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 16px;
    line-height: 1;
    border-radius: 4px;
    flex-shrink: 0;
    transition: opacity 0.12s, color 0.12s;
}

.conversation-item:hover .conv-delete {
    opacity: 0.6;
}

.conv-delete:hover {
    opacity: 1 !important;
    color: var(--error);
}

.conv-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-dim);
    font-size: 12px;
    line-height: 1.6;
}

/* ── Main chat pane ──────────────────────────────────────────────────────── */

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.chat-main-header {
    align-items: center;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
    gap: 8px;
}

.chat-current-title {
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Messages ────────────────────────────────────────────────────────────── */

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.message {
    margin-bottom: 16px;
    max-width: 85%;
    line-height: 1.5;
}

.message.user {
    margin-left: auto;
    text-align: right;
}

.message .role {
    font-size: 10px;
    color: var(--text-dim);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.message .content {
    background: var(--surface2);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
}

.message.user .content {
    background: var(--accent-dim);
}

.message.status .content {
    background: none;
    color: var(--text-dim);
    font-style: italic;
    font-size: 12px;
    padding: 4px 0;
}

/* ── Input area ──────────────────────────────────────────────────────────── */

#chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

#chat-input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 12px;
    font-family: var(--font);
    font-size: 13px;
    border-radius: var(--radius);
    resize: none;
    max-height: 120px;
}

#chat-input:focus {
    outline: none;
    border-color: var(--accent);
}

#chat-send {
    background: var(--accent);
    color: #000;
    border: none;
    padding: 10px 20px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 700;
    border-radius: var(--radius);
    cursor: pointer;
}

#chat-send:hover {
    opacity: 0.9;
}