/* ─── Brand tokens (per popup instance can override --spn-primary / --spn-accent inline) ─── */
.spn-popup {
    --spn-primary: #0D0C15;       /* badge background */
    --spn-accent: #C1B8FF;        /* icon background */
    --spn-name-color: #0D0C15;
    --spn-name-weight: 500;
    --spn-name-font: inherit;
    --spn-product-color: #0D0C15;
    --spn-product-weight: 500;
    --spn-meta-color: #5C5B68;
    --spn-meta-weight: 400;
    --spn-canvas: #F4F4F4;
    --spn-surface: #FFFFFF;
    --spn-ink: #0D0C15;
    --spn-muted: #5C5B68;
    --spn-line: #E5E5EA;

    position: fixed;
    z-index: 999999;
    max-width: 340px;
    background: var(--spn-surface);
    border-radius: 14px;
    border: 1px solid var(--spn-line);
    box-shadow: 0 12px 32px rgba(13, 12, 21, .12), 0 2px 8px rgba(13, 12, 21, .06);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 12px;
    line-height: 1.4;
    color: var(--spn-muted);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .4s ease, transform .4s ease;
    pointer-events: none;
    overflow: hidden;
}

.spn-popup.spn-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ─── Positions ─── */
.spn-popup.spn-bottom-left  { bottom: 24px; left:  24px; }
.spn-popup.spn-bottom-right { bottom: 24px; right: 24px; }
.spn-popup.spn-top-left     { top:    24px; left:  24px; }
.spn-popup.spn-top-right    { top:    24px; right: 24px; }

/* ─── Shared inner elements ─── */
.spn-popup-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.spn-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    background: transparent;
    border: none;
    color: #aaa;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    z-index: 1;
}
.spn-popup-close:hover { color: var(--spn-ink); }

.spn-popup-name {
    font-weight: var(--spn-name-weight);
    color: var(--spn-name-color);
    font-family: var(--spn-name-font);
}

.spn-popup-time {
    color: var(--spn-meta-color);
    font-weight: var(--spn-meta-weight);
    white-space: nowrap;
}

.spn-popup-product {
    color: var(--spn-meta-color);
    font-weight: var(--spn-meta-weight);
}

.spn-popup-product b {
    color: var(--spn-product-color);
    font-weight: var(--spn-product-weight);
}

/* ─── Layout 1: card-verified (default) ─── */
.spn-popup.spn-layout-card-verified .spn-popup-badge {
    background: var(--spn-primary);
    color: #fff;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: .2px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.spn-popup.spn-layout-card-verified .spn-popup-badge svg {
    flex-shrink: 0;
    opacity: .9;
}
.spn-popup.spn-layout-card-verified .spn-popup-body {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 30px 11px 12px;
}
.spn-popup.spn-layout-card-verified .spn-popup-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--spn-accent);
    color: var(--spn-ink);
    display: grid;
    place-items: center;
}
.spn-popup.spn-layout-card-verified .spn-popup-icon svg { width: 18px; height: 18px; }
.spn-popup.spn-layout-card-verified .spn-popup-icon img { width: 24px; height: 24px; object-fit: contain; }
.spn-popup.spn-layout-card-verified .spn-popup-content { flex: 1; min-width: 0; }
.spn-popup.spn-layout-card-verified .spn-popup-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}
.spn-popup.spn-layout-card-verified .spn-popup-name { font-size: 13px; }
.spn-popup.spn-layout-card-verified .spn-popup-time { font-size: 11px; }
.spn-popup.spn-layout-card-verified .spn-popup-product {
    font-size: 12px;
    line-height: 1.35;
    margin-top: 1px;
}
.spn-popup.spn-layout-card-verified .spn-popup-close { top: 28px; }

/* ─── Layout 2: minimal ─── */
.spn-popup.spn-layout-minimal {
    border-radius: 999px;
    max-width: 420px;
}
.spn-popup.spn-layout-minimal .spn-popup-badge { display: none; }
.spn-popup.spn-layout-minimal .spn-popup-icon { display: none; }
.spn-popup.spn-layout-minimal .spn-popup-body {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 32px 10px 14px;
}
.spn-popup.spn-layout-minimal .spn-popup-content { flex: 1; min-width: 0; }
.spn-popup.spn-layout-minimal .spn-popup-row {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    font-size: 13px;
}
.spn-popup.spn-layout-minimal .spn-popup-row::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--spn-accent);
    margin-right: 4px;
}
.spn-popup.spn-layout-minimal .spn-popup-product {
    display: inline;
    font-size: 12px;
    margin-left: 6px;
}
.spn-popup.spn-layout-minimal .spn-popup-time {
    font-size: 11px;
    margin-left: 6px;
}

/* ─── Layout 3: avatar-bubble ─── */
.spn-popup.spn-layout-avatar-bubble {
    border-radius: 18px;
}
.spn-popup.spn-layout-avatar-bubble .spn-popup-badge { display: none; }
.spn-popup.spn-layout-avatar-bubble .spn-popup-body {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 32px 14px 16px;
}
.spn-popup.spn-layout-avatar-bubble .spn-popup-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--spn-accent);
    color: var(--spn-ink);
    display: grid;
    place-items: center;
    font-weight: 500;
    font-size: 15px;
}
.spn-popup.spn-layout-avatar-bubble .spn-popup-icon svg { width: 20px; height: 20px; }
.spn-popup.spn-layout-avatar-bubble .spn-popup-icon img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.spn-popup.spn-layout-avatar-bubble .spn-popup-content { flex: 1; min-width: 0; }
.spn-popup.spn-layout-avatar-bubble .spn-popup-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.spn-popup.spn-layout-avatar-bubble .spn-popup-name { font-size: 14px; }
.spn-popup.spn-layout-avatar-bubble .spn-popup-time { font-size: 12px; }
.spn-popup.spn-layout-avatar-bubble .spn-popup-product {
    font-size: 13px;
    margin-top: 2px;
    color: var(--spn-muted);
}

/* ─── Mobile ─── */
@media (max-width: 480px) {
    .spn-popup {
        left: 10px !important;
        right: 10px !important;
        max-width: none;
    }
}

/* ─── Admin preview stage (Design tab) ─── */
#spn-preview-stage {
    background: linear-gradient(180deg, #F4F4F4 0%, #ECECF2 100%);
    border-radius: 20px;
    padding: 40px 24px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#spn-preview-stage .spn-popup {
    position: relative;
    inset: auto;
    margin: 0;
}
