/* ============================================================
   User / TV Dashboard — airport-departures-board style.
   Whole screen is a fixed 100vh stack: topbar, the active-classes
   board (flex:1), then the vacant-rooms marquee bars pinned to the
   bottom. Nothing on this page ever scrolls — if the active-classes
   list is taller than the fixed board area, the list itself loops
   with a smooth, continuous vertical auto-scroll (see dashboard.ts).
   ============================================================ */

body { overflow: hidden; }

.app-shell {
  height: 100vh;
  min-height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 14px 40px;
  background: var(--ink-900);
  border-bottom: 1px solid var(--ink-600);
  flex-shrink: 0;
}
.topbar-brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { height: 40px; width: auto; }
.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.2px;
}
.brand-subtitle {
  font-size: 13px;
  color: var(--gold-300);
  font-weight: 500;
  margin-top: 2px;
}

.topbar-clock {
  text-align: center;
  justify-self: center;
}
.clock-time {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.clock-date {
  font-size: 14px;
  color: var(--text-300);
  margin-top: 4px;
}

.topbar-weather {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: end;
  background: var(--ink-700);
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-md);
  padding: 8px 16px;
}
.weather-icon { font-size: 26px; }
.weather-temp { font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.weather-loc { font-size: 11px; color: var(--text-500); }

/* ----------------------------------------------------------
   Departures board — active (occupied) classes, dense grid-based
   "table" (divs, not <table>, so the row list can be transform-
   animated for the auto-scroll loop). Fills all remaining vertical
   space between the topbar and the bottom marquee bars.
   ---------------------------------------------------------- */
.board-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 40px 10px;
}
.board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.board-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-100);
  letter-spacing: 0.3px;
}
.break-chip {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-100);
  background: rgba(205,173,86,0.18);
  border: 1px solid var(--gold-500);
  border-radius: 999px;
  padding: 5px 18px;
}
.board-count {
  font-size: 13px;
  color: var(--text-500);
  font-weight: 600;
}

.board-table-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-md);
  background: var(--ink-900);
}

/* Shared column template for the head row and every data row. */
.board-grid-head,
.board-row {
  display: grid;
  grid-template-columns: 64px 80px 90px 1fr 230px 110px 110px 130px;
  align-items: center;
}

.board-grid-head {
  flex-shrink: 0;
  background: var(--text-100);
  color: #fff;
}
.board-grid-head .board-cell {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 14px;
}

.board-scroll-viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.board-scroll-track {
  display: flex;
  flex-direction: column;
}
.board-scroll-track.auto-scroll {
  animation: board-scroll-y var(--scroll-duration, 20s) linear infinite;
  will-change: transform;
}
@keyframes board-scroll-y {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

.board-row {
  border-bottom: 1px solid var(--ink-600);
}
.board-row:nth-child(even) { background: var(--ink-800); }
.board-row.just-updated { animation: row-pulse 1.2s ease; }
@keyframes row-pulse {
  0% { background: rgba(205,173,86,0.45); }
  100% { background: transparent; }
}
.board-cell {
  padding: 12px 14px;
  font-size: 15px;
}
.board-sno {
  font-variant-numeric: tabular-nums;
  color: var(--text-500);
  font-weight: 700;
}
.board-block-pill {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-100);
}
.board-room {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-100);
}
.board-subject { font-weight: 700; color: var(--text-100); }
.board-faculty { color: var(--text-300); }
.board-type {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-500);
}
.board-time {
  font-variant-numeric: tabular-nums;
  color: var(--text-300);
  font-weight: 600;
}
.board-status {
  display: inline-block;
  background: var(--occupied-500);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 5px 12px;
  border-radius: 999px;
}
.board-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-500);
  font-size: 16px;
  font-weight: 600;
}

/* ----------------------------------------------------------
   Bottom bars — one slow-scrolling vacant-rooms line per block,
   stacked at the bottom of the viewport. No text label (the block
   letter is already on every room tag, e.g. "A 213"). Large, bold
   type so it reads clearly on a TV from across a room. Fixed-height,
   never contributing to page scroll.
   ---------------------------------------------------------- */
