/* Chatbot Styles */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: 'Montserrat', sans-serif;
    pointer-events: none; /* No bloquear clicks en el área del contenedor */
}

/* Asegurar que los elementos interactivos del chatbot sí funcionen */
.chatbot-bubble,
.chatbot-modal {
    pointer-events: auto;
}

/* Chatbot Bubble */
.chatbot-bubble {
    width: 60px;
    height: 60px;
    background: #18191a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: relative;
    border: 1px solid #fff;
}

.chatbot-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.chatbot-bubble i {
    color: white;
    font-size: 24px;
}

/* Notification Badge */
.chatbot-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Chatbot Modal */
.chatbot-modal {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 10001;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chatbot-modal.active {
    display: flex;
}

/* Chatbot Header */
.chatbot-header {
    background: #18191a;
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

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

/* Email Validation Screen */
.chatbot-email-screen {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.chatbot-email-screen h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
}

.chatbot-email-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

.chatbot-email-input:focus {
    outline: none;
    border-color: #667eea;
}

.chatbot-email-btn {
    background: #18191a;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chatbot-email-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.chatbot-email-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Chat Area */
.chatbot-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.chatbot-message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.chatbot-message.user {
    align-items: flex-end;
}

.chatbot-message.bot {
    align-items: flex-start;
}

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

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

.chatbot-message.bot .chatbot-message-content {
    background: white;
    color: #333;
    border: 1px solid #e1e5e9;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.chatbot-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
    text-align: center;
}

/* Input Area */
.chatbot-input-area {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e1e5e9;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 25px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    transition: border-color 0.3s ease;
}

.chatbot-input:focus {
    outline: none;
    border-color: #667eea;
}

.chatbot-send-btn {
    background: #18191a;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.chatbot-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.chatbot-send-btn i {
    font-size: 16px;
}

/* Loading Animation */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    max-width: 80%;
    margin-bottom: 15px;
}

.chatbot-typing-dots {
    display: flex;
    gap: 3px;
}

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

.chatbot-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.chatbot-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Error Messages */
.chatbot-error {
    background: #ffe6e6;
    color: #d63031;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 15px;
    border-left: 4px solid #d63031;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chatbot-modal {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
        bottom: 80px;
        height: 450px;
        z-index: 10002 !important; /* Asegurar que esté por encima en mobile */
    }
    
    .chatbot-container {
        bottom: 15px;
        right: 15px;
        z-index: 10002 !important; /* Más alto en mobile */
    }
    
    .chatbot-bubble {
        width: 50px;
        height: 50px;
    }
    
    .chatbot-bubble i {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .chatbot-modal {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
        bottom: 70px;
        height: 400px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .chatbot-modal {
        background: #2d3436;
        color: white;
    }
    
    .chatbot-messages {
        background: #34495e;
    }
    
    .chatbot-message.bot .chatbot-message-content {
        background: #34495e;
        color: white;
        border-color: #4a5568;
    }
    
    .chatbot-input-area {
        background: #2d3436;
        border-top-color: #4a5568;
    }
    
    .chatbot-input {
        background: #34495e;
        color: white;
        border-color: #4a5568;
    }
    
    .chatbot-email-input {
        background: #34495e;
        color: white;
        border-color: #4a5568;
    }
} 

/* =================== COMPATIBILIDAD CON OTROS ELEMENTOS =================== */

/* Cuando hay modales de Bootstrap abiertos, ocultar el chatbot temporalmente */
body.modal-open .chatbot-container {
    z-index: 999 !important;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

/* Asegurar que el chatbot no interfiera con elementos críticos de la interfaz */
.chatbot-container.minimized {
    opacity: 0.8;
    transform: scale(0.9);
    transition: all 0.3s ease;
}

/* Prevenir sobreposición con headers fixed */
@media (max-width: 768px) {
    body.modal-open .chatbot-container {
        display: none; /* Ocultar completamente en mobile cuando hay modales */
    }
}

/* Ajustes adicionales para el extractor */
.extractor-page .chatbot-container {
    bottom: 30px;
    right: 30px;
}

/* Hover effects mejorados */
.chatbot-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Animación de entrada suave */
.chatbot-container {
    animation: chatbotFadeIn 0.5s ease-out;
}

@keyframes chatbotFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Asegurar que los input del chatbot no hereden z-index problemático */
.chatbot-modal input,
.chatbot-modal textarea,
.chatbot-modal button {
    z-index: auto !important;
    position: relative !important;
} 