/* ============================================================
   live.css — Layout & structural styles for live event pages
   Colour theming comes entirely from global.css (orange/white).
   ============================================================ */

/* ── Page background ─────────────────────────────────────── */
body.live-page {
  background: linear-gradient(160deg, #1a0800 0%, #6b2400 75%, #c04a10 100%) fixed;
}

/* ── Page layout ──────────────────────────────────────────── */
body.live-page > header { display: none !important; }
body.live-page main.container {
  max-width: 1160px !important;
  margin: 0 auto !important;
  padding: 20px !important;
}

/* Container that wraps the event card */
#fullscreenContainer {
  max-width: 1100px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
}

/* Live Rider Dashboard layout */
.live-dash.modern { margin: 0 0 16px; }
.live-dash.modern .live-dash-head { padding: 12px 14px 8px !important; }
.live-dash.modern .live-dash-grid {
  gap: 10px !important;
  padding: 0 14px 8px !important;
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
}
.live-dash.modern .live-dash-title { font-size: 18px; letter-spacing: .01em; }
.live-dash.modern .live-dash-pill {
  border-radius: 8px;
  padding: 12px 13px !important;
}
.live-dash.modern .live-dash-pill .k {
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: 11px;
}
.live-dash.modern .live-dash-track {
  border-radius: 999px;
  overflow: hidden;
  height: 13px;
}
.live-dash.modern .live-dash-fill {
  height: 100% !important;
  display: block;
  border-radius: 999px;
  min-width: 0;
  transition: width .35s ease;
}
.live-dash.modern .live-dash-fill.live-dash-fill-green {
  background: #39ff14 !important;
  box-shadow: 0 0 10px rgba(57,255,20,.82), 0 0 22px rgba(57,255,20,.56);
}
.live-dash.modern .live-dash-fill.live-dash-fill-orange {
  background: #ff9f1a !important;
  box-shadow: 0 0 10px rgba(255,159,26,.84), 0 0 22px rgba(255,159,26,.58);
}
.live-dash.modern .live-dash-fill.live-dash-fill-red {
  background: #ff1744 !important;
  box-shadow: 0 0 10px rgba(255,23,68,.86), 0 0 22px rgba(255,23,68,.6);
}
.live-dash.modern .live-dash-labels {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 9px;
}
.live-dash.modern .live-dash-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
}
#myUpText {
  margin: 4px 0 8px !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  text-align: center !important;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
  body.live-page main.container { padding: 8px !important; }
  #fullscreenContainer { max-width: 100%; }
  .live-dash.modern .live-dash-grid { grid-template-columns: 1fr; }
}

/* ── Fullscreen mode ──────────────────────────────────────── */
body.fullscreen-mode { overflow: hidden; }

body.fullscreen-mode main,
body.fullscreen-mode main.container {
  max-width: 100vw !important;
  width: 100vw !important;
  padding: 0 !important;
  margin: 0 !important;
}

body.fullscreen-mode #fullscreenContainer,
body.fullscreen-mode #fullscreenContainer {
  position: fixed !important;
  top: 0 !important; left: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  min-width: 100vw !important;
  height: 100vh !important;
  z-index: 9999;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: row !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  background: #fff !important;
}

body.fullscreen-mode #liveEventCard {
  flex: 1;
  min-width: 0;
  width: 100% !important;
  max-width: none !important;
  overflow-y: auto;
  height: 100vh;
  margin: 0;
  border-radius: 0;
  padding-right: 0;
  background: #fff !important;
}

body.fullscreen-mode #liveEventCard .card-header {
  border-radius: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

body.fullscreen-mode #eventNameHeader { display: none; }

body.fullscreen-mode #liveEventCard .card-body,
body.fullscreen-mode .card { margin-right: 0; padding-right: 20px; }

body.fullscreen-mode .container,
body.fullscreen-mode [class*="container"] {
  max-width: none !important;
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin: 0 !important;
}

body.fullscreen-mode .em-tabs { display: none !important; }