.bottom-bars {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--ink-600);
}
.vacant-block {
  display: flex;
  flex-direction: column;
}
.ticker-bar {
  display: flex;
  align-items: center;
  padding: 10px 40px;
  overflow: hidden;
}
.vacant-bar {
  background: var(--vacant-500);
  border-bottom: 1px solid rgba(255,255,255,0.18);
}
.vacant-bar:last-child { border-bottom: none; }
.vacant-bar .ticker-item { color: #fff; font-weight: 700; }
.vacant-bar .ticker-empty { color: rgba(255,255,255,0.9); font-size: 20px; font-weight: 600; }

.ticker-track {
  flex: 1;
  display: flex;
  gap: 60px;
  white-space: nowrap;
  /* Slow, calm scroll — easy to read on a TV from across a room. */
  animation: ticker-scroll 90s linear infinite;
}
.vacant-bar .ticker-track { animation-duration: 75s; }
.ticker-track.no-scroll { animation: none; transform: none; }
.ticker-item { font-size: 22px; color: var(--text-100); }
.ticker-item b { color: var(--gold-300); }

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr; text-align: center; gap: 8px; padding: 10px 16px; }
  .topbar-weather, .topbar-clock { justify-self: center; }
  .board-wrap { padding: 10px 16px 6px; }
  .board-grid-head, .board-row {
    grid-template-columns: 40px 50px 60px 1fr 90px 90px;
  }
  .col-type, .col-time { display: none; }
  .ticker-bar { padding: 8px 16px; }
  .ticker-item { font-size: 16px; }
}

/* ----------------------------------------------------------
   Event popup overlay — cycles on/off per event's configured
   popup_duration_seconds, with a 3s gap between showings.
   ---------------------------------------------------------- */
.event-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 20, 40, 0.82);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.event-popup-overlay.visible { opacity: 1; pointer-events: auto; }
/* Text-only popups keep a normal padded card */
.event-popup-card {
  position: relative;
  background: var(--ink-700);
  border: 2px solid var(--gold-500);
  border-radius: var(--radius-lg);
  padding: 32px 40px;
  max-width: 720px;
  width: 90%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
  text-align: center;
  overflow: hidden;
}
/* Popups with an image/video: no padding, media fills almost the whole
   screen, title + description overlaid along the bottom edge. */
.event-popup-card.has-media {
  padding: 0;
  width: auto;
  max-width: 98vw;
  border-radius: var(--radius-md);
  line-height: 0;
  background: #000;
}
.event-popup-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  margin-top: 16px;
}
.event-popup-desc {
  font-size: 16px;
  color: var(--text-300);
  margin-top: 8px;
}
.event-popup-card.has-media .event-popup-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 36px 28px 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.78), transparent);
  line-height: 1.3;
  text-align: left;
}
.event-popup-card.has-media .event-popup-title { color: #fff; margin-top: 0; font-size: 30px; }
.event-popup-card.has-media .event-popup-desc { color: rgba(255,255,255,0.9); margin-top: 4px; }
.event-popup-card.has-media .event-popup-title:empty,
.event-popup-card.has-media .event-popup-desc:empty { display: none; }
#event-popup-media img, #event-popup-media video {
  max-width: 98vw;
  max-height: 96vh;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* ----------------------------------------------------------
   Break banner — big, centred over the board while a break runs.
   ---------------------------------------------------------- */
.break-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.94);
}
.break-card { text-align: center; padding: 24px; }
.break-label {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--gold-500);
}
.break-name {
  font-family: var(--font-display);
  font-size: clamp(48px, 8vw, 120px);
  font-weight: 700;
  color: var(--text-100);
  line-height: 1.1;
  margin-top: 8px;
}
.break-time {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.5vw, 68px);
  font-weight: 700;
  color: var(--text-300);
  margin-top: 12px;
  font-variant-numeric: tabular-nums;
}
.break-note { font-size: clamp(18px, 2vw, 30px); color: var(--text-500); margin-top: 10px; }
.break-countdown {
  display: inline-block;
  margin-top: 22px;
  font-size: clamp(20px, 2.4vw, 36px);
  font-weight: 700;
  color: #fff;
  background: var(--text-100);
  border-radius: 999px;
  padding: 8px 28px;
  font-variant-numeric: tabular-nums;
}
