/* ============================================================
   Social Proof Popup — Frontend Styles v1.0.1
   Vanilla CSS, zero dependencies
   ============================================================ */

#spp-container {
  position: fixed;
  z-index: 99999;
  padding: 16px;
  pointer-events: none;

  --spp-avatar-size: 44px;
  --spp-progress-color: #4f46e5;
  --spp-radius: 12px;
  --spp-shadow: 0 4px 24px rgba(0,0,0,.13), 0 1.5px 6px rgba(0,0,0,.08);
  --spp-bg: #ffffff;
  --spp-text: #1a1a2e;
  --spp-sub: #6b7280;
  --spp-link: #4f46e5;
  --spp-close: #9ca3af;
}

/* ── positions ── */
#spp-container.spp-pos-bottom-left  { bottom: 0; left: 0; }
#spp-container.spp-pos-bottom-right { bottom: 0; right: 0; }
#spp-container.spp-pos-top-left     { top: 0; left: 0; }
#spp-container.spp-pos-top-right    { top: 0; right: 0; }

/* ============================================================
   CARD BASE (hidden state — overridden per animation below)
   ============================================================ */
.spp-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 38px 14px 14px;
  background: var(--spp-bg);
  border-radius: var(--spp-radius);
  box-shadow: var(--spp-shadow);
  pointer-events: all;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
  opacity: 0;
}

/* ── transition shared ── */
.spp-card { transition: opacity .32s ease, transform .32s cubic-bezier(.34,1.46,.64,1); }

/* ============================================================
   ANIMATION VARIANTS — enter state (hidden)
   ============================================================ */

/* slide-up (default) */
#spp-container.spp-anim-slide-up .spp-card            { transform: translateY(20px) scale(.97); }
#spp-container.spp-anim-slide-up .spp-card.spp-visible { transform: translateY(0) scale(1); opacity: 1; }

/* top-position slide-up: reverse direction */
#spp-container.spp-pos-top-left.spp-anim-slide-up  .spp-card,
#spp-container.spp-pos-top-right.spp-anim-slide-up .spp-card            { transform: translateY(-20px) scale(.97); }
#spp-container.spp-pos-top-left.spp-anim-slide-up  .spp-card.spp-visible,
#spp-container.spp-pos-top-right.spp-anim-slide-up .spp-card.spp-visible { transform: translateY(0) scale(1); opacity: 1; }

/* slide-left */
#spp-container.spp-anim-slide-left .spp-card            { transform: translateX(-60px) scale(.97); }
#spp-container.spp-anim-slide-left .spp-card.spp-visible { transform: translateX(0) scale(1); opacity: 1; }

/* slide-right */
#spp-container.spp-anim-slide-right .spp-card            { transform: translateX(60px) scale(.97); }
#spp-container.spp-anim-slide-right .spp-card.spp-visible { transform: translateX(0) scale(1); opacity: 1; }

/* bounce */
#spp-container.spp-anim-bounce .spp-card {
  transform: translateY(30px) scale(.9);
  transition: opacity .25s ease, transform .5s cubic-bezier(.22,.68,0,1.6);
}
#spp-container.spp-anim-bounce .spp-card.spp-visible { transform: translateY(0) scale(1); opacity: 1; }

/* fade */
#spp-container.spp-anim-fade .spp-card            { transform: none; }
#spp-container.spp-anim-fade .spp-card.spp-visible { opacity: 1; transform: none; }

/* zoom */
#spp-container.spp-anim-zoom .spp-card {
  transform: scale(.7);
  transition: opacity .28s ease, transform .35s cubic-bezier(.22,.68,0,1.4);
}
#spp-container.spp-anim-zoom .spp-card.spp-visible { transform: scale(1); opacity: 1; }

/* ── leave animation (shared for all) ── */
.spp-card.spp-leaving {
  animation: sppLeave .28s ease forwards;
}

@keyframes sppLeave {
  to {
    opacity: 0;
    transform: scale(.93) translateY(6px);
  }
}

/* ── avatar ── */
.spp-avatar {
  flex-shrink: 0;
  width: var(--spp-avatar-size);
  height: var(--spp-avatar-size);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--spp-avatar-size) * .38);
  font-weight: 700;
  font-family: system-ui, -apple-system, sans-serif;
  letter-spacing: -.5px;
  overflow: hidden;
  user-select: none;
}

.spp-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ── body ── */
.spp-body { flex: 1; min-width: 0; }

.spp-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--spp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.3;
  margin-bottom: 2px;
}

.spp-message {
  font-size: 13px;
  color: var(--spp-sub);
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.4;
  word-break: break-word;
}

.spp-link {
  display: inline-block;
  margin-top: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--spp-link);
  text-decoration: none;
  font-family: system-ui, -apple-system, sans-serif;
  transition: opacity .2s;
}
.spp-link:hover { opacity: .75; text-decoration: underline; }

/* ── close button ── */
.spp-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--spp-close);
  font-size: 18px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color .2s, background .2s;
  font-family: system-ui, -apple-system, sans-serif;
}
.spp-close:hover { color: var(--spp-text); background: rgba(0,0,0,.06); }

/* ── progress bar ── */
.spp-progress {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(0,0,0,.07);
  border-radius: 0 0 var(--spp-radius) var(--spp-radius);
  overflow: hidden;
}

.spp-progress-bar {
  height: 100%;
  width: 100%;
  background: var(--spp-progress-color);
  border-radius: 0 0 var(--spp-radius) var(--spp-radius);
}

/* ── responsive ── */
@media (max-width: 480px) {
  #spp-container {
    padding: 10px;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    display: flex;
    justify-content: center;
  }
  #spp-container.spp-pos-top-left,
  #spp-container.spp-pos-top-right { top: 0 !important; bottom: auto !important; }
  .spp-card { border-radius: 10px; }
}

/* ── dark mode ── */
@media (prefers-color-scheme: dark) {
  #spp-container {
    --spp-bg:     #1f2937;
    --spp-text:   #f9fafb;
    --spp-sub:    #9ca3af;
    --spp-close:  #6b7280;
    --spp-shadow: 0 4px 24px rgba(0,0,0,.4), 0 1.5px 6px rgba(0,0,0,.25);
  }
  .spp-progress { background: rgba(255,255,255,.1); }
}