body.fullscreen-mode .card,
body.fullscreen-mode .table-responsive,
body.fullscreen-mode table {
  width: 100%;
  max-width: none !important;
  box-sizing: border-box;
}

body.fullscreen-mode #sponsorBannerSection { display: none !important; }

body.fullscreen-mode #sponsorSidebar {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  flex-shrink: 0;
  order: 2;
  width: 220px;
  height: 100vh;
  background: #fff;
  border-left: 1px solid #f3f4f6;
  padding: 18px 12px;
  overflow-y: hidden;
}

body.fullscreen-mode .btn-print,
body.fullscreen-mode .btn-export,
body.fullscreen-mode button[onclick*="print"],
body.fullscreen-mode button[onclick*="Print"],
body.fullscreen-mode button[onclick*="export"],
body.fullscreen-mode button[onclick*="Export"],
body.fullscreen-mode a[onclick*="print"],
body.fullscreen-mode a[onclick*="Print"],
body.fullscreen-mode a[onclick*="export"],
body.fullscreen-mode a[onclick*="Export"],
body.fullscreen-mode #rrResultsExportBtn,
body.fullscreen-mode .no-print { display: none !important; }

/* Sponsor sidebar cells */
#sponsorSidebarWrap .sponsor-sidebar-cell {
  background: #fff;
  border: 1px solid #f3f4f6;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
#sponsorSidebarWrap .sponsor-sidebar-cell img {
  max-width: 100%;
  max-height: 60px;
  object-fit: contain;
  margin: 0 0 8px;
}
#sponsorSidebarWrap .sponsor-sidebar-cell .small {
  font-weight: 600;
  color: #6b7280;
  text-align: center;
  line-height: 1.05;
  font-size: 12px;
}

/* ── TV Scoreboard (fullscreen / scoreboard mode) ─────────── */
#tvScoreboard {
  display: none;
  flex-direction: column;
  background: #fff;
  border-bottom: 2px solid #ff6a1c;
}
body.fullscreen-mode #tvScoreboard { display: flex !important; }
body.fullscreen-mode .live-dash.modern { display: none !important; }

/* Schedule: scoreboard left 1/3, table right 2/3 */
body.fullscreen-mode #liveEventCard[data-view="schedule"] {
  display: grid !important;
  grid-template-columns: minmax(0,1fr) minmax(0,2fr);
  grid-template-rows: auto 1fr;
  height: 100vh;
  overflow: hidden;
}
body.fullscreen-mode #liveEventCard[data-view="schedule"] > .card-header { grid-column: 1 / -1; }
body.fullscreen-mode #liveEventCard[data-view="schedule"] > #tvScoreboard {
  grid-column: 1;
  grid-row: 2;
  display: flex !important;
  flex-direction: column;
  border-right: 1px solid #f3f4f6;
  overflow-y: hidden;
  align-self: stretch;
}
body.fullscreen-mode #liveEventCard[data-view="schedule"] .tv-main-grid { flex: 1; min-height: 0; }
body.fullscreen-mode #liveEventCard[data-view="schedule"] > #liveContent {
  grid-column: 2;
  grid-row: 2;
  overflow-y: auto;
  padding: 10px 14px;
  align-self: stretch;
}

/* Results / Payouts: no scoreboard */
body.fullscreen-mode #liveEventCard[data-view="results"] > #tvScoreboard,
body.fullscreen-mode #liveEventCard[data-view="payouts"] > #tvScoreboard { display: none !important; }
body.fullscreen-mode #liveEventCard[data-view="results"],
body.fullscreen-mode #liveEventCard[data-view="payouts"] {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
body.fullscreen-mode #liveEventCard[data-view="results"] > #liveContent,
body.fullscreen-mode #liveEventCard[data-view="payouts"] > #liveContent {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 14px;
}

