/* Widget de Chatbot Instalaciones Electromecánicas MI */
#iemi-chatbot-widget {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

#iemi-chatbot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

#iemi-chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

#iemi-chatbot-button i {
    color: white;
    font-size: 28px;
}

#iemi-chatbot-button.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

#iemi-chatbot-button::before {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 18px;
    height: 18px;
    background: #ff4444;
    border-radius: 50%;
    border: 2px solid white;
    animation: iemi-pulse 2s infinite;
}

@keyframes iemi-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

#iemi-chatbot-window {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: iemi-slideUp 0.3s ease;
}

#iemi-chatbot-window.active {
    display: flex;
}

@keyframes iemi-slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#iemi-chatbot-header {
    background: #667eea;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#iemi-chatbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

#iemi-chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

#iemi-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

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

#iemi-chatbot-messages::-webkit-scrollbar { width: 6px; }
#iemi-chatbot-messages::-webkit-scrollbar-track { background: #f1f1f1; }
#iemi-chatbot-messages::-webkit-scrollbar-thumb { background: #888; border-radius: 3px; }
#iemi-chatbot-messages::-webkit-scrollbar-thumb:hover { background: #555; }

.iemi-message { margin-bottom: 15px; display: flex; align-items: flex-start; }
.iemi-message.bot { justify-content: flex-start; }
.iemi-message.user { justify-content: flex-end; }

.iemi-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
}

.iemi-message.bot .iemi-message-content {
    background: white;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

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

.iemi-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.iemi-option-button {
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.iemi-option-button:hover {
    background: #667eea;
    color: white;
    transform: translateX(5px);
}

.iemi-form { margin-top: 15px; }
.iemi-form-group { margin-bottom: 15px; }

.iemi-form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.iemi-form-group input,
.iemi-form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

.iemi-form-group input:focus,
.iemi-form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.iemi-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.iemi-form-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    width: 100%;
    transition: transform 0.2s ease;
}

.iemi-form-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.iemi-form-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.iemi-pdf-link {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 16px;
    background: #f0f0f0;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    transition: background 0.3s ease;
}

.iemi-pdf-link:hover { background: #e0e0e0; }

.iemi-typing-indicator {
    display: flex;
    gap: 5px;
    padding: 12px 16px;
}

.iemi-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: iemi-typing 1.4s infinite;
}

.iemi-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.iemi-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes iemi-typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

@media (max-width: 480px) {
    #iemi-chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 80px;
        left: 50%;
        transform: translateX(-50%);
    }
    #iemi-chatbot-button {
        width: 56px;
        height: 56px;
        bottom: 15px;
    }
}
