﻿/* chatbot-exoplanetas.css - CORREGIDO */
:root {
    --primary-color: #667eea;
    --primary-dark: #5a6fd8;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-light: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #374151;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    --gradient: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.chatbot-container {
    min-height: 100vh;
    /*background: var(--bg-dark);*/
    color: var(--text-primary);
}

/* Hero Section */
.hero-section {
    /*background: var(--gradient);*/
    color: white;
    margin-bottom: 2rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, #e2e8f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Chat Card - CORREGIDO para ancho completo */
.chat-card {
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 100%;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #0E1E36, #112749);
    color: white;
    padding: 1rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.bot-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar-container {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
}

.bot-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bot-name {
    margin: 0;
    font-weight: 600;
}

.bot-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: var(--success-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-text {
    font-size: 0.875rem;
    opacity: 0.9;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

    .btn-icon:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: translateY(-2px);
    }

    .btn-icon.disabled {
        opacity: 0.5;
    }

/* Chat Messages */
.chat-messages {
    height: 500px;
    overflow-y: auto;
    background: var(--bg-dark);
    padding: 1.5rem;
}

.messages-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Message Styles - CORREGIDO */
.message {
    display: flex;
    gap: 1rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.message-visible {
    opacity: 1;
    transform: translateY(0);
}

.user-message {
    justify-content: flex-end;
}

.bot-message {
    justify-content: flex-start;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.user-avatar {
    background: var(--primary-color);
    color: white;
    order: 2;
}

.bot-avatar {
    background: var(--bg-light);
    color: var(--text-primary);
}

.bot-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-bubble {
    max-width: 70%;
    padding: 1rem 1.25rem;
    border-radius: 18px;
    position: relative;
}

.user-bubble {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-bubble {
    background: var(--bg-light);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message-content {
    line-height: 1.5;
    word-wrap: break-word;
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.5rem;
}

.message-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.btn-action {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: inherit;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

    .btn-action:hover {
        background: rgba(255, 255, 255, 0.2);
    }

/* Typing Indicator */
.typing-indicator {
    align-items: flex-start;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

    .typing-dots span {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: var(--text-muted);
        animation: typing 1.4s infinite ease-in-out;
    }

        .typing-dots span:nth-child(1) {
            animation-delay: -0.32s;
        }

        .typing-dots span:nth-child(2) {
            animation-delay: -0.16s;
        }

/* Chat Input */
.chat-input-container {
    padding: 1.5rem;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
}

.input-group {
    display: flex;
    gap: 0.75rem;
}

.message-input {
    flex: 1;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.3s ease;
}

    .message-input:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }

    .message-input::placeholder {
        color: var(--text-muted);
    }

.send-button {
    background: var(--gradient);
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    color: white;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

    .send-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    }

.input-footer {
    margin-top: 0.75rem;
    text-align: center;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--bg-light);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

    .chat-messages::-webkit-scrollbar-thumb:hover {
        background: var(--primary-dark);
    }

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive - MEJORADO */
@media (max-width: 1200px) {
    .chat-card {
        margin: 0 1rem;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .chat-messages {
        height: 400px;
        padding: 1rem;
    }

    .message-bubble {
        max-width: 85%;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .header-actions {
        align-self: flex-end;
    }

    .send-button .btn-text {
        display: none;
    }

    .send-button {
        padding: 0.75rem;
    }

    .chat-card {
        border-radius: 15px;
        margin: 0 0.5rem;
    }
}

@media (max-width: 576px) {
    .message-bubble {
        max-width: 90%;
        padding: 0.75rem 1rem;
    }

    .message-actions {
        gap: 0.25rem;
    }

    .btn-action {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }

    .chat-input-container {
        padding: 1rem;
    }

    .input-group {
        gap: 0.5rem;
    }

    .hero-section {
        padding: 2rem 0;
    }
}

/* Mejoras adicionales para mejor experiencia móvil */
@media (max-width: 480px) {
    .chat-messages {
        height: 350px;
        padding: 0.75rem;
    }

    .message {
        gap: 0.75rem;
    }

    .message-avatar {
        width: 35px;
        height: 35px;
    }

    .header-content {
        gap: 0.75rem;
    }

    .bot-info {
        gap: 0.75rem;
    }

    .avatar-container {
        width: 45px;
        height: 45px;
    }
}

/* Estilos para las imágenes del chatbot */
.message-image-container {
    margin: 10px 0;
    overflow: hidden;
    max-width: 100%;
}

.message-image {
    max-width: 100%;
    height: auto;
    max-height: 300px;
    display: block;
    margin: 0 auto;
    transition: opacity 0.3s ease;
    opacity: 0;
}

    .message-image.image-loaded {
        opacity: 1;
    }


/* Asegurar que las burbujas con imágenes se vean bien */
.bot-bubble .message-content {
    margin-top: 0px;
}

/* Responsive */
@media (max-width: 768px) {
    .message-image {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .message-image {
        max-height: 200px;
    }
}