/* Storefront social proof — viewers pill (top) + purchase toasts (side) */
.sf-sp-viewers-slot {
    position: fixed;
    z-index: 9996;
    top: max(5.25rem, calc(4.5rem + env(safe-area-inset-top, 0px)));
    right: max(1rem, env(safe-area-inset-right, 0px));
    pointer-events: none;
    max-width: min(20rem, calc(100vw - 2rem));
}

.sf-sp-root {
    position: fixed;
    z-index: 9995;
    pointer-events: none;
    bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
    left: max(1rem, env(safe-area-inset-left, 0px));
    max-width: min(22rem, calc(100vw - 2rem));
}

.sf-sp-root--right {
    left: auto;
    right: max(1rem, env(safe-area-inset-right, 0px));
}

/* Lift above Lux sticky conversion bar when present */
body:has(.lux-se-bar.is-visible) .sf-sp-root {
    bottom: max(5.75rem, calc(4.5rem + env(safe-area-inset-bottom, 0px)));
}

.sf-sp-viewers {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.85rem 0.45rem 0.65rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.92);
    color: #f8fafc;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
    border: 1px solid rgba(148, 163, 184, 0.35);
    backdrop-filter: blur(8px);
}

.sf-sp-viewers__dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
    animation: sf-sp-pulse 2.2s ease-in-out infinite;
    flex-shrink: 0;
}

.sf-sp-viewers__count {
    color: #fde68a;
    font-variant-numeric: tabular-nums;
}

.sf-sp-toast-wrap {
    pointer-events: none;
    width: 100%;
    min-height: 0;
}

.sf-sp-toast {
    pointer-events: auto;
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    padding: 0.75rem 0.9rem;
    border-radius: 14px;
    background: #ffffff;
    color: #0f172a;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 0.8rem;
    line-height: 1.45;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(203, 213, 225, 0.9);
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.sf-sp-root--right .sf-sp-toast {
    flex-direction: row-reverse;
    text-align: right;
}

.sf-sp-toast.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.sf-sp-toast__icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #ecfdf5, #d1fae5);
    color: #047857;
    font-size: 1rem;
    font-weight: 800;
}

.sf-sp-toast__title {
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.15rem;
}

.sf-sp-toast__meta {
    font-size: 0.72rem;
    color: #64748b;
}

.sf-sp-toast__product {
    font-size: 0.75rem;
    color: #0f766e;
    font-weight: 600;
    margin-top: 0.2rem;
}

@media (max-width: 640px) {
    .sf-sp-viewers-slot {
        top: max(4.75rem, calc(4rem + env(safe-area-inset-top, 0px)));
        right: max(0.65rem, env(safe-area-inset-right, 0px));
        max-width: min(17rem, calc(100vw - 1.25rem));
    }

    .sf-sp-root {
        max-width: min(19rem, calc(100vw - 1.25rem));
        left: max(0.65rem, env(safe-area-inset-left, 0px));
        bottom: max(0.85rem, env(safe-area-inset-bottom, 0px));
    }

    .sf-sp-root--right {
        right: max(0.65rem, env(safe-area-inset-right, 0px));
    }

    body:has(.lux-se-bar.is-visible) .sf-sp-root {
        bottom: max(5.25rem, calc(4rem + env(safe-area-inset-bottom, 0px)));
    }

    .sf-sp-viewers {
        font-size: 0.72rem;
        padding: 0.4rem 0.7rem 0.4rem 0.55rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sf-sp-viewers__dot {
        animation: none;
    }

    .sf-sp-toast {
        transition: none;
    }
}

@keyframes sf-sp-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }
}
