/* Reset específico para el chatbot */
.intetron-chatbot-button,
.intetron-chatbot-container,
.intetron-chatbot-container * {
    box-sizing: border-box;
}

/* Botón flotante - ESQUINA INFERIOR IZQUIERDA */
.intetron-chatbot-button {
    position: fixed;
    bottom: 20px;
    left: 20px; /* CAMBIADO: de right a left */
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 999998; /* Muy alto para estar por encima de otros plugins */
    color: white;
    border: none;
}

.intetron-chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(37, 99, 235, 0.6);
}

/* Contenedor del chat - ESQUINA INFERIOR IZQUIERDA */
.intetron-chatbot-container {
    position: fixed;
    bottom: 90px;
    left: 20px; /* CAMBIADO: de right a left */
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 999999; /* Muy alto para estar por encima de otros plugins */
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.intetron-chatbot-container.intetron-hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

/* Header del chat */
.intetron-chatbot-header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    padding: 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.intetron-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.intetron-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.intetron-chatbot-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 2px 0;
    padding: 0;
    line-height: 1.3;
}

.intetron-status {
    font-size: 12px;
    opacity: 0.9;
}

.intetron-close-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: opacity 0.2s;
}

.intetron-close-button:hover {
    opacity: 0.8;
}

/* Mensajes */
.intetron-chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

.intetron-message {
    display: flex;
    gap: 8px;
    animation: intetronFadeIn 0.3s ease;
    max-width: 100%;
}

@keyframes intetronFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.intetron-message.intetron-bot {
    align-self: flex-start;
}

.intetron-message.intetron-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.intetron-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.intetron-message.intetron-bot .intetron-message-avatar {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
}

.intetron-message.intetron-user .intetron-message-avatar {
    background: #e5e7eb;
    color: #6b7280;
}

.intetron-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.intetron-message.intetron-bot .intetron-message-content {
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.intetron-message.intetron-user .intetron-message-content {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.intetron-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    width: fit-content;
}

.intetron-typing-dot {
    width: 8px;
    height: 8px;
    background: #2563eb;
    border-radius: 50%;
    animation: intetronTyping 1.4s infinite;
}

.intetron-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.intetron-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes intetronTyping {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Input */
.intetron-chat-input-container {
    padding: 16px;
    background: white;
    border-radius: 0 0 16px 16px;
    display: flex;
    gap: 8px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.intetron-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.intetron-chat-input:focus {
    border-color: #2563eb;
}

.intetron-send-button {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.intetron-send-button:hover:not(:disabled) {
    transform: scale(1.05);
}

.intetron-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 480px) {
    .intetron-chatbot-container {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        left: 10px; /* CAMBIADO: de right a left */
        bottom: 80px;
    }
    
    .intetron-chatbot-button {
        left: 10px; /* CAMBIADO: de right a left */
        bottom: 10px;
    }
}

/* Scrollbar personalizado */
.intetron-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.intetron-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.intetron-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.intetron-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ASEGURAR QUE ESTÉ POR ENCIMA DE TODO */
.intetron-chatbot-button,
.intetron-chatbot-container {
    z-index: 2147483647 !important; /* Máximo z-index posible */
}