.chat {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 8px;
}


.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 16px;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.message {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border-radius: 4px;
}

.message[data-role="user"] {
    background: var(--bg-active);
}

.message[data-role="assistant"] {
    background: var(--bg-panel);
}

.message[data-role="system"] {
    background: var(--bg-hover);
}

.message[data-role="tool"] .content {
    font-size: 12px;
    font-style: italic;
    opacity: 0.5;
}

.role {
    font-size: 11px;
    font-weight: bold;
    color: var(--accent);
    text-transform: uppercase;
    display: flex;
    flex-direction: row;
    gap: 4px;
    align-items: center;
}

.reasoningContent {
    font-size: 12px;
    font-style: italic;
    opacity: 0.5;
    border-left: 2px solid currentColor;
    padding-left: 0.5em;
    margin-bottom: 0.5em;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.content {
    font-size: 13px;
    color: var(--text);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.toolCalls {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.toolBadge {
    font-size: 11px;
    padding: 2px 6px;
    background: var(--bg-active);
    color: var(--text-dim);
    border-radius: var(--radius);
    font-weight: 500;
    text-transform: none;

    .role & {
        padding: 0 3px;
    }
}

.loading {
    color: var(--text-muted);
    font-style: italic;
}

.errorMessage {
    background: rgba(244, 67, 54, 0.1);
    border-left: 2px solid var(--error, #f44336);
}

.errorText {
    font-size: 13px;
    color: var(--error, #f44336);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.inputContainer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.optionsRow {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.tokenCounter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

.summarizeButton {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;

    &:hover:not(:disabled) {
        color: var(--text);
        border-color: var(--text-muted);
    }

    &:disabled {
        opacity: 0.4;
        cursor: default;
    }
}

.toggleContainer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
    user-select: none;

    input[type="checkbox"] {
        cursor: pointer;
        accent-color: var(--accent);
    }
}

.input {
    width: 100%;
    padding: 8px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    outline: none;

    &:focus {
        border-color: var(--accent);
    }

    &::placeholder {
        color: var(--text-muted);
    }
}

.buttonRow {
    display: flex;
    gap: 6px;
}

.sendButton {
    flex: 1;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: bold;
    color: var(--bg);
    background: var(--accent);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    height: 32px;

    &:hover {
        background: var(--accent-alt);
    }
}

.continueButton {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    height: 32px;

    &:hover:not(:disabled) {
        color: var(--text);
        border-color: var(--text-muted);
    }

    &:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }
}

.stopButton {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: bold;
    color: var(--bg);
    background: var(--error, #f44336);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    height: 32px;

    &:hover {
        background: #d32f2f;
    }
}

.clearButton {
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    align-self: center;
    margin: 8px 0 28px;

    &:hover {
        color: var(--text);
        border-color: var(--text-muted);
    }
}