@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --navy: #0b1120;
  --navy-light: #131c31;
  --navy-card: #162038;
  --navy-hover: #1d2a47;
  --gold: #d4a843;
  --gold-bright: #f5b942;
  --gold-glow: rgba(212, 168, 67, 0.15);
  --green: #10b981;
  --green-bg: rgba(16, 185, 129, 0.14);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.14);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.15);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.14);
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --text-muted: #64748b;
  --border: rgba(255, 255, 255, 0.09);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--navy);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* LOGIN SCREEN */
.login-screen {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: radial-gradient(circle at 50% 25%, rgba(212, 168, 67, 0.08) 0%, transparent 65%);
}
.login-screen.visible { display: flex; }

.login-card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 48px 42px;
  width: 440px;
  max-width: 94vw;
  text-align: center;
  box-shadow: var(--shadow);
}

.login-logo {
  font-size: 54px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 22px rgba(212, 168, 67, 0.35));
}

.login-card h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}
.login-card h1 span { color: var(--gold); }

.login-subtitle {
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 24px;
}

.btn-microsoft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-microsoft:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
}
.btn-microsoft:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.btn-microsoft svg { width: 20px; height: 20px; }

.login-error {
  display: none;
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  background: var(--red-bg);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 12.5px;
  line-height: 1.45;
  text-align: left;
}

.login-footer {
  margin-top: 26px;
  font-size: 12px;
  color: var(--text-muted);
}

/* APP SHELL */
.app { display: none; min-height: 100vh; flex-direction: column; }
.app.visible { display: flex; }

.topbar {
  background: rgba(19, 28, 49, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar-title { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.topbar-title span { color: var(--gold); }
.topbar-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
  text-decoration: none;
}
.topbar-badge:hover { border-color: var(--gold); color: var(--text); }

.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(212, 168, 67, 0.12);
  border: 1px solid rgba(212, 168, 67, 0.3);
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-bright);
}
.btn-logout {
  padding: 6px 12px;
  border-radius: 7px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
}
.btn-logout:hover { border-color: var(--red); color: #fca5a5; }

/* COUNTDOWN & TV CONTROLS */
.refresh-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 12px;
  color: #cbd5e1;
  position: relative;
  overflow: hidden;
}
.refresh-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}
.refresh-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, #10b981, #d4a843);
  transition: width 0.9s linear;
}
.btn-tv {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.22), rgba(212, 168, 67, 0.1));
  border: 1px solid rgba(212, 168, 67, 0.5);
  color: var(--gold-bright);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-tv:hover {
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.35), rgba(212, 168, 67, 0.18));
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(212, 168, 67, 0.25);
}

/* =========================================================
   TV FULLSCREEN WALLBOARD MODE (100vw x 100vh Edge-to-Edge)
   ========================================================= */
.tv-only-bar { display: none; }

body.tv-mode {
  overflow: hidden !important;
  background: #060a12 !important;
}
body.tv-mode .topbar,
body.tv-mode .non-tv-section {
  display: none !important;
}
body.tv-mode #dashboardMain {
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100vh !important;
  padding: 14px 22px !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
}
body.tv-mode #pipelineSection {
  flex: 1 1 auto !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 16px 20px !important;
  margin: 0 !important;
  border-radius: 16px !important;
  background: #0d1526 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  min-height: 0 !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6) !important;
}
body.tv-mode .normal-pipeline-header {
  display: none !important;
}
body.tv-mode .tv-only-bar {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
body.tv-mode #pipelineGrid {
  flex: 1 1 auto !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 16px !important;
  min-height: 0 !important;
}
body.tv-mode .tv-stage-col {
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  padding: 14px 16px !important;
  background: #131e35 !important;
}
body.tv-mode .tv-stage-cards {
  flex: 1 1 auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  overflow-y: auto !important;
  padding-right: 2px;
}
body.tv-mode .tv-queue-card {
  padding: 12px 15px !important;
}
body.tv-mode .tv-queue-name {
  font-size: 14.5px !important;
}
body.tv-mode .tv-score-pill {
  font-size: 14px !important;
  padding: 2px 9px !important;
}
