/* chat — область домена (выделено из main.css при рефакторинге R5). */

/* Chat Main */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h1 {
    font-size: 24px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tools-count {
    background: var(--bg-tertiary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Messages */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.message {
    margin-bottom: 20px;
    max-width: 80%;
    padding: 16px;
    border-radius: 12px;
    transition: background-color 0.3s;
}

.message.user {
    background: var(--user-bg);
    margin-left: auto;
}

.message.assistant {
    background: var(--assistant-bg);
}

.message.assistant.loading .typing {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Status Bar */
.status-bar {
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.status-bar:hover {
    background: var(--bg-tertiary);
}

.status-bar__summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 12px;
}

.status-bar__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-bar__dot--ok {
    background: #4caf50;
}

.status-bar__dot--error {
    background: #f44336;
}

.status-bar__dot--checking {
    background: #ffc107;
    animation: status-bar-blink 1s ease-in-out infinite;
}

@keyframes status-bar-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.status-bar__text {
    flex: 1;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-bar__chevron {
    color: var(--text-secondary);
    font-size: 10px;
    transition: transform 0.2s;
}

.status-bar__chevron--open {
    transform: rotate(90deg);
}

.status-bar__details {
    padding: 4px 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.status-bar__row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.status-bar__row--error {
    background: rgba(244, 67, 54, 0.1);
}

.status-bar__row--checking {
    opacity: 0.7;
}

.status-bar__indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-bar__indicator--ok {
    background: #4caf50;
}

.status-bar__indicator--error {
    background: #f44336;
}

.status-bar__indicator--checking {
    background: #ffc107;
}

.status-bar__label {
    font-weight: 600;
    min-width: 50px;
    color: var(--text-primary);
}

.status-bar__value {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Thinking/reasoning messages - smaller font */
.message.thinking {
    font-size: 0.85em;
    opacity: 0.8;
    background: var(--bg-tertiary);
    border-left: 3px solid var(--text-secondary);
}

.message.thinking .message-role {
    font-size: 0.9em;
}

.message.thinking .message-content {
    font-style: italic;
    color: var(--text-secondary);
}

.message-role {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
}

.message-content {
    line-height: 1.6;
}

.message-content pre {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.message-content code {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
}

.message-content p {
    margin-bottom: 10px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul, .message-content ol {
    margin-left: 20px;
    margin-bottom: 10px;
}

.message-content a {
    color: var(--accent);
}

/* Tool Calls */
.tool-calls {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}

.tool-call {
    background: var(--bg-primary);
    border-radius: 6px;
    margin-bottom: 6px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    font-size: 12px;
}

.tool-call.pending {
    border-color: var(--accent);
    animation: tool-pulse 1.5s infinite;
}

@keyframes tool-pulse {
    0%, 100% { border-color: var(--accent); }
    50% { border-color: transparent; }
}

.tool-call-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    cursor: pointer;
    user-select: none;
}

.tool-call-header:hover {
    background: var(--bg-secondary);
}

.tool-icon {
    font-size: 12px;
    opacity: 0.6;
}

.tool-server {
    color: var(--accent);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    opacity: 0.7;
}

.tool-name {
    font-weight: 600;
    color: var(--accent);
    font-size: 12px;
    font-family: monospace;
}

.tool-status {
    margin-left: auto;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    text-transform: uppercase;
    font-weight: 600;
    flex-shrink: 0;
}

.tool-status.pending {
    background: rgba(233, 69, 96, 0.2);
    color: var(--accent);
    animation: status-blink 1s infinite;
}

.tool-status.done {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
}

@keyframes status-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.tool-summary {
    font-size: 11px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 400px;
}

.tool-call-body {
    padding: 8px 10px;
    animation: tool-expand 0.15s ease-out;
}

@keyframes tool-expand {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 500px; }
}

.tool-section {
    margin-bottom: 8px;
}

.tool-section:last-child {
    margin-bottom: 0;
}

.tool-section-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 3px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.tool-args, .tool-result {
    font-size: 11px;
    font-family: 'Fira Code', 'Consolas', monospace;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 6px 8px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

.tool-result {
    color: var(--text-primary);
    border-left: 2px solid #4caf50;
}

/* Input Area */
.input-area {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
}

.input-area textarea {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    resize: none;
    font-family: inherit;
    transition: background-color 0.3s, border-color 0.3s;
}

.input-area textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.input-area textarea::placeholder {
    color: var(--text-secondary);
}

.input-area button {
    background: var(--accent);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: opacity 0.2s;
}

.input-area button:hover:not(:disabled) {
    opacity: 0.9;
}

.input-area button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Stop button */
.btn-stop {
    background: #dc3545 !important;
}

.btn-stop:hover:not(:disabled) {
    background: #c82333 !important;
}

/* Progress Steps */
.progress-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    margin: 4px 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.progress-step__spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-top-color: var(--text-secondary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.progress-step__text {
    animation: pulse 1.5s ease-in-out infinite;
}

