/* Sticky WhatsApp widget */
.whatsapp-widget {
    position: fixed;
    right: 20px;
    bottom: 24px;
    z-index: 1000;
    font-family: 'Poppins', sans-serif;
}

body:has(.whatsapp-widget) button.scroltop {
    bottom: 88px;
}

.whatsapp-widget__btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(145deg, #25d366 0%, #128c7e 100%);
    color: #fff;
    box-shadow: 0 8px 28px rgba(37, 211, 102, 0.45);
    cursor: pointer;
    animation: whatsapp-bob 3s ease-in-out infinite;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.whatsapp-widget__btn:hover,
.whatsapp-widget__btn.is-open {
    transform: scale(1.06);
    box-shadow: 0 12px 34px rgba(37, 211, 102, 0.55);
    animation: none;
}

.whatsapp-widget__icon {
    position: relative;
    z-index: 2;
    font-size: 1.85rem;
    line-height: 1;
}

.whatsapp-widget__pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.45);
    animation: whatsapp-pulse 2.2s ease-out infinite;
    pointer-events: none;
}

.whatsapp-widget__pulse--delay {
    animation-delay: 1.1s;
}

.whatsapp-widget__popup {
    position: absolute;
    right: 0;
    bottom: calc(100% + 14px);
    width: min(320px, calc(100vw - 40px));
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    transform-origin: bottom right;
    animation: whatsapp-popup-in 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.whatsapp-widget__popup[hidden] {
    display: none !important;
}

.whatsapp-widget__popup-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1rem 0.85rem;
    background: linear-gradient(135deg, #075e54 0%, #128c7e 100%);
    color: #fff;
}

.whatsapp-widget__popup-avatar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    font-size: 1.35rem;
}

.whatsapp-widget__popup-title {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
}

.whatsapp-widget__popup-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.72rem;
    opacity: 0.88;
}

.whatsapp-widget__popup-close {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.whatsapp-widget__popup-close:hover {
    background: rgba(255, 255, 255, 0.24);
}

.whatsapp-widget__popup-body {
    padding: 0.85rem 1rem 0.5rem;
}

.whatsapp-widget__popup-hint {
    margin: 0 0 0.75rem;
    padding: 0.65rem 0.8rem;
    font-size: 0.82rem;
    line-height: 1.5;
    color: #334155;
    background: #f1f5f9;
    border-radius: 0 12px 12px 12px;
}

.whatsapp-widget__questions {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.whatsapp-widget__question {
    display: block;
    padding: 0.55rem 0.75rem;
    font-size: 0.8rem;
    line-height: 1.45;
    color: #0f172a;
    text-decoration: none;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.whatsapp-widget__question:hover {
    color: #128c7e;
    border-color: #86efac;
    background: #f0fdf4;
    transform: translateX(2px);
}

.whatsapp-widget__popup-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.5rem 1rem 1rem;
    padding: 0.7rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    border-radius: 10px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.whatsapp-widget__popup-action:hover {
    color: #fff;
    opacity: 0.94;
    transform: translateY(-1px);
}

@keyframes whatsapp-pulse {
    0% {
        transform: scale(1);
        opacity: 0.65;
    }
    70% {
        transform: scale(1.75);
        opacity: 0;
    }
    100% {
        transform: scale(1.75);
        opacity: 0;
    }
}

@keyframes whatsapp-bob {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes whatsapp-popup-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .whatsapp-widget__btn,
    .whatsapp-widget__pulse {
        animation: none;
    }
}

@media only screen and (max-width: 575px) {
    .whatsapp-widget {
        right: 16px;
        bottom: 18px;
    }

    body:has(.whatsapp-widget) button.scroltop {
        bottom: 82px;
    }

    .whatsapp-widget__btn {
        width: 54px;
        height: 54px;
    }

    .whatsapp-widget__popup {
        width: min(300px, calc(100vw - 32px));
    }
}
