/**
 * ========================================================================
 * NEXUS AI - ESTILOS DEL MÓDULO DE CHAT
 * ========================================================================
 */

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 960px;
    margin: 0 auto;
    position: relative;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Mensajes individuales */
.message-row {
    display: flex;
    gap: 14px;
    max-width: 85%;
    animation: fadeIn 200ms ease-out;
}
.message-row.user-row {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.message-row.assistant-row {
    align-self: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.user-row .message-avatar {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}
.assistant-row .message-avatar {
    background: var(--accent-gradient);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.message-bubble {
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    line-height: 1.6;
    position: relative;
    word-break: break-word;
}
.user-row .message-bubble {
    background: var(--accent-hover);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}
.assistant-row .message-bubble {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
}
.copy-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    transition: all var(--transition-fast);
}
.copy-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
}

/* Indicador de escritura (Thinking) */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 18px;
}
.typing-indicator .dot {
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Barra de Entrada del Chat */
.chat-input-wrapper {
    padding: 16px 20px;
    background: var(--bg-darkest);
    border-top: 1px solid var(--border-subtle);
}

.chat-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 10px 14px;
    box-shadow: var(--shadow-md);
    transition: border-color var(--transition-fast);
}
.chat-input-bar:focus-within {
    border-color: var(--accent-primary);
}

.chat-textarea {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    outline: none;
    resize: none;
    max-height: 160px;
    min-height: 24px;
    line-height: 1.4;
    font-size: 15px;
}

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

.model-selector-pill {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--accent-gradient);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
}
.chat-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Formato Markdown dentro de los mensajes */
.message-bubble pre {
    background: var(--bg-darkest);
    border: 1px solid var(--border-subtle);
    padding: 12px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 10px 0;
    font-family: var(--font-mono);
    font-size: 13px;
}
.message-bubble code {
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}
.message-bubble p {
    margin-bottom: 8px;
}
.message-bubble p:last-child {
    margin-bottom: 0;
}
.message-bubble ul, .message-bubble ol {
    padding-left: 20px;
    margin: 8px 0;
}
