﻿/* ============================================================
   Social-proof widget: section trang chủ + toast nổi các trang.
   Dữ liệu từ /api/social-proof (poll nhẹ). Tông xanh #1f5fa8 theo brand.
   ============================================================ */

/* ---- Section trang chủ ---- */
.sp-section {
    background: #f4f8fb;
    padding: 40px 16px;
    border-top: 1px solid #e6eef4;
    border-bottom: 1px solid #e6eef4;
}

.sp-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.sp-title {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: #12303f;
    margin: 0 0 6px;
}

.sp-sub {
    text-align: center;
    font-size: 14px;
    color: #5a6b78;
    margin: 0 0 24px;
}

.sp-counters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-bottom: 28px;
}

.sp-counter {
    flex: 1 1 150px;
    max-width: 195px;
    background: #fff;
    border: 1px solid #e6eef4;
    border-radius: 10px;
    padding: 16px 10px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(20, 60, 90, .05);
}

.sp-num {
    display: block;
    font-size: 26px;
    font-weight: 800;
    color: #1f5fa8;
    line-height: 1.1;
}

.sp-label {
    display: block;
    font-size: 12.5px;
    color: #5a6b78;
    margin-top: 6px;
}

.sp-feed-head {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 720px;
    margin: 0 auto 10px;
    font-size: 14px;
    font-weight: 700;
    color: #234;
}

.sp-live-dot {
    color: #28a745;
    font-size: 9px;
    animation: sp-blink 1.4s infinite;
}

@keyframes sp-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: .25; }
}

.sp-feed {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    max-width: 720px;
}

.sp-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: #fff;
    border: 1px solid #eef3f7;
    border-radius: 8px;
    margin-bottom: 7px;
    font-size: 13.5px;
    color: #334;
    animation: sp-fade-in .4s ease;
}

@keyframes sp-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.sp-ic {
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
}

.sp-ic-purchase { background: #22a06b; }
.sp-ic-usage    { background: #1f5fa8; }

.sp-body { flex: 1; }

.sp-time {
    color: #8a99a6;
    font-size: 12px;
    white-space: nowrap;
}

/* ---- Toast nổi (các trang không phải trang chủ) ---- */
.sp-toast {
    position: fixed;
    left: 18px;
    top: 30vh;        /* trên-trái, ~1/3 trên, nằm dưới header (tránh đè menu) */
    bottom: auto;
    z-index: 9998;
    max-width: 320px;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform .35s ease, opacity .35s ease;
}

.sp-toast.sp-show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.sp-toast-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #e6eef4;
    border-left: 4px solid #1f5fa8;
    border-radius: 10px;
    padding: 12px 30px 12px 12px;
    box-shadow: 0 8px 24px rgba(20, 60, 90, .16);
    font-size: 13px;
    color: #233;
}

.sp-toast-txt {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
}

.sp-toast-txt .sp-time { margin-top: 2px; }

.sp-toast-x {
    position: absolute;
    top: 6px;
    right: 8px;
    border: 0;
    background: none;
    font-size: 17px;
    line-height: 1;
    color: #aab4bd;
    cursor: pointer;
}

.sp-toast-x:hover { color: #556; }

@media (max-width: 576px) {
    /* Mobile: màn hẹp không có gutter -> giữ toast ở dưới để không che nội dung */
    .sp-toast { left: 10px; right: 10px; top: auto; bottom: 10px; max-width: none; }
    .sp-num { font-size: 22px; }
    .sp-title { font-size: 19px; }
}
