/*
 * Passion In Design WhatsApp Plugin CSS
 * Floating WhatsApp / Email buttons + multi-contact chooser menu
 */

.pid-whatsapp-container {
    --pid-green-1: #29d16c;
    --pid-green-2: #0fa585;
    --pid-gradient: linear-gradient(140deg, var(--pid-green-1) 0%, var(--pid-green-2) 100%);
    --pid-fab-shadow:
        0 2px 4px rgba(11, 66, 44, 0.16),
        0 10px 24px rgba(37, 211, 102, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
    --pid-fab-shadow-hover:
        0 4px 8px rgba(11, 66, 44, 0.18),
        0 16px 34px rgba(37, 211, 102, 0.48),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);

    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 14px;
    /* Follow the theme's font so the widget feels native to the site */
    font-family: inherit;
    content-visibility:visible!important;
}

/* ===== Floating buttons ===== */

.btn.pid-whatsapp,
.btn.pid-email {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 50%;
    color: #ffffff;
    text-decoration: none;
    background-color: #25d366;
    background: var(--pid-gradient);
    box-shadow: var(--pid-fab-shadow);
    transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* The toggle is a <button> when there is more than one contact */
button.btn.pid-whatsapp {
    appearance: none;
    border: 0;
    cursor: pointer;
    font: inherit;
}

/* Soft ripple on hover */
.btn.pid-whatsapp::before,
.btn.pid-email::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s ease, height 0.5s ease, opacity 0.5s ease;
    opacity: 0;
}

.btn.pid-whatsapp:hover::before,
.btn.pid-email:hover::before {
    width: 130px;
    height: 130px;
    opacity: 1;
}

.btn.pid-whatsapp:hover,
.btn.pid-email:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--pid-fab-shadow-hover);
    color: #ffffff;
    text-decoration: none;
}

.btn.pid-whatsapp:active,
.btn.pid-email:active {
    transform: translateY(-1px) scale(0.96);
    transition-duration: 0.1s;
}

.btn.pid-whatsapp svg,
.btn.pid-email svg {
    width: 28px;
    height: 28px;
    fill: #ffffff;
    position: relative;
    z-index: 1;
}

.btn.pid-whatsapp:focus-visible,
.btn.pid-email:focus-visible {
    outline: 3px solid rgba(37, 211, 102, 0.65);
    outline-offset: 3px;
}

/* One-time attention pulse after page load, staggered per button */
@keyframes pid-pulse {
    0% {
        box-shadow: var(--pid-fab-shadow), 0 0 0 0 rgba(37, 211, 102, 0.45);
    }
    70% {
        box-shadow: var(--pid-fab-shadow), 0 0 0 16px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: var(--pid-fab-shadow), 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

.btn.pid-whatsapp,
.btn.pid-email {
    animation: pid-pulse 2.4s ease-out 3s 2;
}

.btn.pid-email {
    animation-delay: 3.6s;
}

/* ===== Toggle icon: WhatsApp glyph morphs to an X while the menu is open ===== */

.pid-whatsapp-toggle .pid-icon {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

.pid-whatsapp-toggle .pid-icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.4);
}

.pid-whatsapp-toggle .pid-icon-close svg {
    width: 20px;
    height: 20px;
    fill: none;
}

.pid-whatsapp-toggle.pid-open .pid-icon-whatsapp {
    opacity: 0;
    transform: rotate(90deg) scale(0.4);
}

.pid-whatsapp-toggle.pid-open .pid-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ===== Multi-contact chooser menu ===== */

.pid-whatsapp-menu {
    position: absolute;
    bottom: calc(100% + 16px);
    right: 0;
    width: 320px;
    max-width: calc(100vw - 32px);
    background: rgba(255, 255, 255, 0.78);
    -webkit-backdrop-filter: blur(20px) saturate(1.7);
    backdrop-filter: blur(12px) saturate(1.7);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 20px;
    box-shadow:
        0 6px 16px rgba(9, 45, 31, 0.08),
        0 24px 60px rgba(9, 45, 31, 0.18);
    overflow: hidden;
    transform-origin: bottom right;
    animation: pid-menu-in 0.32s cubic-bezier(0.21, 1.02, 0.55, 1.01) both;
}

/* Solid card where backdrop-filter is unsupported */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .pid-whatsapp-menu {
        background: #ffffff;
    }

    .pid-whatsapp-container.pid-on-dark .pid-whatsapp-menu {
        background: #1f2733;
    }
}

.pid-whatsapp-menu[hidden] {
    display: none;
}

@keyframes pid-menu-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.94);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */

.pid-whatsapp-menu-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px;
    background-color: #25d366;
    background: var(--pid-gradient);
}

.pid-whatsapp-menu-header::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(120% 140% at 100% 0%, rgba(255, 255, 255, 0.20), transparent 55%);
    pointer-events: none;
}