/* Division columns grid */
body.fullscreen-mode #divisionsContainer {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px !important;
  align-items: start;
  padding: 4px 0;
}
body.fullscreen-mode #divisionsContainer.tv-grid { display: grid !important; gap: 10px; align-items: start; }

/* Fullscreen header controls */
body.fullscreen-mode #headerProfileBtn,
body.fullscreen-mode #headerChangeEventBtn { display: none !important; }
#tvHudControls { align-items: center; gap: 10px; }

/* F11 hint */
#f11HintBadge {
  display: none;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #c44400;
  letter-spacing: .05em;
  white-space: nowrap;
  padding: 4px 10px;
  background: #fff7ed;
  border: 1px solid rgba(255,106,28,.3);
  border-radius: 6px;
}
body.fullscreen-mode #f11HintBadge { display: inline-flex !important; }
body.fullscreen-mode:fullscreen #f11HintBadge,
body.fullscreen-mode:-webkit-full-screen #f11HintBadge,
body.fullscreen-mode:-moz-full-screen #f11HintBadge { display: none !important; }

/* TV top bar */
.tv-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 28px;
  background: #ff6a1c;
  border-bottom: none;
  font-size: clamp(12px, 1.2vw, 16px);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
}
.tv-event-name { color: #fff; }
.tv-progress-label { color: rgba(255,255,255,.80); }
.tv-hud-label {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,.75);
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tv-hud-input {
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.4);
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.tv-hud-page {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  letter-spacing: .04em;
  margin: 0 4px;
}

/* TV panels */
.tv-main-grid { display: grid; grid-template-columns: 3fr 2fr; }
.tv-panel {
  padding: clamp(10px,1.6vh,22px) clamp(14px,2.2vw,30px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tv-panel-next { border-right: 1px solid #f3f4f6; }
.tv-label {
  font-size: clamp(10px,.85vw,13px);
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-bottom: 4px;
  color: #6b7280;
}
.tv-panel-next .tv-label { color: #16a34a; }
.tv-panel-deck .tv-label { color: #d97706; }
.tv-run-num {
  font-size: clamp(26px,3.6vw,50px);
  font-weight: 900;
  line-height: 1;
  color: #111;
  letter-spacing: -.03em;
}
.tv-run-num-sm { font-size: clamp(20px,2.6vw,36px) !important; }
.tv-rider-name {
  font-size: clamp(13px,1.6vw,22px);
  font-weight: 800;
  color: #1f2937;
  line-height: 1.15;
  margin-top: 4px;
}
.tv-rider-name-sm { font-size: clamp(11px,1.2vw,16px) !important; }
.tv-horse-name {
  font-size: clamp(11px,1vw,16px);
  color: #6b7280;
  margin-top: 4px;
  font-style: italic;
}
.tv-last-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 24px;
  background: #fff7ed;
  border-top: 1px solid rgba(255,106,28,.15);
  font-size: clamp(11px,1.1vw,15px);
  color: #374151;
}
.tv-last-label { font-weight: 800; color: #ff6a1c; letter-spacing: .05em; }
.tv-progress-track { height: 8px; background: #f3f4f6; overflow: hidden; }
.tv-progress-fill { height: 100%; transition: width .5s ease; }

/* Highlight next-up row */
body.fullscreen-mode tr.tv-next-row td {
  background: rgba(22,163,74,.06) !important;
  border-left: 3px solid #16a34a !important;
}

/* Compact avatar in fullscreen */
body.fullscreen-mode #liveContent .barrel-avatar,
body.fullscreen-mode #liveContent .r-avatar { width: 40px !important; height: 40px !important; font-size: 14px !important; }
body.fullscreen-mode #liveContent .card-header { font-size: 13px; padding: 8px 16px !important; }
body.fullscreen-mode #liveContent .card-body { padding: 8px 12px !important; }

/* Live dot animation */
.tv-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  margin-right: 6px;
  animation: tv-live-pulse 1.6s ease-in-out infinite;
  vertical-align: middle;
}
@keyframes tv-live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .35; transform: scale(.75); }
}
