/**
 * EC Shop 前台 — 社會證明插件樣式
 * /assets/css/social-proof.css
 */

/* ════════ 購買通知 toast ════════ */
.sp-toast {
    position: fixed;
    bottom: 20px;
    z-index: 9500;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 320px;
    max-width: calc(100vw - 32px);
    padding: 12px 14px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, .16);
    border: 1px solid rgba(0, 0, 0, .06);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .35s ease, transform .35s ease;
    font-family: inherit;
}
.sp-toast.sp-left  { left: 20px; }
.sp-toast.sp-right { right: 20px; }
.sp-toast.sp-stack { bottom: 76px; }   /* 同 badge 同一邊時升高 */
.sp-toast.sp-in { opacity: 1; transform: translateY(0); }

.sp-toast-img {
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    background: #f3f4f6 center/cover no-repeat;
}
.sp-toast-body { flex: 1; min-width: 0; }
.sp-toast-text {
    font-size: 13.5px;
    line-height: 1.4;
    color: #1f2937;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sp-toast-foot {
    margin-top: 4px;
    font-size: 11px;
    color: #16a34a;
    display: flex;
    align-items: center;
    gap: 4px;
}
.sp-toast-foot .sp-tick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    font-size: 9px;
    line-height: 1;
}
.sp-toast-close {
    position: absolute;
    top: 6px; right: 8px;
    border: none;
    background: none;
    color: #9ca3af;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px;
}
.sp-toast-close:hover { color: #4b5563; }

/* ════════ 在線人數 badge ════════ */
.sp-online-badge {
    position: fixed;
    bottom: 20px;
    z-index: 9400;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    background: rgba(17, 24, 39, .9);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
    backdrop-filter: blur(4px);
    font-family: inherit;
}
.sp-online-badge.sp-left  { left: 20px; }
.sp-online-badge.sp-right { right: 20px; }
.sp-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 rgba(34, 197, 94, .6);
    animation: spPulse 1.8s infinite;
}
@keyframes spPulse {
    0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); }
    70%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ════════ 商品頁瀏覽人數 ════════ */
.sp-product-viewing {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 12px;
    padding: 6px 12px;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
}
.sp-product-viewing.sp-product-float {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    z-index: 9300;
    margin: 0;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .15);
    background: #fff;
}

/* ════════ 手機 ════════ */
@media (max-width: 600px) {
    .sp-toast { width: calc(100vw - 24px); left: 12px; right: 12px; bottom: 12px; }
    .sp-toast.sp-left, .sp-toast.sp-right { left: 12px; right: 12px; }
    .sp-toast.sp-stack { bottom: 64px; }
    .sp-online-badge { bottom: 12px; font-size: 11.5px; padding: 7px 12px; }
    .sp-online-badge.sp-left { left: 12px; }
    .sp-online-badge.sp-right { right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .sp-toast { transition: opacity .2s ease; transform: none; }
    .sp-dot { animation: none; }
}

/* 安全位：若 widget 擺右下角，自動升高，避免疊住網站既有浮動掣
   （WhatsApp 綠掣 / 置頂掣 / 傾偈掣，全部喺右下角）。左下角維持貼底。 */
.sp-toast.sp-right          { bottom: 96px; }
.sp-toast.sp-right.sp-stack { bottom: 152px; }
.sp-online-badge.sp-right   { bottom: 96px; }
@media (max-width: 600px) {
    .sp-toast.sp-right          { bottom: 84px; }
    .sp-toast.sp-right.sp-stack { bottom: 140px; }
    .sp-online-badge.sp-right   { bottom: 84px; }
}