/* Agent Chat Panel Styles */

.agent-chat-panel {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    max-height: 500px;
    background: #fff;
}

.agent-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 200px;
    max-height: 380px;
}

.agent-chat-placeholder {
    color: #6c757d;
    text-align: center;
    padding: 40px 20px;
    font-style: italic;
}

/* Message bubbles */
.agent-chat-message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.agent-chat-message.user {
    align-self: flex-end;
    margin-left: auto;
}

.agent-chat-message.agent {
    align-self: flex-start;
    margin-right: auto;
}

.agent-chat-message.error {
    align-self: center;
    max-width: 90%;
}

.agent-chat-bubble {
    padding: 8px 14px;
    border-radius: 12px;
    line-height: 1.4;
    word-break: break-word;
    white-space: pre-wrap;
}

.agent-chat-message.user .agent-chat-bubble {
    background: #0d6efd;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.agent-chat-message.agent .agent-chat-bubble {
    background: #e9ecef;
    color: #212529;
    border-bottom-left-radius: 4px;
}

.agent-chat-message.error .agent-chat-bubble {
    background: #f8d7da;
    color: #842029;
    border-radius: 8px;
    font-size: 0.9em;
}

.agent-chat-sender {
    font-size: 0.75em;
    color: #6c757d;
    margin-bottom: 2px;
    padding: 0 4px;
}

.agent-chat-message.user .agent-chat-sender {
    text-align: right;
}

/* Typing indicator */
.agent-chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    background: #e9ecef;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    margin-bottom: 12px;
}

.agent-chat-typing .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6c757d;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.agent-chat-typing .dot:nth-child(2) { animation-delay: 0.2s; }
.agent-chat-typing .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* Input area */
.agent-chat-input-area {
    border-top: 1px solid #dee2e6;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.agent-chat-textarea {
    width: 100%;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 8px 12px;
    resize: none;
    font-family: inherit;
    font-size: 0.95em;
    line-height: 1.4;
}

.agent-chat-textarea:focus {
    outline: none;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.agent-chat-textarea:disabled {
    background: #e9ecef;
    cursor: not-allowed;
}

.agent-chat-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.agent-chat-step-counter {
    font-size: 0.85em;
    color: #6c757d;
    margin-right: auto;
}

/* Disabled annotation overlay during active chat */
.agent-chat-active .annotation-form-container {
    opacity: 0.4;
    pointer-events: none;
    position: relative;
}

.agent-chat-active .annotation-form-container::after {
    content: "Complete the chat interaction before annotating";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9em;
    white-space: nowrap;
    z-index: 10;
}

/* Chat finished state */
.agent-chat-panel.finished {
    opacity: 0.6;
    pointer-events: none;
}

.agent-chat-panel.finished .agent-chat-input-area {
    display: none;
}
