/* "SHOW IS LIVE" — reactive Command Index item, sticky-bar chip, live toast, and the
   in-app Live view (#live). Uses the shared theme tokens from support.css. */

:root {
    --live-red: #ff3d4d;
    --live-red-soft: rgba(255, 61, 77, 0.16);
    --live-red-border: rgba(255, 61, 77, 0.55);
}

/* ------------------------------------------------------------------ */
/* Command Index reactive "Live Now" item (desktop nav + mobile drawer) */
/* ------------------------------------------------------------------ */

.support-nav-live {
    /* Override the nav-link accent (left bar, inset glow, corner) from blue to red. */
    --nav-accent: var(--live-red);
    --nav-accent-rgb: 255, 61, 77;
    position: relative;
    border-color: var(--live-red-border) !important;
    background: linear-gradient(135deg, var(--live-red-soft), rgba(5, 15, 31, 0.6)) !important;
    box-shadow: inset 3px 0 0 rgba(255, 61, 77, 0.6);
    animation: liveNavPulse 2.2s ease-in-out infinite;
}

.support-nav-live:hover,
.support-nav-live.active {
    border-color: var(--live-red) !important;
}

.support-nav-live > span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #ffe4e6;
}

.nav-live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--live-red);
    box-shadow: 0 0 8px var(--live-red);
    animation: liveDotPulse 1.4s ease-in-out infinite;
    flex: none;
}

@keyframes liveNavPulse {
    0%, 100% { box-shadow: 0 0 0 rgba(255, 61, 77, 0); }
    50% { box-shadow: 0 0 22px rgba(255, 61, 77, 0.45); }
}

@keyframes liveDotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.55; transform: scale(0.82); }
}

/* Little pulsing dot on the collapsed mobile menu toggle when live */
.support-mobile-command-menu.has-live .support-mobile-command-toggle::after {
    content: "";
    position: absolute;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--live-red);
    box-shadow: 0 0 10px var(--live-red);
    animation: liveDotPulse 1.4s ease-in-out infinite;
}

/* ------------------------------------------------------------------ */
/* Sticky-bar LIVE / Standby pill (replaces the brand title line)      */
/* ------------------------------------------------------------------ */

/* Center the brand card contents (kicker, LIVE/Standby pill, Sync line). */
#support-sticky-user-bar .sticky-brand { justify-items: center; text-align: center; }

.sticky-brand-live { min-width: 0; margin: 1px 0; display: flex; justify-content: center; }

.sticky-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--live-red-border);
    background: var(--live-red-soft);
    color: #ffe4e6;
    font-size: 10.5px;
    font-weight: 950;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    width: fit-content;
    line-height: 1.35;
    transition: border-color 140ms ease, background 140ms ease;
}

a.sticky-live-pill.live:hover {
    border-color: var(--live-red);
    background: rgba(255, 61, 77, 0.24);
}

.sticky-live-pill.standby {
    border-color: var(--border);
    background: rgba(126, 223, 255, 0.06);
    color: var(--muted);
}

.sticky-live-pill.standby .sticky-live-dot {
    background: var(--soft);
    box-shadow: none;
    animation: none;
}

.sticky-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--live-red);
    box-shadow: 0 0 8px var(--live-red);
    animation: liveDotPulse 1.4s ease-in-out infinite;
}

.sticky-live-count {
    color: #fff;
    opacity: 0.85;
    letter-spacing: 0.02em;
}

/* ------------------------------------------------------------------ */
/* "The show is live" toast                                            */
/* ------------------------------------------------------------------ */

.live-toast {
    position: fixed;
    right: 24px;
    top: 112px;
    width: min(390px, calc(100vw - 32px));
    z-index: 10020;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--live-red-border);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(10, 24, 42, 0.98), rgba(42, 12, 18, 0.96));
    box-shadow: 0 0 36px rgba(255, 61, 77, 0.3), 0 18px 36px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    transform: translateY(-10px) scale(0.98);
    opacity: 0;
    animation: liveToastIn 520ms ease-out forwards, liveToastOut 520ms ease-in 8.1s forwards;
}

.live-toast:hover,
.live-toast:focus-visible {
    border-color: var(--live-red);
    box-shadow: 0 0 42px rgba(255, 61, 77, 0.4), 0 18px 40px rgba(0, 0, 0, 0.52);
    outline: none;
}

.live-toast-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    border: 1px solid var(--live-red-border);
    background: var(--live-red-soft);
}

.live-toast-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--live-red);
    box-shadow: 0 0 14px var(--live-red);
    animation: liveDotPulse 1.4s ease-in-out infinite;
}

.live-toast-kicker {
    color: var(--live-red);
    font-size: 10px;
    font-weight: 950;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.live-toast-title {
    margin-top: 3px;
    color: var(--text);
    font-size: 19px;
    font-weight: 950;
}

.live-toast-sub {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

@keyframes liveToastIn { to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes liveToastOut { to { opacity: 0; transform: translateY(-8px) scale(0.985); } }

/* ------------------------------------------------------------------ */
/* Live view (#live)                                                   */
/* ------------------------------------------------------------------ */

.live-hero {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--panel);
    padding: 14px 20px;
    margin-bottom: 18px;
}

/* Live: compact horizontal band — title on the left, stat pills on the right. */
.live-hero.is-live {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 20px;
    border-color: var(--live-red-border);
    background: linear-gradient(135deg, var(--live-red-soft), var(--panel));
}

.live-hero-status {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 950;
    letter-spacing: 0.04em;
    color: var(--text);
}

.live-hero-dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--live-red);
    box-shadow: 0 0 12px var(--live-red);
    animation: liveDotPulse 1.4s ease-in-out infinite;
}

