/* ─────────────────────────────────────────────────────────────────────────────
   KICC live tab
   Ported from the exhibition repo's design system (apps/web/src/app/globals.css
   + tailwind.config.ts): tokens, .glass, .gradient-border, .card, .chip,
   .live-dot, .ticker-track. Component behaviour from BoothCard.tsx, LiveTicker.tsx
   and GoLivePopup.tsx, reimplemented for Blade + vanilla JS.
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  /* surfaces */
  --bg:            #070b14;
  --bg-panel:      rgba(13, 20, 36, 0.55);
  --bg-panel-solid:#0d1424;
  --border:        rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.28);

  /* text */
  --text:      #e8edf7;
  --text-dim:  rgba(200, 212, 232, 0.66);

  /* ink scale (tailwind ink.*) */
  --ink-950: #0a0a0f;
  --ink-900: #0f0f17;
  --ink-850: #131320;
  --ink-800: #181828;

  /* accents */
  --accent-a: #0ea5e9;
  --accent-b: #f59e0b;
  --accent-c: #16a34a;
  --glow:     rgba(14, 165, 233, 0.45);
  --live:     #ef4444;

  --radius: 1rem;
  --radius-lg: 1.25rem;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Accent themes — operator-selectable from admin. */
[data-accent="amber"]  { --accent-a:#f59e0b; --accent-b:#f97316; --accent-c:#eab308; --glow:rgba(245,158,11,.45); }
[data-accent="green"]  { --accent-a:#16a34a; --accent-b:#0ea5e9; --accent-c:#84cc16; --glow:rgba(22,163,74,.42); }
[data-accent="violet"] { --accent-a:#7c3aed; --accent-b:#ec4899; --accent-c:#06b6d4; --glow:rgba(124,58,237,.45); }

.live-shell { color: var(--text); font-family: var(--font-sans); }
.live-shell * { box-sizing: border-box; }

.live-wrap { width: min(1240px, 100% - 2.5rem); margin-inline: auto; }
.live-section { padding: 3.25rem 0 0; }
.live-dim { color: var(--text-dim); }
.live-hint { font-size: .82rem; color: var(--text-dim); margin-top: .5rem; }

/* ── hero ─────────────────────────────────────────────────────────────────── */
.live-hero {
  position: relative;
  margin-top: 4.25rem;
  padding: 4.5rem 0 3rem;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg);
}
.live-hero::after {
  content: '';
  position: absolute; inset: 0; z-index: -2;
  background-image: var(--live-banner, none);
  background-size: cover; background-position: center;
  opacity: .34;
}
.live-hero-veil {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(1000px 460px at 12% -10%, color-mix(in srgb, var(--accent-a) 30%, transparent), transparent 62%),
    linear-gradient(180deg, rgba(7,11,20,.62) 0%, rgba(7,11,20,.9) 62%, var(--bg) 100%);
}
.live-eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .78rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent-b); margin: 0 0 .85rem;
}
.live-title {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  line-height: 1.04; letter-spacing: -.03em; font-weight: 700;
  margin: 0 0 .9rem; max-width: 18ch;
}
.live-lead { color: var(--text-dim); font-size: clamp(.98rem, 2.4vw, 1.12rem); max-width: 62ch; margin: 0; }

.live-stats { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.75rem; }
.live-stat {
  min-width: 108px; padding: .7rem 1rem; border-radius: .85rem;
  background: var(--bg-panel); border: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.live-stat b { display: block; font-family: var(--font-display); font-size: 1.35rem; line-height: 1.1; }
.live-stat span { font-size: .72rem; text-transform: uppercase; letter-spacing: .11em; color: var(--text-dim); }

/* ── live dot (1.6s ease-out pulse, from globals.css) ─────────────────────── */
.live-dot {
  width: .5rem; height: .5rem; border-radius: 999px; background: var(--live);
  box-shadow: 0 0 0 0 rgba(239,68,68,.6);
  animation: live-pulse 1.6s ease-out infinite;
  flex: 0 0 auto;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(239,68,68,.65); opacity: 1; }
  70%  { box-shadow: 0 0 0 9px rgba(239,68,68,0);  opacity: .78; }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0);   opacity: 1; }
}

