/**
 * Estilos para el Chatbot IA
 * Botón flotante y modal de chat
 */

/* ===== BOTÓN FLOTANTE CHATBOT ===== */
.chatbot-float {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
}

.chatbot-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    animation: chatbot-pulse 3s infinite;
    cursor: pointer;
    border: none;
}

.chatbot-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.chatbot-btn:active {
    transform: scale(0.95);
}

@keyframes chatbot-pulse {
    0% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4), 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    70% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4), 0 0 0 10px rgba(102, 126, 234, 0);
    }
    100% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4), 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

/* ===== MODAL DEL CHATBOT ===== */
.chatbot-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.chatbot-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-container {
    background: #1a1a1a;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    height: 80%;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== HEADER DEL CHAT ===== */
.chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
}

.chatbot-title i {
    font-size: 20px;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* ===== ÁREA DE MENSAJES ===== */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.6);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.8);
}

/* ===== MENSAJES ===== */
.chat-message {
    display: flex;
    margin-bottom: 16px;
    animation: messageSlide 0.3s ease;
}

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

.chat-message.user {
    justify-content: flex-end;
}

.chat-message.bot {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 6px;
}

.chat-message.bot .message-bubble {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== INDICADOR DE ESCRITURA ===== */
.typing-indicator {
    display: none;
    justify-content: flex-start;
    margin-bottom: 16px;
}

.typing-indicator.active {
    display: flex;
}

.typing-bubble {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: typingDots 1.4s infinite ease-in-out;
}

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

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

@keyframes typingDots {
    0%, 60%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    30% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===== INPUT DEL CHAT ===== */
.chatbot-input {
    padding: 20px;
    background: #1a1a1a;
    border-radius: 0 0 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 12px 16px;
    color: white;
    font-size: 14px;
    resize: none;
    min-height: 20px;
    max-height: 100px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.message-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.message-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.send-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

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

/* ===== MENSAJE DE BIENVENIDA ===== */
.welcome-message {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.welcome-message h3 {
    color: #667eea;
    margin-bottom: 8px;
    font-size: 16px;
}

/* ===== AJUSTES PARA COEXISTIR CON WHATSAPP ===== */
/* Ajustar posición del WhatsApp para dar espacio al chatbot */
.whatsapp-float {
    bottom: 20px;
    right: 20px;
}

/* En móviles, apilar los botones verticalmente */
@media (max-width: 768px) {
    .chatbot-float {
        bottom: 90px; /* Arriba del WhatsApp */
        left: 15px;
    }

    .chatbot-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .whatsapp-float {
        bottom: 15px;
        right: 15px;
    }
}
    
    .chatbot-container {
        width: 95%;
        height: 85%;
        max-height: none;
        border-radius: 12px;
    }
    
    .chatbot-header {
        padding: 16px;
        border-radius: 12px 12px 0 0;
    }
    
    .chatbot-title {
        font-size: 16px;
    }
    
    .chatbot-messages {
        padding: 16px;
    }
    
    .chatbot-input {
        padding: 16px;
        border-radius: 0 0 12px 12px;
    }
    
    .message-bubble {
        max-width: 85%;
        font-size: 13px;
    }
}

/* ===== ESTADOS DE CONEXIÓN ===== */
.connection-status {
    display: none;
    padding: 8px 16px;
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    font-size: 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 193, 7, 0.3);
}

.connection-status.error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-bottom-color: rgba(239, 68, 68, 0.3);
}

.connection-status.active {
    display: block;
}
