/* ─────────────────────────────────────────────────────────────
   Patient Realm · Social-proof toast (bottom-left of the page)
   Designed to coexist with the chatbot FAB at bottom-right.
───────────────────────────────────────────────────────────── */

#enzo-social-proof-root {
    position: fixed;
    left: 22px;
    bottom: max(22px, env(safe-area-inset-bottom, 22px));
    z-index: 999998;          /* below the chatbot panel (999999) but above page chrome */
    pointer-events: none;     /* let the page receive clicks; the toast itself opts in */
    width: min(360px, calc(100vw - 44px));
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.enzo-sp-toast {
    pointer-events: auto;
    position: relative;
    display: grid;
    grid-template-columns: 44px 1fr;
    grid-gap: 12px;
    align-items: center;
    padding: 12px 14px 12px 12px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow:
        0 1px 0 rgba(26, 20, 18, 0.04),
        0 8px 22px -10px rgba(26, 20, 18, 0.18),
        0 22px 44px -22px rgba(224, 69, 123, 0.18);
    border: 1px solid rgba(26, 20, 18, 0.06);
    cursor: pointer;
    color: #1a1412;

    /* Modern fade-up + subtle scale. No slide. */
    opacity: 0;
    transform: translateY(10px) scale(0.97);
    transition:
        opacity .55s cubic-bezier(.22, .61, .36, 1),
        transform .55s cubic-bezier(.22, .61, .36, 1),
        box-shadow .25s ease;
    will-change: opacity, transform;
    backdrop-filter: saturate(140%);
}
.enzo-sp-toast.is-in  { opacity: 1; transform: translateY(0) scale(1); }
.enzo-sp-toast.is-out {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    transition:
        opacity .35s ease,
        transform .35s ease;
}

.enzo-sp-toast:hover {
    box-shadow:
        0 1px 0 rgba(26, 20, 18, 0.04),
        0 14px 32px -14px rgba(26, 20, 18, 0.24),
        0 28px 56px -22px rgba(224, 69, 123, 0.28);
    transform: translateY(-3px) scale(1);
}

/* Avatar + tone icon */
.enzo-sp-avatar {
    position: relative;
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-weight: 700; font-size: 17px;
    box-shadow: inset 0 -1px 0 rgba(0,0,0,0.08), 0 4px 10px -4px rgba(26, 20, 18, 0.18);
    flex-shrink: 0;
}
.enzo-sp-avatar-initial {
    line-height: 1;
}
.enzo-sp-icon {
    position: absolute;
    bottom: -3px; right: -4px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 11.5px;
    box-shadow: 0 2px 5px -2px rgba(26, 20, 18, 0.28);
}

/* Body */
.enzo-sp-body {
    min-width: 0; /* allow text truncation */
}
.enzo-sp-message {
    font-size: 13.5px;
    line-height: 1.42;
    color: #1a1412;
    margin: 0 14px 4px 0;       /* leave room for the close × */
    font-weight: 500;
    /* Collapse to 2 lines max */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.enzo-sp-message strong { color: #1a1412; font-weight: 700; }

.enzo-sp-meta {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px;
    color: #6b6460;
    line-height: 1.2;
}
.enzo-sp-sublabel {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 180px;
}
.enzo-sp-dot { opacity: .5; }
.enzo-sp-ago { font-variant-numeric: tabular-nums; }

/* "Live" badge for real signups */
.enzo-sp-real {
    display: inline-flex; align-items: center; gap: 3px;
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 999px;
    background: linear-gradient(135deg, #fee2e2, #fecdd3);
    color: #b91c1c;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    flex-shrink: 0;
    animation: enzo-sp-pulse 2.4s ease-in-out infinite;
}
@keyframes enzo-sp-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .55; }
}

/* Close button — generous tap target via padding (visible 22px, hit area ~32px) */
.enzo-sp-close {
    position: absolute;
    top: 4px; right: 5px;
    width: 28px; height: 28px;
    border: 0; background: transparent;
    color: rgba(26, 20, 18, 0.35);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    transition: color .12s, background .12s;
    padding: 0;
    display: flex; align-items: center; justify-content: center;
}
.enzo-sp-close:hover, .enzo-sp-close:focus-visible {
    color: #1a1412;
    background: rgba(26, 20, 18, 0.08);
    outline: none;
}

/* ─── Tablet (≥541 ≤900) — slightly tighter ─── */
@media (min-width: 541px) and (max-width: 900px) {
    #enzo-social-proof-root { left: 18px; bottom: max(18px, env(safe-area-inset-bottom, 18px)); width: min(340px, calc(100vw - 36px)); }
    .enzo-sp-toast { padding: 11px 14px 11px 12px; }
}

/* ─── Mobile (≤540) — full-width card, lifted above the chatbot FAB ─── */
@media (max-width: 540px) {
    #enzo-social-proof-root {
        left: 12px; right: 12px;
        bottom: calc(88px + env(safe-area-inset-bottom, 0px));   /* clear FAB + iOS home bar */
        width: auto;
        max-width: none;
    }
    .enzo-sp-toast {
        padding: 11px 12px;
        grid-template-columns: 40px 1fr;
        grid-gap: 10px;
        border-radius: 13px;
    }
    .enzo-sp-avatar { width: 40px; height: 40px; font-size: 16px; }
    .enzo-sp-icon { width: 18px; height: 18px; font-size: 10.5px; bottom: -2px; right: -3px; }
    .enzo-sp-message { font-size: 13px; margin-right: 10px; }
    .enzo-sp-meta { font-size: 10.5px; gap: 5px; flex-wrap: wrap; row-gap: 3px; }
    .enzo-sp-sublabel { max-width: 130px; }
    .enzo-sp-real { font-size: 9.5px; padding: 2px 7px; }
    .enzo-sp-close { top: 2px; right: 2px; width: 32px; height: 32px; font-size: 20px; }
}

/* ─── Extra-narrow (≤360, e.g. older iPhone SE) ─── */
@media (max-width: 360px) {
    #enzo-social-proof-root { left: 8px; right: 8px; bottom: 80px; }
    .enzo-sp-toast { padding: 10px 11px; grid-template-columns: 36px 1fr; grid-gap: 9px; }
    .enzo-sp-avatar { width: 36px; height: 36px; font-size: 14.5px; }
    .enzo-sp-message { font-size: 12.5px; -webkit-line-clamp: 3; }
    .enzo-sp-real { display: none; }    /* badge hidden — color of avatar already conveys "live" */
    .enzo-sp-sublabel { max-width: 100px; }
}

/* ─── Logged-in WP admin bar shifts the page down ~32px on mobile ─── */
@media (max-width: 782px) {
    body.admin-bar #enzo-social-proof-root { /* no top shift; we're at the bottom */ }
}

/* ─── Landscape phone, very short viewports ─── */
@media (max-height: 480px) and (max-width: 900px) {
    #enzo-social-proof-root { bottom: 12px; }
    .enzo-sp-message { -webkit-line-clamp: 2; }
}

/* ─── Touch device — slightly larger tap surfaces ─── */
@media (hover: none) and (pointer: coarse) {
    .enzo-sp-close { width: 36px; height: 36px; }
    .enzo-sp-toast:hover { transform: none; }   /* don't trigger hover lift on touch */
}

/* Respect users who'd prefer no motion. */
@media (prefers-reduced-motion: reduce) {
    .enzo-sp-toast { transition: opacity .25s ease; transform: none !important; }
    .enzo-sp-toast.is-in  { opacity: 1; }
    .enzo-sp-toast.is-out { opacity: 0; }
    .enzo-sp-real { animation: none; }
}
