/* ===== Social Proof Bubble ===== */
.sp-container {
    /* --sp-bottom-offset di-set dinamis oleh JS (lihat social-proof.js).
       Default-nya 16px supaya tetap aman bila JS belum sempat menghitung. */
    --sp-bottom-offset: 16px;
    position: fixed;
    left: 16px;
    bottom: calc(var(--sp-bottom-offset) + env(safe-area-inset-bottom, 0px));
    /* DI BAWAH modal (modal-overlay z-index: 1000) supaya tidak pernah
       menutupi tombol bayar / checkout di dalam modal. */
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: calc(100vw - 32px);
    transition:
        bottom .28s cubic-bezier(.22,1.1,.36,1),
        opacity .25s ease,
        transform .25s ease;
}

/* State: modal pembayaran sedang terbuka → bubble minggir total */
.sp-container.sp-hidden {
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    visibility: hidden;
}
.sp-bubble {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #ffffff;
    color: #1f2937;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 14px;
    padding: 12px 38px 12px 12px;
    box-shadow:
        0 12px 32px -10px rgba(0, 0, 0, 0.22),
        0 4px 10px -2px rgba(0, 0, 0, 0.06);
    max-width: 320px;
    min-width: 270px;
    transform: translateY(16px) scale(.96);
    opacity: 0;
    transition:
        transform .35s cubic-bezier(.22,1.1,.36,1),
        opacity .35s ease,
        box-shadow .2s ease;
    pointer-events: auto;
    font-family: inherit;
    font-size: 13.5px;
    line-height: 1.4;
    backdrop-filter: saturate(140%);
    -webkit-backdrop-filter: saturate(140%);
}
.sp-bubble:hover {
    box-shadow:
        0 18px 40px -10px rgba(0, 0, 0, 0.28),
        0 6px 14px -2px rgba(0, 0, 0, 0.08);
}
.sp-bubble.sp-in {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.sp-bubble.sp-out {
    transform: translateY(8px) scale(.98);
    opacity: 0;
}
.sp-avatar {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #5b8def;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: .5px;
    box-shadow: 0 2px 4px rgba(0,0,0,.08);
}
.sp-avatar.sp-eye {
    background: linear-gradient(135deg, #ef4444, #f97316);
}
.sp-body {
    flex: 1 1 auto;
    min-width: 0;
}
.sp-line {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sp-line strong {
    color: #111827;
    font-weight: 700;
}
.sp-prod-line {
    margin-top: 1px;
}
.sp-prod {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dashed transparent;
    transition: border-color .15s ease;
}
.sp-prod:hover {
    border-bottom-color: #2563eb;
}
.sp-meta {
    margin-top: 4px;
    font-size: 11.5px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.sp-check {
    color: #16a34a;
    font-weight: 600;
}
.sp-stars {
    display: inline-flex;
    gap: 1px;
    vertical-align: middle;
    margin-left: 2px;
}
.sp-live {
    color: #dc2626;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: .3px;
}
.sp-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #dc2626;
    animation: sp-pulse 1.4s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(220, 38, 38, .6);
}
@keyframes sp-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .55); }
    50%      { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}
.sp-close {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 26px;
    height: 26px;
    line-height: 1;
    border: 0;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 18px;
    border-radius: 8px;
    padding: 0;
    transition: background .15s, color .15s, transform .1s;
}
.sp-close:hover {
    background: #f3f4f6;
    color: #374151;
}
.sp-close:active { transform: scale(.92); }

/* Dark mode (mengikuti preferensi sistem kalau site belum punya toggle) */
@media (prefers-color-scheme: dark) {
    .sp-bubble {
        background: #1f2937;
        color: #e5e7eb;
        border-color: rgba(255,255,255,.08);
        box-shadow: 0 10px 30px -8px rgba(0,0,0,.6), 0 4px 10px -2px rgba(0,0,0,.3);
    }
    .sp-line strong { color: #f9fafb; }
    .sp-meta { color: #9ca3af; }
    .sp-prod { color: #60a5fa; }
    .sp-close { color: #6b7280; }
    .sp-close:hover { background: #374151; color: #f3f4f6; }
}

/* Mobile: lebar penuh tapi tetap di atas sticky CTA berkat --sp-bottom-offset */
@media (max-width: 520px) {
    .sp-container {
        left: 10px;
        right: 10px;
        max-width: none;
        /* Padding bawah dinamis ditangani oleh --sp-bottom-offset.
           Minimal 12px supaya tetap ada nafas saat tidak ada sticky bar. */
    }
    .sp-bubble {
        max-width: none;
        min-width: 0;
        width: 100%;
        font-size: 12.5px;
        padding: 10px 38px 10px 10px;
        gap: 10px;
        border-radius: 12px;
    }
    .sp-avatar {
        flex: 0 0 34px;
        width: 34px;
        height: 34px;
        font-size: 12px;
    }
    .sp-meta { font-size: 10.5px; }
    .sp-close {
        /* Area tap lebih besar di mobile */
        width: 30px;
        height: 30px;
        top: 4px;
        right: 4px;
    }
}

/* Hormati user yang minim animasi */
@media (prefers-reduced-motion: reduce) {
    .sp-container { transition: none; }
    .sp-bubble { transition: opacity .2s ease; transform: none; }
    .sp-bubble.sp-in { transform: none; }
    .sp-dot { animation: none; }
}