/* ── ticker (LiveTicker.tsx — doubled marquee, hover pauses) ──────────────── */
.live-ticker {
  position: relative; z-index: 20; overflow: hidden;
  border-block: 1px solid var(--border);
  background: rgba(0,0,0,.42);
  padding: .55rem 0;
}
.ticker-track {
  display: flex; width: max-content;
  animation: marquee var(--ticker-duration, 36s) linear infinite;
}
.live-ticker:hover .ticker-track,
.live-ticker:focus-within .ticker-track { animation-play-state: paused; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.ticker-item {
  display: inline-flex; align-items: center; gap: .55rem;
  margin-inline: 1.5rem; white-space: nowrap;
  font-size: .87rem; color: var(--text-dim); text-decoration: none;
  transition: color .2s ease;
}
.ticker-item:hover, .ticker-item:focus-visible { color: #fff; }
.ticker-item b { color: #fff; font-weight: 600; }
.ticker-item span:last-child { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; }

/* moving marquees are decorative motion — honour the OS setting */
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
  .live-dot { animation: none; }
  .live-card { transition: none; }
}

/* ── section headings ─────────────────────────────────────────────────────── */
.live-section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.15rem;
}
.live-h2 {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--font-display); font-size: clamp(1.15rem, 3vw, 1.5rem);
  font-weight: 600; letter-spacing: -.015em; margin: 0;
}

/* ── featured player ──────────────────────────────────────────────────────── */
.live-feature {
  display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); gap: 1.25rem;
  padding: 1.1rem; border-radius: var(--radius-lg);
  background: var(--bg-panel); border: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
@media (max-width: 900px) { .live-feature { grid-template-columns: 1fr; } }

.live-player {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: .85rem; background: #000;
}
.live-player .live-video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.live-player-empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  padding: 1.5rem; text-align: center; color: var(--text-dim);
  background: linear-gradient(135deg, rgba(14,165,233,.12), rgba(13,20,36,.7));
}
.live-feature-body { display: flex; flex-direction: column; gap: .5rem; align-content: start; }
.live-feature-body h3 {
  font-family: var(--font-display); font-size: 1.25rem; margin: 0; letter-spacing: -.01em;
}
.live-feature-body p { margin: 0; font-size: .92rem; line-height: 1.6; }

/* ── card grid ────────────────────────────────────────────────────────────── */
.live-grid {
  display: grid; gap: 1.15rem;
  grid-template-columns: repeat(auto-fill, minmax(276px, 1fr));
}
.live-empty {
  grid-column: 1 / -1; margin: 0; padding: 2rem 1.25rem;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  color: var(--text-dim); text-align: center;
  background: rgba(13,20,36,.35);
}

/* ── card (BoothCard.tsx — 3D tilt + cursor-tracking glow) ────────────────── */
.live-card {
  position: relative; display: block; overflow: hidden;
  border-radius: var(--radius-lg); text-decoration: none; color: inherit;
  background: var(--bg-panel); border: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  transform-style: preserve-3d;
  transition: transform .22s ease, box-shadow .28s ease, border-color .28s ease;
  will-change: transform;
}
.live-card:hover, .live-card:focus-visible {
  border-color: color-mix(in srgb, var(--accent-a) 55%, transparent);
  box-shadow: 0 16px 48px -12px rgba(0,0,0,.65), 0 0 26px -8px var(--glow);
}
.live-card:focus-visible { outline: 2px solid var(--accent-a); outline-offset: 3px; }
.live-card[aria-disabled="true"] { cursor: default; }

/* glow that follows the cursor (radial-gradient at --gx/--gy) */
.live-card-glow {
  position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0;
  background: radial-gradient(500px circle at var(--gx,50%) var(--gy,50%), var(--glow), transparent 60%);
  transition: opacity .3s ease;
}
.live-card:hover .live-card-glow { opacity: .5; }

.live-card-media {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--ink-900);
}
.live-card-media img,
.live-card-media video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .55s ease;
}
.live-card:hover .live-card-media img { transform: scale(1.06); }
.live-card-placeholder {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 70% at 30% 25%, color-mix(in srgb, var(--accent-a) 26%, transparent), transparent 70%),
    linear-gradient(140deg, var(--ink-850), var(--ink-950));
}

