/* Sales Day TV leaderboard styles */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #0a0e3a;
  --navy-2: #161c5a;
  --gold: #ffd700;
  --gold-deep: #c4a000;
  --teal: #1abeaa;
  --pink: #e91e8a;
  --white: #ffffff;
  --grey: #8a92c4;
  --row-bg: rgba(255,255,255,0.04);
  --row-bg-hi: rgba(255,255,255,0.10);
}

html, body {
  height: 100%;
  background: radial-gradient(ellipse at top, #1d2680 0%, var(--navy) 60%, #050828 100%);
  color: var(--white);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ===== TOP BAR ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: rgba(0,0,0,0.25);
  border-bottom: 3px solid var(--gold);
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 900;
  font-size: 36px;
  letter-spacing: 1px;
}
.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--navy);
  padding: 4px;
}
.brand-name {
  color: var(--white);
  text-shadow: 0 0 16px rgba(255,215,0,0.2);
}
.brand-year { color: var(--pink); font-size: 24px; }

.round-banner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  background: linear-gradient(90deg, var(--pink) 0%, var(--gold) 100%);
  padding: 8px 32px;
  border-radius: 999px;
  box-shadow: 0 4px 24px rgba(233,30,138,0.4);
}
.round-label {
  font-weight: 800;
  font-size: 22px;
  color: var(--navy);
  letter-spacing: 0.5px;
}
.round-clock {
  font-weight: 700;
  font-size: 14px;
  color: var(--navy);
  opacity: 0.8;
  margin-top: 2px;
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  color: var(--grey);
}
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot-green { background: #2dd47a; box-shadow: 0 0 8px #2dd47a; }
.dot-amber { background: var(--gold); }
.dot-red   { background: #e74c3c; }
.dot-grey  { background: #555; }

/* ===== LEADERBOARD ===== */
.board {
  flex: 1;
  overflow-y: auto;
  padding: 24px 40px 16px;
  position: relative;
}

.leaderboard {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row {
  display: grid;
  grid-template-columns: 90px 100px 1fr auto auto;
  align-items: center;
  gap: 24px;
  padding: 14px 22px;
  background: var(--row-bg);
  border-radius: 16px;
  border-left: 6px solid transparent;
  position: relative;
  will-change: transform;
}

.row.rank-1 {
  background: linear-gradient(90deg, rgba(255,215,0,0.20) 0%, rgba(255,215,0,0.04) 100%);
  border-left-color: var(--gold);
  box-shadow: 0 0 24px rgba(255,215,0,0.15);
}
.row.rank-2 {
  background: linear-gradient(90deg, rgba(192,192,192,0.15) 0%, rgba(192,192,192,0.04) 100%);
  border-left-color: #c0c0c0;
}
.row.rank-3 {
  background: linear-gradient(90deg, rgba(205,127,50,0.18) 0%, rgba(205,127,50,0.04) 100%);
  border-left-color: #cd7f32;
}

.rank {
  font-size: 56px;
  font-weight: 900;
  color: var(--grey);
  text-align: center;
  line-height: 1;
}
.row.rank-1 .rank { color: var(--gold); text-shadow: 0 0 20px rgba(255,215,0,0.6); }
.row.rank-2 .rank { color: #d0d0d0; }
.row.rank-3 .rank { color: #cd7f32; }

.photo-wrap {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid var(--teal);
  overflow: hidden;
  background: var(--navy-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-weight: 900;
  color: var(--teal);
}
.row.rank-1 .photo-wrap { border-color: var(--gold); }
.photo-wrap img { width: 100%; height: 100%; object-fit: cover; }

.name {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.breakdown {
  display: flex;
  gap: 10px;
  margin-right: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: var(--white);
  white-space: nowrap;
}
.chip-bd   { background: rgba(26,190,170,0.18); color: var(--teal); border: 1px solid rgba(26,190,170,0.35); }
.chip-meet { background: rgba(74,144,226,0.18); color: #6db4ff; border: 1px solid rgba(74,144,226,0.35); }
.chip-job  { background: rgba(46,204,113,0.18); color: #5fe093; border: 1px solid rgba(46,204,113,0.35); }
.chip-buzz { background: rgba(255,215,0,0.22); color: var(--gold); border: 1px solid rgba(255,215,0,0.45); font-weight: 900; }

.total {
  font-size: 52px;
  font-weight: 900;
  color: var(--gold);
  min-width: 110px;
  text-align: right;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(255,215,0,0.3);
}
.total-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--grey);
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: right;
  display: block;
  margin-top: 4px;
}

/* Score-up flash (green glow) */
.row.score-up { animation: scoreUp 1.4s ease; }
@keyframes scoreUp {
  0%   { background: var(--row-bg); }
  25%  { background: rgba(46,204,113,0.30); }
  100% { background: var(--row-bg); }
}
.row.rank-1.score-up { animation: none; }

/* Moved-up flash (teal pulse + slight scale) */
.row.moved-up { animation: movedUp 1.8s ease; }
@keyframes movedUp {
  0%   { box-shadow: 0 0 0 rgba(26,190,170,0); }
  20%  { box-shadow: 0 0 32px rgba(26,190,170,0.8), 0 0 64px rgba(26,190,170,0.4); }
  100% { box-shadow: 0 0 0 rgba(26,190,170,0); }
}
.row.rank-1.moved-up { animation: movedUpGold 1.8s ease; }
@keyframes movedUpGold {
  0%   { box-shadow: 0 0 24px rgba(255,215,0,0.15); }
  20%  { box-shadow: 0 0 48px rgba(255,215,0,1), 0 0 96px rgba(255,215,0,0.5); }
  100% { box-shadow: 0 0 24px rgba(255,215,0,0.15); }
}

/* ===== BUZZER FLASH ===== */
.buzzer-flash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(255,215,0,0.55) 0%, rgba(10,14,58,0) 70%);
  pointer-events: none;
  opacity: 0;
  z-index: 100;
}
.buzzer-flash.show { animation: buzzerFlash 1.6s ease-out; }
.buzzer-text {
  font-size: 120px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 40px rgba(255,215,0,0.8), 0 0 8px var(--navy);
  transform: scale(0.5);
}
.buzzer-flash.show .buzzer-text { animation: buzzerText 1.6s ease-out; }
@keyframes buzzerFlash {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes buzzerText {
  0%   { transform: scale(0.4) rotate(-8deg); }
  30%  { transform: scale(1.2) rotate(2deg); }
  60%  { transform: scale(1.0) rotate(0deg); }
  100% { transform: scale(1.1) rotate(0deg); }
}

/* ===== FOOTER ===== */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: rgba(0,0,0,0.3);
  border-top: 2px solid rgba(255,215,0,0.3);
  font-size: 16px;
  color: var(--grey);
}
.legend { display: flex; gap: 20px; align-items: center; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-item .chip { font-size: 13px; padding: 4px 10px; }
.footer-right { font-size: 14px; }

/* ===== ADMIN OVERLAY (Ctrl+S) ===== */
.admin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,8,40,0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.admin-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
.admin-modal {
  width: 100%;
  max-width: 720px;
  max-height: 80vh;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--navy-2) 0%, var(--navy) 100%);
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 28px 32px;
  position: relative;
}
.admin-modal h2 {
  font-size: 26px;
  color: var(--gold);
  margin-bottom: 6px;
}
.admin-hint {
  color: var(--grey);
  font-size: 13px;
  margin-bottom: 20px;
}
.admin-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: 1px solid var(--grey);
  color: var(--grey);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
}
.admin-close:hover { color: var(--white); border-color: var(--white); }

.admin-lock { text-align: center; padding: 30px 0; }
.admin-lock input {
  font-size: 22px;
  padding: 12px 18px;
  border-radius: 12px;
  border: 2px solid var(--teal);
  background: var(--navy);
  color: var(--white);
  width: 260px;
  text-align: center;
  margin-bottom: 14px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.admin-lock button, .buzzer-btn {
  font-size: 18px;
  font-weight: 800;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--navy);
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.admin-lock button:hover, .buzzer-btn:hover { transform: scale(1.04); }

.consultant-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.consultant-list li {
  display: grid;
  grid-template-columns: 60px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
}
.consultant-list .photo-wrap { width: 56px; height: 56px; border-width: 3px; font-size: 22px; }
.consultant-list .name { font-size: 18px; }
.consultant-list .buzzer-btn { font-size: 15px; padding: 8px 16px; }
.consultant-list .buzzer-btn-remove {
  background: transparent;
  border: 2px solid var(--grey);
  color: var(--grey);
}
.consultant-list .buzzer-btn-remove:hover:not(:disabled) {
  border-color: #e74c3c;
  color: #e74c3c;
  background: rgba(231,76,60,0.1);
}
.consultant-list .buzzer-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: var(--navy);
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 300;
}
.toast.show { opacity: 1; }
.toast.error { background: #e74c3c; color: white; }

@media (max-width: 1200px) {
  .row { grid-template-columns: 70px 76px 1fr auto auto; gap: 16px; }
  .rank { font-size: 42px; }
  .photo-wrap { width: 76px; height: 76px; }
  .name { font-size: 24px; }
  .chip { font-size: 14px; padding: 5px 10px; }
  .total { font-size: 38px; }
  .brand { font-size: 24px; }
  .round-label { font-size: 16px; }
}

/* TV-SIZED DISPLAY (1080p and up): scales with viewport so 7 rows fill the screen */
@media (min-width: 1700px) and (min-height: 1100px) {
  .board { padding: clamp(16px, 1.8vh, 32px) clamp(24px, 2.5vw, 56px); }
  .leaderboard { height: 100%; justify-content: space-around; gap: clamp(8px, 1vh, 18px); }
  .topbar { padding: clamp(14px, 1.6vh, 26px) clamp(20px, 2vw, 40px); }
  .brand { font-size: clamp(36px, 3vh, 56px); gap: clamp(12px, 1vw, 22px); }
  .brand-icon { width: clamp(48px, 4vh, 76px); height: clamp(48px, 4vh, 76px); }
  .brand-year { font-size: clamp(24px, 2vh, 38px); }
  .round-banner { padding: clamp(8px, 1vh, 16px) clamp(24px, 2.5vw, 56px); }
  .round-label { font-size: clamp(22px, 2vh, 38px); }
  .round-clock { font-size: clamp(14px, 1.2vh, 22px); }
  .status { font-size: clamp(16px, 1.3vh, 24px); }
  .dot { width: clamp(12px, 1vh, 20px); height: clamp(12px, 1vh, 20px); }
  .row {
    grid-template-columns: clamp(80px, 7vw, 130px) clamp(80px, 8vh, 140px) 1fr auto auto;
    gap: clamp(16px, 2vw, 34px);
    padding: clamp(10px, 1.2vh, 22px) clamp(18px, 2vw, 36px);
    border-radius: clamp(12px, 1vw, 22px);
    max-height: clamp(90px, 11vh, 160px);
  }
  .rank { font-size: clamp(48px, 5.5vh, 90px); }
  .photo-wrap {
    width: clamp(80px, 8vh, 140px);
    height: clamp(80px, 8vh, 140px);
    border-width: clamp(3px, 0.3vw, 6px);
    font-size: clamp(30px, 3vh, 52px);
  }
  .name { font-size: clamp(28px, 2.8vh, 48px); }
  .chip { font-size: clamp(16px, 1.5vh, 26px); padding: clamp(5px, 0.6vh, 10px) clamp(10px, 1vw, 18px); }
  .breakdown { gap: clamp(8px, 0.8vw, 16px); }
  .total { font-size: clamp(44px, 5vh, 80px); min-width: clamp(100px, 9vw, 160px); }
  .total-label { font-size: clamp(12px, 1vh, 18px); }
  .footer { padding: clamp(10px, 1vh, 18px) clamp(20px, 2vw, 40px); font-size: clamp(14px, 1.2vh, 22px); }
  .legend { gap: clamp(14px, 1.4vw, 28px); }
  .legend-item .chip { font-size: clamp(12px, 1vh, 18px); padding: clamp(3px, 0.4vh, 6px) clamp(8px, 0.8vw, 14px); }
}

/* Gentle pulse on the leader so they feel alive */
@keyframes leaderPulse {
  0%, 100% { box-shadow: 0 0 24px rgba(255,215,0,0.15); }
  50%      { box-shadow: 0 0 40px rgba(255,215,0,0.35); }
}
.row.rank-1 { animation: leaderPulse 3.5s ease-in-out infinite; }

/* Round banner slide-in when label changes */
@keyframes roundChange {
  0%   { transform: translate(-50%, -50%) translateX(120%); opacity: 0; }
  60%  { transform: translate(-50%, -50%) translateX(-8px); opacity: 1; }
  80%  { transform: translate(-50%, -50%) translateX(4px); }
  100% { transform: translate(-50%, -50%) translateX(0); opacity: 1; }
}
@keyframes roundSparkle {
  0%   { box-shadow: 0 4px 24px rgba(233,30,138,0.4); }
  30%  { box-shadow: 0 0 48px rgba(255,215,0,0.9), 0 4px 24px rgba(233,30,138,0.4); }
  100% { box-shadow: 0 4px 24px rgba(233,30,138,0.4); }
}
.round-banner.changing { animation: roundChange 0.9s cubic-bezier(.34,1.56,.64,1), roundSparkle 1.4s ease; }
