/* ========================================
   BOTÓN FLOTANTE DE WHATSAPP CON CHAT
   ======================================== */

/* Contenedor principal */
.whatsapp-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
}

/* Botón flotante */
.whatsapp-float {
    width: 60px;
    height: 60px;
    background-color: #25D366;
    color: white;
    border-radius: 50%;
    text-align: center;
    font-size: 30px;
    box-shadow: 2px 2px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
    border: none;
}

.whatsapp-float:hover {
    background-color: #20BA5A;
    transform: scale(1.1);
}

/* Animación de pulso */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

/* Badge de notificación */
.whatsapp-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #FF0000;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Ventana de chat emergente */
.whatsapp-chat {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 320px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    opacity: 0;
    transform: scale(0.8);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
}

.whatsapp-chat.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: all;
}

/* Header del chat */
.whatsapp-chat-header {
    background: linear-gradient(135deg, #25D366 0%, #20BA5A 100%);
    color: white;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.whatsapp-chat-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.whatsapp-avatar {
    width: 45px;
    height: 45px;
    background-color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.whatsapp-chat-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.whatsapp-chat-info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.whatsapp-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.whatsapp-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Cuerpo del chat */
.whatsapp-chat-body {
    padding: 20px;
    background: #ECE5DD;
    min-height: 150px;
}

.whatsapp-message {
    background: white;
    padding: 12px 15px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    position: relative;
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.whatsapp-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 8px 0;
    border-color: transparent white transparent transparent;
}

.whatsapp-message p {
    margin: 0;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

.whatsapp-message small {
    display: block;
    margin-top: 5px;
    font-size: 11px;
    color: #999;
}

/* Footer del chat */
.whatsapp-chat-footer {
    padding: 15px;
    background: white;
    border-top: 1px solid #E0E0E0;
}

.whatsapp-open-btn {
    width: 100%;
    background: #25D366;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.whatsapp-open-btn:hover {
    background: #20BA5A;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
}

.whatsapp-open-btn i {
    font-size: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .whatsapp-container {
        bottom: 20px;
        right: 20px;
    }
    
    .whatsapp-float {
        width: 55px;
        height: 55px;
        font-size: 26px;
    }
    
    .whatsapp-chat {
        width: calc(100vw - 40px);
        right: -10px;
    }
}

/* Animación de escribiendo */
.whatsapp-typing {
    display: flex;
    gap: 4px;
    padding: 10px 0;
}

.whatsapp-typing span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.whatsapp-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.whatsapp-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}