.pid-menu-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pid-menu-header-icon svg {
    width: 22px;
    height: 22px;
    fill: #ffffff;
}

.pid-menu-header-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pid-menu-title {
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.3;
}

.pid-menu-subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    line-height: 1.4;
    margin-top: 2px;
}

/* Contact rows */

.pid-whatsapp-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    background-color: transparent;
    transition: background-color 0.18s ease;
    animation: pid-item-in 0.32s cubic-bezier(0.21, 1.02, 0.55, 1.01) backwards;
}

/* Staggered entrance (header is the menu's first child) */
.pid-whatsapp-menu-item:nth-child(2) { animation-delay: 0.05s; }
.pid-whatsapp-menu-item:nth-child(3) { animation-delay: 0.10s; }
.pid-whatsapp-menu-item:nth-child(4) { animation-delay: 0.15s; }
.pid-whatsapp-menu-item:nth-child(5) { animation-delay: 0.20s; }
.pid-whatsapp-menu-item:nth-child(n+6) { animation-delay: 0.25s; }

@keyframes pid-item-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pid-whatsapp-menu-item + .pid-whatsapp-menu-item {
    border-top: 1px solid rgba(15, 55, 38, 0.08);
}

.pid-whatsapp-menu-item:hover {
    background-color: rgba(37, 211, 102, 0.09);
    text-decoration: none;
}

.pid-whatsapp-menu-item:focus-visible {
    outline: 3px solid rgba(37, 211, 102, 0.65);
    outline-offset: -3px;
}

/* Label-initial avatar chip (the WhatsApp logo already lives in the
   header and the floating button, so rows don't repeat it) */
.pid-item-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.14);
    color: #0f9d52;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

/* Uploaded avatar image fills the chip */
.pid-item-icon img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.pid-whatsapp-menu-item:hover .pid-item-icon {
    background: var(--pid-gradient);
    color: #ffffff;
    transform: scale(1.05);
}

.pid-contact-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.pid-contact-label {
    font-size: 14px;
    font-weight: 600;
    color: #101828;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pid-contact-phone {
    font-size: 12px;
    color: #667085;
    line-height: 1.35;
}

.pid-item-chevron {
    display: inline-flex;
    flex-shrink: 0;
    color: #98a2b3;
    opacity: 0.45;
    transition: transform 0.2s ease, opacity 0.2s ease, color 0.2s ease;
}

.pid-item-chevron svg {
    width: 14px;
    height: 14px;
}

.pid-whatsapp-menu-item:hover .pid-item-chevron {
    color: #17a34a;
    opacity: 1;
    transform: translateX(2px);
}

/* ===== Dark-site palette =====
   Applied when the admin selects the "Dark" popup style in settings
   (the container gets .pid-on-dark server-side). Header keeps the
   brand gradient in both palettes. */

.pid-whatsapp-container.pid-on-dark .pid-whatsapp-menu {
    background: rgba(20, 28, 30, 0.72);
    /*border-color: rgba(255, 255, 255, 0.12);*/
    border:none;
    box-shadow:
        0 6px 16px rgba(0, 0, 0, 0.40),
        0 24px 60px rgba(0, 0, 0, 0.50);
}

.pid-on-dark .pid-whatsapp-menu-item + .pid-whatsapp-menu-item {
    border-top-color: rgba(255, 255, 255, 0.08);
}

.pid-on-dark .pid-whatsapp-menu-item:hover {
    background-color: rgba(255, 255, 255, 0.07);
}

.pid-on-dark .pid-item-icon {
    background: rgba(74, 222, 128, 0.16);
    color: #4ade80;
}

.pid-on-dark .pid-whatsapp-menu-item:hover .pid-item-icon {
    background: var(--pid-gradient);
    color: #ffffff;
}

.pid-on-dark .pid-contact-label {
    color: #f4f6f8;
}

.pid-on-dark .pid-contact-phone {
    color: #9aa4b2;
}

.pid-on-dark .pid-item-chevron {
    color: #7d8794;
}

.pid-on-dark .pid-whatsapp-menu-item:hover .pid-item-chevron {
    color: #4ade80;
}

/* ===== Mobile ===== */

@media (max-width: 768px) {
    .pid-whatsapp-container {
        bottom: 16px;
        right: 16px;
    }
}

/* ===== Respect user's motion preferences ===== */

@media (prefers-reduced-motion: reduce) {
    .btn.pid-whatsapp,
    .btn.pid-email,
    .btn.pid-whatsapp::before,
    .btn.pid-email::before,
    .pid-whatsapp-menu,
    .pid-whatsapp-menu-item,
    .pid-whatsapp-toggle .pid-icon,
    .pid-item-icon,
    .pid-item-chevron {
        animation: none !important;
        transition: none !important;
    }

    .btn.pid-whatsapp:hover,
    .btn.pid-email:hover {
        transform: scale(1.02);
    }
}