.live-badge {
  position: absolute; top: .6rem; left: .6rem; z-index: 4;
  display: inline-flex; align-items: center; gap: .38rem;
  padding: .2rem .5rem; border-radius: .42rem;
  background: var(--live); color: #fff;
  font-size: .68rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  box-shadow: 0 6px 18px -6px rgba(239,68,68,.8);
}
.live-badge .live-dot { background: #fff; }
.live-badge-replay { background: rgba(148,163,184,.88); color: #0a0a0f; }
.live-badge-soon   { background: rgba(14,165,233,.9); color: #04121d; }

.live-price {
  position: absolute; top: .6rem; right: .6rem; z-index: 4;
  padding: .2rem .5rem; border-radius: .42rem;
  background: rgba(0,0,0,.72); color: var(--accent-b);
  font-size: .68rem; font-weight: 700;
}
.live-hosttype {
  position: absolute; bottom: .6rem; right: .6rem; z-index: 4;
  padding: .16rem .44rem; border-radius: .38rem;
  background: rgba(0,0,0,.62); color: rgba(255,255,255,.86);
  font-size: .6rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
}

.live-card-body { display: flex; align-items: flex-start; gap: .7rem; padding: .9rem 1rem 1rem; }
.live-avatar {
  width: 2.6rem; height: 2.6rem; flex: 0 0 auto; border-radius: .75rem;
  border: 1px solid var(--border); background: var(--ink-850);
  display: grid; place-items: center; overflow: hidden;
  font-family: var(--font-display); font-weight: 700; font-size: .9rem; color: var(--text-dim);
}
.live-avatar img { width: 100%; height: 100%; object-fit: cover; }
.live-card-text { min-width: 0; flex: 1 1 auto; }
.live-card-text h3 {
  margin: 0 0 .15rem; font-family: var(--font-display); font-size: 1rem; font-weight: 600;
  letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.live-card-text .live-host {
  margin: 0; font-size: .82rem; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.live-verified { color: var(--accent-b); font-size: .8rem; margin-left: .25rem; }
.live-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  margin-top: .55rem; font-size: .74rem; color: var(--text-dim);
}

/* ── chips / buttons / inputs ─────────────────────────────────────────────── */
.live-chip {
  display: inline-flex; align-items: center;
  padding: .18rem .55rem; border-radius: 999px;
  font-size: .68rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  background: var(--bg-panel); border: 1px solid var(--border); color: var(--text-dim);
}
.live-btn, .live-btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: .48rem;
  padding: .68rem 1.3rem; border-radius: 999px; border: 1px solid transparent;
  font-family: var(--font-display); font-size: .9rem; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: all .2s ease;
}
.live-btn-primary {
  background: linear-gradient(135deg, var(--accent-a), var(--accent-c));
  color: #04121d; box-shadow: 0 4px 24px -6px var(--glow);
}
.live-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 32px -6px var(--glow); filter: brightness(1.08); }
.live-btn-primary:active { transform: translateY(0); }
.live-btn {
  background: var(--bg-panel); border-color: var(--border); color: var(--text);
}
.live-btn:hover { border-color: var(--accent-a); box-shadow: 0 0 18px -4px var(--glow); }
.live-btn-mini { padding: .34rem .7rem; font-size: .75rem; }

.live-input {
  width: 100%; padding: .62rem .85rem; border-radius: .7rem;
  background: var(--bg-panel); border: 1px solid var(--border);
  color: var(--text); font: inherit; font-size: .9rem;
}
.live-input:focus { outline: none; border-color: var(--accent-a); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-a) 22%, transparent); }
.live-input::placeholder { color: var(--text-dim); }
.live-input-mini { padding: .32rem .5rem; font-size: .8rem; }
select.live-input { cursor: pointer; }
select.live-input option { background: var(--bg-panel-solid); color: var(--text); }

.live-field { display: flex; flex-direction: column; gap: .35rem; }
.live-field + .live-field { margin-top: .9rem; }
.live-label { font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); }

.live-errors {
  margin: 0 0 1.25rem; padding: .85rem 1rem; border-radius: .7rem;
  background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.42); color: #fecaca;
  font-size: .88rem;
}
.live-ok {
  margin: 0 0 1.25rem; padding: .85rem 1rem; border-radius: .7rem;
  background: rgba(22,163,74,.12); border: 1px solid rgba(22,163,74,.42); color: #bbf7d0;
  font-size: .88rem;
}

