/* ========================================
   WhatsApp Floating Widget - Premium Style
   ======================================== */

.arn-whatsapp {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 16px;
}

/* --- Floating Action Button --- */
.arn-whatsapp__fab {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 4px 15px rgba(37, 211, 102, 0.4),
        0 8px 30px rgba(18, 140, 126, 0.2);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                box-shadow 0.3s ease;
    position: relative;
}

.arn-whatsapp__fab:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 
        0 6px 25px rgba(37, 211, 102, 0.5),
        0 12px 40px rgba(18, 140, 126, 0.3);
}

.arn-whatsapp__fab:active {
    transform: scale(0.95);
}

.arn-whatsapp__fab-icon {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), 
                opacity 0.3s ease;
}

.arn-whatsapp__fab-icon svg {
    width: 34px;
    height: 34px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.arn-whatsapp__fab-icon--wa {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.arn-whatsapp__fab-icon--close {
    opacity: 0;
    transform: scale(0.5) rotate(-180deg);
}

.arn-whatsapp__fab-icon--close svg {
    width: 26px;
    height: 26px;
}

/* Estado abierto del FAB */
.arn-whatsapp.is-open .arn-whatsapp__fab-icon--wa {
    opacity: 0;
    transform: scale(0.5) rotate(180deg);
}

.arn-whatsapp.is-open .arn-whatsapp__fab-icon--close {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.arn-whatsapp.is-open .arn-whatsapp__fab {
    background: linear-gradient(135deg, #128C7E 0%, #075E54 100%);
}

/* --- Popup Chat --- */
.arn-whatsapp__popup {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 340px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 
        0 12px 48px rgba(0, 0, 0, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(30px) scale(0.9);
    transform-origin: bottom right;
    transition: 
        opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
        visibility 0.4s ease, 
        transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.arn-whatsapp.is-open .arn-whatsapp__popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.arn-whatsapp__header {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.arn-whatsapp__header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.arn-whatsapp__powered {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.arn-whatsapp__powered::before {
    content: '';
    width: 10px;
    height: 10px;
    background: #90EE90;
    border-radius: 50%;
    animation: online-pulse 2s ease-in-out infinite;
}

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

.arn-whatsapp__close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.arn-whatsapp__close:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: rotate(90deg);
}

.arn-whatsapp__close svg {
    width: 16px;
    height: 16px;
    color: #ffffff;
}

/* Body */
.arn-whatsapp__body {
    padding: 24px 20px;
    background: linear-gradient(180deg, #ECE5DD 0%, #E5DDD5 100%);
    background-image: 
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4cdc4' fill-opacity='0.3'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.arn-whatsapp__message {
    background: #ffffff;
    padding: 14px 18px;
    border-radius: 4px 18px 18px 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    animation: message-appear 0.5s ease-out 0.2s both;
}

@keyframes message-appear {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.arn-whatsapp__message::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 10px 0;
    border-color: transparent #ffffff transparent transparent;
}

.arn-whatsapp__message::after {
    content: '';
    position: absolute;
    bottom: 6px;
    right: 10px;
    font-size: 11px;
    color: #8696a0;
}

.arn-whatsapp__message p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #303030;
}

.arn-whatsapp__message p + p {
    margin-top: 6px;
}

.arn-whatsapp__message strong {
    font-weight: 700;
    color: #128C7E;
}

/* Footer */
.arn-whatsapp__footer {
    padding: 16px 20px;
    background: #ffffff;
    border-top: 1px solid #f0f0f0;
}

.arn-whatsapp__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    outline: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
    box-sizing: border-box;
}

.arn-whatsapp__btn:hover {
    background: linear-gradient(135deg, #20bd5a 0%, #0f7a6b 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

.arn-whatsapp__btn:active {
    transform: translateY(0);
}

.arn-whatsapp__btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.arn-whatsapp__btn:hover svg {
    transform: translateX(4px);
}

/* Pulse animation for FAB */
.arn-whatsapp__fab::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    z-index: -1;
    animation: whatsapp-pulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.arn-whatsapp__fab::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    z-index: -2;
    animation: whatsapp-pulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite 0.5s;
}

.arn-whatsapp.is-open .arn-whatsapp__fab::before,
.arn-whatsapp.is-open .arn-whatsapp__fab::after {
    animation: none;
    opacity: 0;
}

@keyframes whatsapp-pulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        opacity: 0.3;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* Tooltip on hover */
.arn-whatsapp__fab-tooltip {
    position: absolute;
    right: 76px;
    background: #333;
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.arn-whatsapp__fab-tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border-style: solid;
    border-width: 6px 0 6px 6px;
    border-color: transparent transparent transparent #333;
}

.arn-whatsapp:not(.is-open) .arn-whatsapp__fab:hover + .arn-whatsapp__fab-tooltip,
.arn-whatsapp:not(.is-open) .arn-whatsapp__fab-tooltip:hover {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Responsive */
@media (max-width: 480px) {
    .arn-whatsapp {
        bottom: 20px;
        right: 20px;
    }

    .arn-whatsapp__popup {
        width: calc(100vw - 40px);
        right: 0;
        border-radius: 16px;
    }

    .arn-whatsapp__fab {
        width: 58px;
        height: 58px;
    }

    .arn-whatsapp__fab-icon svg {
        width: 30px;
        height: 30px;
    }

    .arn-whatsapp__fab-tooltip {
        display: none;
    }
}
