/* =====================================================================
 *  Live Signups floating widget
 *
 *  A small persistent ticker pinned to the bottom-left of the viewport
 *  on public marketing pages. Listens for the same Socket.IO event
 *  the /globe page uses, with the same queue / 8-second auto-expire /
 *  glass-morphism aesthetic. Has a dismiss button that hides it for
 *  24 hours via localStorage.
 *
 *  Visibility rules (enforced in base.html):
 *    - Hidden when current_user.is_authenticated
 *    - Hidden on /globe and /live-map (those pages have a built-in
 *      ticker; we'd just be duplicating it)
 *    - Hidden on /admin/* (internal tool, not marketing)
 *    - Hidden on /maintenance
 *
 *  Hidden on mobile via the media query at the bottom of this file.
 * ===================================================================== */

.lsw {
    position: fixed;
    bottom: 1.25rem;
    left: 1.25rem;
    width: 320px;
    z-index: 60;             /* above page content, below modals/dropdowns */

    background: linear-gradient(135deg, rgba(10, 14, 23, 0.85), rgba(15, 22, 40, 0.85));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 212, 255, 0.20);
    border-radius: 14px;
    padding: 1rem 1.1rem 1rem 1.1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.40),
                0 0 0 1px rgba(255, 255, 255, 0.02) inset,
                0 0 40px rgba(0, 212, 255, 0.08);

    color: #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;

    transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.4s ease;
    overflow: hidden;
}

/* Hidden state — controlled by JS when user dismisses */
.lsw.is-dismissed { display: none; }

/* Collapsed "header only" state when no live signups are visible. */
.lsw.is-empty {
    width: fit-content;
    padding: 0.6rem 1rem;
}
.lsw.is-empty .lsw-close {
    display: none;       /* nothing to dismiss when empty; rejoin via reload */
}

/* ===== Header ===== */
.lsw-header {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.7rem;
    transition: margin-bottom 0.4s ease;
}
.lsw.is-empty .lsw-header { margin-bottom: 0; }

.lsw-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e, 0 0 16px rgba(34, 197, 94, 0.55);
    animation: lsw-pulse 2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes lsw-pulse {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%      { transform: scale(1.4); opacity: 0.4; }
}

.lsw-title {
    /* Title case per user request — NOT text-transform: uppercase */
    font-size: 0.88rem;
    font-weight: 600;
    color: #00d4ff;
    letter-spacing: 0.01em;
    line-height: 1.1;
}

/* ===== Dismiss button ===== */
.lsw-close {
    position: absolute;
    top: 0.45rem;
    right: 0.55rem;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: 0;
    color: rgba(148, 163, 184, 0.55);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    transition: color 0.2s ease, background 0.2s ease;
}
.lsw-close:hover,
.lsw-close:focus-visible {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.06);
    outline: none;
}

/* ===== Row list ===== */
.lsw-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 80px;
    transition: min-height 0.4s ease, gap 0.4s ease;
}
.lsw.is-empty .lsw-list {
    min-height: 0;
    gap: 0;
    overflow: hidden;
}

/* ===== Individual row ===== */
.lsw-row {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 0.7rem;
    align-items: flex-start;
    padding: 0.55rem 0.7rem;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.08), rgba(99, 102, 241, 0.05));
    border: 1px solid rgba(0, 212, 255, 0.20);
    animation: lsw-row-enter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    overflow: hidden;
    position: relative;
}
.lsw-row::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.15), transparent);
    animation: lsw-shine 1.3s ease-out forwards;
}
@keyframes lsw-row-enter {
    0%   { opacity: 0; transform: translateX(-22px) scale(0.92); }
    60%  { opacity: 1; transform: translateX(4px)   scale(1.02); }
    100% { opacity: 1; transform: translateX(0)     scale(1);    }
}
@keyframes lsw-shine {
    to { left: 100%; }
}
.lsw-row.exiting {
    animation: lsw-row-exit 0.4s ease-in forwards;
}
@keyframes lsw-row-exit {
    to {
        opacity: 0;
        transform: translateX(-18px) scale(0.86);
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-top: -8px;
    }
}

.lsw-flag {
    position: relative;
    width: 28px;
    height: 21px;
    flex-shrink: 0;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.3),
                0 0 10px rgba(0, 212, 255, 0.35);
    background: rgba(255, 255, 255, 0.05);
}
.lsw-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.lsw-flag::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.lsw-text {
    flex: 1;
    line-height: 1.35;
    min-width: 0;       /* allow text-overflow to work */
}
.lsw-headline {
    color: #e2e8f0;
    font-size: 0.84rem;
    font-weight: 600;
}
.lsw-headline .lsw-joined {
    color: #00d4ff;
    font-weight: 700;
}
.lsw-location {
    color: #cbd5e1;
    font-size: 0.76rem;
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lsw-time {
    color: #94a3b8;
    font-family: "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.66rem;
    margin-top: 2px;
    letter-spacing: 0.02em;
}

/* Hide on mobile — per user direction (#2). Marketing CTAs and forms
 * are tight on small screens; a floating widget would cover them. */
@media (max-width: 540px) {
    .lsw { display: none !important; }
}
