/**
 * Merchant Powerpack — Floating Contact Button
 * Lightweight CSS (~2KB minified). No external dependencies.
 * Integrates with global styling: uses --merchant-powerpack-primary as fallback color.
 */

/* ── Widget Container ─────────────────────────────────────── */

.mpp-fc-widget {
    position: fixed;
    z-index: 999999;
    bottom: 20px;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 12px;
}

.mpp-fc-bottom-right { right: 20px; }
.mpp-fc-bottom-left  { left: 20px; }

/* Delayed: hidden until JS removes this class */
.mpp-fc-delayed { opacity: 0; pointer-events: none; }
.mpp-fc-delayed.mpp-fc-visible { opacity: 1; pointer-events: auto; transition: opacity .4s ease; }

/* Visibility */
@media (max-width: 768px) {
    .mpp-fc-desktop-only { display: none !important; }
}
@media (min-width: 769px) {
    .mpp-fc-mobile-only { display: none !important; }
}

/* ── Main Button ──────────────────────────────────────────── */

.mpp-fc-main {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--mpp-fc-size, 60px);
    height: var(--mpp-fc-size, 60px);
    border-radius: var(--mpp-fc-radius, 50%);
    background: var(--mpp-fc-color, var(--merchant-powerpack-primary, #25D366));
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    transition: transform .2s ease, box-shadow .2s ease;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    padding: 0;
    line-height: 1;
}

.mpp-fc-main:hover,
.mpp-fc-main:focus-visible {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    outline: none;
}

.mpp-fc-main:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.mpp-fc-main-icon {
    width: var(--mpp-fc-icon, 26px);
    height: var(--mpp-fc-icon, 26px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mpp-fc-main-icon svg {
    width: 100%;
    height: 100%;
}

/* Toggle open/close icons */
.mpp-fc-icon-close {
    display: none;
}

.mpp-fc-widget.mpp-fc-open .mpp-fc-icon-open {
    display: none;
}

.mpp-fc-widget.mpp-fc-open .mpp-fc-icon-close {
    display: flex;
}

/* ── Channel Menu ─────────────────────────────────────────── */

.mpp-fc-menu {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.9);
    transition: opacity .25s ease, transform .25s ease, visibility .25s;
    pointer-events: none;
}

.mpp-fc-widget.mpp-fc-open .mpp-fc-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ── Individual Channel Buttons ───────────────────────────── */

.mpp-fc-channel {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--mpp-fc-ch-btn, 45px);
    height: var(--mpp-fc-ch-btn, 45px);
    border-radius: var(--mpp-fc-radius, 50%);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: transform .2s ease, box-shadow .2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mpp-fc-channel svg {
    width: var(--mpp-fc-ch-icon, 55%);
    height: var(--mpp-fc-ch-icon, 55%);
}

.mpp-fc-channel:hover,
.mpp-fc-channel:focus-visible {
    transform: scale(1.12);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    outline: none;
}

.mpp-fc-channel:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ── Channel Brand Colors ─────────────────────────────────── */

.mpp-fc-channel--whatsapp    { background: #25D366; }
.mpp-fc-channel--phone       { background: #0088cc; }
.mpp-fc-channel--email       { background: #EA4335; }
.mpp-fc-channel--messenger   { background: #006AFF; }
.mpp-fc-channel--instagram   { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.mpp-fc-channel--telegram    { background: #0088cc; }
.mpp-fc-channel--tiktok      { background: #010101; }
.mpp-fc-channel--x           { background: #000000; }
.mpp-fc-channel--linkedin    { background: #0077B5; }
.mpp-fc-channel--sms         { background: #34C759; }
.mpp-fc-channel--viber       { background: #7360F2; }
.mpp-fc-channel--line        { background: #00C300; }
.mpp-fc-channel--skype       { background: #00AFF0; }
.mpp-fc-channel--snapchat    { background: #FFFC00; color: #000; }
.mpp-fc-channel--discord     { background: #5865F2; }
.mpp-fc-channel--google_maps { background: #4285F4; }
.mpp-fc-channel--waze        { background: #33CCFF; }
.mpp-fc-channel--custom      { background: #555555; }

/* ── Pulse Animation ──────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
    .mpp-fc-widget[data-animation="pulse"] .mpp-fc-main::before {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: inherit;
        background: inherit;
        opacity: 0.4;
        z-index: -1;
        animation: mpp-fc-pulse 2s ease-in-out infinite;
    }

    /* Stop pulse when menu is open */
    .mpp-fc-widget.mpp-fc-open .mpp-fc-main::before {
        animation: none;
        opacity: 0;
    }

    @keyframes mpp-fc-pulse {
        0%, 100% { transform: scale(1); opacity: 0.4; }
        50%      { transform: scale(1.35); opacity: 0; }
    }
}

/* ── Bounce Animation ─────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
    .mpp-fc-widget[data-animation="bounce"] .mpp-fc-main {
        animation: mpp-fc-bounce 2s ease-in-out infinite;
    }

    .mpp-fc-widget.mpp-fc-open .mpp-fc-main {
        animation: none;
    }

    @keyframes mpp-fc-bounce {
        0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
        40%  { transform: translateY(-8px); }
        60%  { transform: translateY(-4px); }
    }
}

/* ── Mobile Adjustments ───────────────────────────────────── */

@media (max-width: 768px) {
    .mpp-fc-widget {
        bottom: 16px;
    }
    .mpp-fc-bottom-right { right: 16px; }
    .mpp-fc-bottom-left  { left: 16px; }
}