/* ── admin panels / table ─────────────────────────────────────────────────── */
.live-panel {
  margin-top: 1.5rem; padding: 1.35rem; border-radius: var(--radius-lg);
  background: var(--bg-panel); border: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.live-panel > h2 {
  font-family: var(--font-display); font-size: 1.08rem; margin: 0 0 1.05rem; letter-spacing: -.01em;
}
.live-cols { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.live-table { margin-top: 1rem; overflow-x: auto; border-radius: .85rem; border: 1px solid var(--border); }
.live-table table { width: 100%; border-collapse: collapse; font-size: .84rem; min-width: 880px; }
.live-table th {
  text-align: left; padding: .7rem .75rem; white-space: nowrap;
  background: rgba(10,10,15,.72); color: var(--text-dim);
  font-size: .7rem; letter-spacing: .09em; text-transform: uppercase; font-weight: 700;
}
.live-table td { padding: .6rem .75rem; border-top: 1px solid var(--border); vertical-align: middle; }
.live-table tr:hover td { background: rgba(255,255,255,.022); }
.live-state { display: inline-flex; align-items: center; gap: .4rem; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.live-state-live { color: #fca5a5; }
.live-state-idle { color: var(--accent-b); }
.live-state-ended { color: var(--text-dim); }
.live-row-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.live-inline { display: flex; gap: .35rem; align-items: center; }

/* ── go-live toast (GoLivePopup.tsx, spring-in) ───────────────────────────── */
.live-toast {
  position: fixed; right: 1rem; bottom: 6rem; z-index: 1000;
  display: flex; align-items: center; gap: .7rem;
  padding: .85rem 1.1rem; border-radius: var(--radius);
  background: var(--bg-panel-solid); border: 1px solid var(--border-strong);
  box-shadow: 0 18px 46px -14px rgba(0,0,0,.8);
  animation: toast-in .42s cubic-bezier(.22,1.2,.36,1) both;
}
.live-toast p { margin: 0; font-size: .86rem; }
.live-toast .live-toast-name { font-weight: 700; color: #fff; }
@media (max-width: 640px) { .live-toast { right: .75rem; left: .75rem; bottom: 5rem; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(42px) scale(.94); } to { opacity: 1; transform: none; } }

/* ── admin-only primitives (danger / warn actions, backdrop preview) ──────── */
.live-btn-danger {
  background: rgba(239,68,68,.14); border-color: rgba(239,68,68,.45); color: #fecaca;
}
.live-btn-danger:hover { border-color: #ef4444; box-shadow: 0 0 18px -4px rgba(239,68,68,.5); }
.live-btn-warn {
  background: rgba(245,158,11,.14); border-color: rgba(245,158,11,.45); color: #fde68a;
}
.live-btn-warn:hover { border-color: var(--accent-b); box-shadow: 0 0 18px -4px rgba(245,158,11,.5); }
.live-banner-preview {
  margin-bottom: .85rem; border-radius: .85rem; overflow: hidden;
  border: 1px solid var(--border); background: var(--ink-900);
}
.live-banner-preview img { display: block; width: 100%; max-height: 260px; object-fit: cover; }

/* ── sub-tab rail ────────────────────────────────────────────────────────────
   The rail that carries the sections owned by the Live tab: page control and
   broadcasts, booths, monitor, analytics, screens. Before this existed those
   sections were separate pages on their own layouts with no link anywhere.
   ────────────────────────────────────────────────────────────────────────── */
.live-subnav {
  position: sticky; top: 4.4rem; z-index: 30;
  display: flex; gap: .35rem; align-items: center;
  margin: 1.6rem 0 0; padding: .45rem;
  width: fit-content; max-width: 100%;
  overflow-x: auto; scrollbar-width: none;
  border-radius: 999px;
  background: var(--bg-panel); border: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.live-subnav::-webkit-scrollbar { display: none; }
.live-subnav a {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem .95rem; border-radius: 999px;
  font-size: .83rem; font-weight: 600; letter-spacing: .01em;
  color: var(--text-dim); text-decoration: none; white-space: nowrap;
  transition: color .2s ease, background .2s ease;
}
.live-subnav a:hover { color: var(--text); background: rgba(255,255,255,.05); }
.live-subnav a:focus-visible { outline: 2px solid var(--accent-a); outline-offset: 2px; }
.live-subnav a[aria-current="page"] {
  color: #06121f;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-c));
  box-shadow: 0 6px 22px -8px var(--glow);
}
.live-subnav-n {
  font-size: .7rem; line-height: 1; padding: .22rem .45rem; border-radius: 999px;
  background: rgba(255,255,255,.12);
}
.live-subnav a[aria-current="page"] .live-subnav-n { background: rgba(0,0,0,.22); }
@media (max-width: 720px) {
  .live-subnav { top: 3.4rem; border-radius: 1rem; }
  .live-subnav a { padding: .45rem .7rem; font-size: .78rem; }
}

/* stat row reused by the in-tab sections */
.live-stat-row { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 1.4rem 0 0; }
.live-stat-row .live-stat { min-width: 0; }
.live-stat-row .live-stat b { font-size: 1.6rem; }

/* heartbeat / health pills */
.live-hb { display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; font-weight: 600; }
.live-hb-dot { width: .5rem; height: .5rem; border-radius: 999px; flex: 0 0 auto; }
.live-hb-healthy .live-hb-dot { background: #22c55e; }
.live-hb-warning .live-hb-dot { background: #f59e0b; }
.live-hb-dead    .live-hb-dot { background: #ef4444; }
.live-hb-unknown .live-hb-dot { background: #64748b; }
.live-hb-healthy { color: #86efac; }
.live-hb-warning { color: #fcd34d; }
.live-hb-dead    { color: #fca5a5; }
.live-hb-unknown { color: var(--text-dim); }

/* per-section anchor block so deep links land under the sticky rail */
.live-anchor { scroll-margin-top: 7rem; }

/* source ledger — one row naming every live source the tab aggregates */
.live-sources { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.1rem 0 0; }
.live-source {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .7rem; border-radius: 999px;
  font-size: .74rem; font-weight: 600; letter-spacing: .02em;
  background: color-mix(in srgb, var(--accent-a) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-a) 34%, transparent);
  color: var(--text);
}
.live-source b {
  font-size: .72rem; padding: .05rem .4rem; border-radius: 999px;
  background: rgba(0,0,0,.28);
}
