body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* =========================================
   BOTÓN FLOTANTE ESTILO WHATSAPP
========================================= */
#chatbot-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;     
    height: 60px;
    background: #25D366; 
    border: none;
    border-radius: 50%; 
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2147483647 !important;
}

#chatbot-toggle-btn:hover {
    transform: scale(1.08); 
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #25D366;
    z-index: -1;
    animation: smoothPulse 2.5s infinite;
}

@keyframes smoothPulse {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.5); opacity: 0; }
}

@media (max-width: 480px) {
    #chatbot-toggle-btn {
        bottom: 20px; right: 20px;
        width: 55px; height: 55px;
    }
}

/* =========================================
   CONTENEDOR DEL CHAT
========================================= */
#chatbot-container {
    position: fixed;
    bottom: 110px; 
    right: 30px;
    width: 380px;
    height: 620px;
    max-width: calc(100vw - 40px); 
    max-height: calc(100vh - 150px); 
    
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom right;
    z-index: 2147483647 !important;
}

#chatbot-container.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.6) translateY(50px);
}

/* =========================================
   HEADER PRO
========================================= */
#chatbot-header {
    background: #008069; /* Verde oscuro oficial de WA */
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-text { display: flex; flex-direction: column; }
.header-text strong { font-size: 16px; font-weight: 500; color: #fff; }
.header-text small { font-size: 13px; font-weight: 400; color: #afe2d5; margin-top: 1px;}

#chatbot-close-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}
#chatbot-close-btn:hover { color: #fff; }

/* =========================================
   FONDO WHATSAPP
========================================= */
.whatsapp-bg {
    background-color: #efeae2; /* Fondo de chat nativo */
    /* El clásico patrón de doodles de WhatsApp */
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    background-repeat: repeat;
    background-size: 300px;
    opacity: 0.95;
}

#chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Burbujas de chat */
.message {
    padding: 8px 12px;
    max-width: 80%;
    word-wrap: break-word;
    border-radius: 8px;
    font-size: 14.5px;
    line-height: 1.4;
    position: relative;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.user-message {
    background: #d9fdd3; /* Burbuja verde claro WA */
    color: #111b21;
    align-self: flex-end;
    border-top-right-radius: 0;
}
.user-message::after {
    content: '';
    position: absolute;
    top: 0;
    right: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-top-color: #d9fdd3;
    border-right: 0;
    border-bottom: 0;
}

.bot-message {
    background: #ffffff;
    color: #111b21;
    align-self: flex-start;
    border-top-left-radius: 0;
}
.bot-message::after {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-top-color: #ffffff;
    border-left: 0;
    border-bottom: 0;
}

/* =========================================
   ESTILOS DEL PRE-CHAT (CAPTURA LEADS)
========================================= */
.hidden-view { display: none !important; }

#chatbot-prechat {
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
    background: #ffffff;
    flex: 1;
}

#chatbot-prechat h3 {
    margin: 0 0 5px; font-size: 18px; color: #111b21;
}
#chatbot-prechat p {
    font-size: 14px; color: #54656f; margin: 0 0 15px;
}
#chatbot-prechat input {
    padding: 13px 16px; border: 1px solid #d1d7db;
    border-radius: 8px; outline: none; font-size: 14px;
    background: #f0f2f5; transition: border 0.2s;
}
#chatbot-prechat input:focus { border-color: #008069; background: #fff;}
#chatbot-prechat button {
    margin-top: 10px; background: #008069; color: #fff;
    border: none; padding: 14px; border-radius: 24px;
    font-size: 15px; font-weight: 500; cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 128, 105, 0.3);
}

/* =========================================
   INPUT ÁREA
========================================= */
#chatbot-input-area {
    display: flex;
    padding: 10px;
    background: #f0f2f5;
    align-items: flex-end;
    gap: 8px;
}

#chatbot-input {
    flex: 1;
    padding: 12px 18px;
    border: none;
    border-radius: 20px; 
    outline: none;
    font-size: 15px;
    background: #ffffff;
    box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

.wa-send-btn {
    background: #00a884; /* Envío exacto de WhatsApp */
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    /* Redondo como un círculo */
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    flex-shrink: 0;
}
.wa-send-btn:hover { background: #008f6f; }

/* REGLAS PARA CELULARES */
@media (max-width: 500px) {
    #chatbot-container {
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100%; height: 100%;
        max-width: 100vw; max-height: 100dvh; 
        border-radius: 0;
    }
}

.whatsapp-buttons-wrapper { margin-top: 8px; width: 100%; }
.whatsapp-btn {
    display: inline-flex;
    background: #25D366;
    color: #fff;
    padding: 12px 16px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 8px;
    text-decoration: none;
}