.live-hero-dot.offline {
    background: var(--soft);
    box-shadow: none;
    animation: none;
}

.live-hero-copy { color: var(--muted); line-height: 1.5; margin: 10px 0 0; }

.live-hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Each stat is its own compact pill/card. */
.live-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 96px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel-2);
}

.live-stat[data-stat="livefor"] .live-stat-value { font-variant-numeric: tabular-nums; }
.live-stat-value { font-size: 21px; font-weight: 950; color: var(--accent); line-height: 1; white-space: nowrap; }
.live-stat-label { font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--soft); white-space: nowrap; }

.live-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.live-tile {
    --tile-accent: var(--accent);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--panel-2);
    padding: 16px;
}

.live-tile.is-live { border-color: color-mix(in srgb, var(--tile-accent) 55%, transparent); }
/* Offline tiles read as calm via the greyed strip + OFFLINE thumb — no blanket opacity,
   so the strip can fully highlight the platform color on hover. */

.live-tile.twitch { --tile-accent: var(--twitch); }
.live-tile.youtube { --tile-accent: var(--youtube); }
.live-tile.kick { --tile-accent: var(--kick); }
.live-tile.rumble { --tile-accent: var(--rumble); }
.live-tile.facebook { --tile-accent: var(--facebook); }

.live-tile-thumb {
    position: relative;
    margin: -16px -16px 0;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #04060c;
    border-bottom: 1px solid color-mix(in srgb, var(--tile-accent) 45%, transparent);
}

.live-tile-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Placeholder box (offline, or live with no preview) — black box with a centered label,
   like the Broadcaster Console embedded players. */
.live-tile-thumb.placeholder { display: grid; place-items: center; }
.live-tile-thumb.placeholder span {
    color: var(--soft);
    font-weight: 950;
    letter-spacing: 0.22em;
    font-size: 13px;
    text-transform: uppercase;
}
.live-tile-thumb.placeholder.live span { color: color-mix(in srgb, var(--tile-accent), white 42%); }

.live-tile-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 950;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1px solid var(--live-red-border);
    background: rgba(10, 6, 10, 0.7);
    color: #ffe4e6;
}

.live-tile-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--live-red);
    box-shadow: 0 0 7px var(--live-red);
    animation: liveDotPulse 1.4s ease-in-out infinite;
}

/* Full-width platform strip: platform-color border, icon + name centered in platform color. */
.live-tile-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid color-mix(in srgb, var(--tile-accent), white 20%);
    border-radius: 10px;
    background: color-mix(in srgb, var(--tile-accent) 12%, transparent);
    color: color-mix(in srgb, var(--tile-accent), white 45%);
    text-decoration: none;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.live-tile-strip:hover {
    background: color-mix(in srgb, var(--tile-accent) 24%, transparent);
    border-color: color-mix(in srgb, var(--tile-accent), white 34%);
    color: color-mix(in srgb, var(--tile-accent), white 64%);
}

/* Offline: greyed by default, highlights the platform color on hover. */
.live-tile.is-offline .live-tile-strip {
    border-color: var(--border);
    background: transparent;
    color: var(--muted);
}

.live-tile.is-offline .live-tile-strip:hover {
    border-color: color-mix(in srgb, var(--tile-accent), white 20%);
    background: color-mix(in srgb, var(--tile-accent) 14%, transparent);
    color: color-mix(in srgb, var(--tile-accent), white 48%);
}

.live-tile-strip img { width: 18px; height: 18px; object-fit: contain; }
.live-tile-name { font-size: 15px; font-weight: 900; }

.live-tile-title {
    font-size: 13px;
    color: var(--text);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.live-tile-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    font-weight: 800;
    color: color-mix(in srgb, var(--tile-accent), white 40%);
}

.live-tile-meta .live-tile-runtime { font-variant-numeric: tabular-nums; }

/* Matches the platform-pill treatment: platform-color border, faded platform-color
   fill, platform-color text. */
@media (max-width: 760px) {
    .live-toast { top: 134px; right: 9px; left: 9px; width: auto; }

    /* Keep the stat cards on ONE row instead of wrapping across two — equal-width cards
       that shrink to fit (including the seconds-precision "Live For" timer). */
    .live-hero-stats { flex-wrap: nowrap; width: 100%; gap: 8px; }
    .live-stat { flex: 1 1 0; min-width: 0; padding: 8px 5px; }
    .live-stat-value { font-size: 15px; }
    .live-stat-label { font-size: 9px; letter-spacing: 0.04em; }

    .live-tiles { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 460px) {
    .live-tiles { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .support-nav-live,
    .nav-live-dot,
    .sticky-live-dot,
    .live-hero-dot,
    .live-tile-dot,
    .live-toast-dot,
    .support-mobile-command-menu.has-live .support-mobile-command-toggle::after {
        animation: none !important;
    }
    .live-toast { animation: liveToastIn 1ms linear forwards; opacity: 1; transform: none; }
}
