/*!
 * PMI Enrollment Wallboard
 * Copyright (c) 2026 VIZULABS · Developed by vizulabs.com · All rights reserved.
 *
 * Wallboard styles. Light/Dark mode driven by [data-theme="..."] on <html>.
 */

:root[data-theme="dark"] {
  --bg-0: #05060a;
  --bg-1: #0a0e1a;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.10);
  --text: #f8fafc;
  --text-2: #cbd5e1;
  --muted: #64748b;
  --bg-grad-1: rgba(56, 189, 248, 0.08);
  --bg-grad-2: rgba(167, 139, 250, 0.08);
  --pill-bg: rgba(255, 255, 255, 0.04);
  --topbar-bg: rgba(0, 0, 0, 0.2);
}
:root[data-theme="light"] {
  --bg-0: #f8fafc;
  --bg-1: #ffffff;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #94a3b8;
  --bg-grad-1: rgba(56, 189, 248, 0.10);
  --bg-grad-2: rgba(167, 139, 250, 0.10);
  --pill-bg: #ffffff;
  --topbar-bg: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100vh; overflow: hidden; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(ellipse at 20% 0%, var(--bg-grad-1), transparent 50%),
    radial-gradient(ellipse at 80% 100%, var(--bg-grad-2), transparent 50%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum", "ss01";
  display: flex;
  flex-direction: column;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 40px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 18px; }
.brand .mark {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #05060a;
  box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 50%, transparent);
}
.brand .titles .t1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.brand .titles .t2 { font-size: 13px; color: var(--text-2); margin-top: 2px; letter-spacing: 0.02em; }

.clock-block { display: flex; align-items: center; gap: 28px; }
.live-pill {
  display: flex; align-items: center; gap: 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #10b981;
  padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.8); }
}
.clock { text-align: right; }
.clock .time { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.clock .date { font-size: 12px; color: var(--text-2); margin-top: 4px; letter-spacing: 0.05em; }
.last-update { font-size: 10px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------- KPIs ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  padding: 20px 40px;
  flex-shrink: 0;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 22px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: ""; position: absolute; top: 0; left: 0;
  height: 3px; width: 100%;
  background: var(--kpi-color, var(--accent));
  opacity: 0.85;
}
.kpi.k-total   { --kpi-color: #38bdf8; }
.kpi.k-active  { --kpi-color: #a78bfa; }
.kpi.k-exam    { --kpi-color: #fbbf24; }
.kpi.k-cert    { --kpi-color: #10b981; }
.kpi.k-revenue { --kpi-color: #34d399; }
.kpi .l { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-2); font-weight: 600; margin-bottom: 8px; }
.kpi .v { font-size: 38px; font-weight: 800; letter-spacing: -0.025em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12px; color: var(--text-2); margin-top: 6px; }

/* ---------- Board ---------- */
.board-shell {
  flex: 1;
  padding: 8px 40px 28px;
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 0;
}
.board-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0 4px 16px;
}
.board-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.board-head .legend { font-size: 12px; color: var(--text-2); }

.board {
  display: grid;
  gap: 14px;
  flex: 1;
  min-height: 0;
}
.col {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex; flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
  transition: all .3s ease;
}
.col.highlight {
  background: var(--panel-2);
  border-color: var(--col-color);
  box-shadow:
    0 0 0 2px var(--col-color),
    0 0 40px color-mix(in srgb, var(--col-color) 30%, transparent);
  transform: translateY(-3px);
  animation: colHighlightPulse 2.4s ease-in-out infinite;
}
@keyframes colHighlightPulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--col-color), 0 0 40px color-mix(in srgb, var(--col-color) 30%, transparent); }
  50%      { box-shadow: 0 0 0 2px var(--col-color), 0 0 60px color-mix(in srgb, var(--col-color) 50%, transparent); }
}
.col-head { padding: 14px 16px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.col-head .row1 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.col-head .label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.col-head .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--col-color); box-shadow: 0 0 12px var(--col-color); }
.col-head .count { font-size: 32px; font-weight: 800; color: var(--col-color); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1; }
.col-head .bar { height: 4px; background: rgba(127,127,127,0.15); border-radius: 2px; overflow: hidden; }
.col-head .bar-fill { height: 100%; background: var(--col-color); border-radius: 2px; transition: width .5s ease; }

.col-body { flex: 1; overflow: hidden; padding: 10px; position: relative; }
.ticker { display: flex; flex-direction: column; gap: 8px; will-change: transform; }
.ticker.scrolling { animation: scrollUp linear infinite; }
@keyframes scrollUp {
  0%   { transform: translateY(0); }
  100% { transform: translateY(calc(-50% - 4px)); }
}

.pill {
  background: var(--pill-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--col-color);
  border-radius: 8px;
  padding: 10px 12px;
  flex-shrink: 0;
}
.pill .name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill .sub { font-size: 11px; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; }
.pill .sub .prod { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.pill .sub .amt { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.pill .exam-row {
  margin-top: 6px;
  font-size: 10px;
  color: #fbbf24;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* New-record card — clearly distinguished from existing rows */
.pill.is-new {
  border-left-width: 5px;
  background: color-mix(in srgb, var(--col-color) 14%, var(--pill-bg));
  border-color: color-mix(in srgb, var(--col-color) 60%, var(--border));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--col-color) 50%, transparent),
    0 0 24px color-mix(in srgb, var(--col-color) 25%, transparent);
  animation: pillPulse 2s ease-in-out infinite;
  position: relative;
}
@keyframes pillPulse {
  0%, 100% {
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--col-color) 50%, transparent),
      0 0 24px color-mix(in srgb, var(--col-color) 25%, transparent);
  }
  50% {
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--col-color) 80%, transparent),
      0 0 40px color-mix(in srgb, var(--col-color) 55%, transparent);
  }
}

/* "NEW" badge — large, high-contrast, sits flush right of the name */
.pill .new-badge {
  display: inline-block;
  margin-left: 10px;
  background: var(--col-color);
  color: #05060a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 4px;
  vertical-align: middle;
  text-shadow: 0 0 1px rgba(0,0,0,0.2);
  box-shadow: 0 0 12px color-mix(in srgb, var(--col-color) 60%, transparent);
  animation: badgePulse 1.4s ease-in-out infinite;
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%      { transform: scale(1.08); opacity: 0.85; }
}

/* Tiny "✨ Just added" line above the name on new cards — unmistakable */
.pill.is-new::before {
  content: "✨ JUST ADDED";
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--col-color);
  margin-bottom: 5px;
  text-shadow: 0 0 8px color-mix(in srgb, var(--col-color) 50%, transparent);
}

.col-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 24px 0; font-style: italic; }

/* ---------- Copyright (wallboard, bottom-right) ---------- */
.copyright {
  position: fixed;
  bottom: 6px;
  right: 14px;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
  z-index: 5;
  pointer-events: auto;
  user-select: none;
}
.copyright a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted color-mix(in srgb, var(--muted) 60%, transparent);
}
.copyright a:hover { color: var(--text-2); }

/* ---------- Copyright (inside modals) ---------- */
.modal-copyright {
  margin-top: 22px;
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

/* ---------- Logout link ---------- */
.logout-link {
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.logout-link:hover {
  color: var(--text);
  border-color: var(--border);
}

/* ---------- Fullscreen button ---------- */
.fs-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0;
}
.fs-btn:hover {
  color: var(--text);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.fs-btn:active { transform: scale(0.94); }
.fs-btn svg { display: block; }

/* ---------- Login modal (viewers-only mode) ---------- */
#page-shell {
  /* Fill the viewport and host the topbar/KPI/board/footer flex chain */
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  transition: filter 0.4s ease, opacity 0.4s ease;
}
body.auth-locked #page-shell {
  filter: blur(10px) saturate(0.5);
  opacity: 0.55;
  pointer-events: none;
}
.login-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: lmFadeIn 0.3s ease-out;
}
/* The `hidden` HTML attribute must beat `display: flex` */
.login-modal[hidden] { display: none !important; }
@keyframes lmFadeIn { from { opacity: 0; } to { opacity: 1; } }
.login-modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5),
              0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
  animation: lmCardIn 0.35s cubic-bezier(.25, .8, .25, 1);
}
@keyframes lmCardIn {
  from { transform: translateY(12px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.login-mark {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #05060a;
  margin-bottom: 18px;
  box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 50%, transparent);
}
.login-modal-card h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  color: var(--text);
}
.login-modal-card .login-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 22px;
}
.login-modal-card label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  font-weight: 600;
  margin-top: 14px;
  margin-bottom: 6px;
}
.login-modal-card input {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.login-modal-card input:focus { border-color: var(--accent); }
.login-modal-card input::placeholder { color: var(--muted); }

/* Password input with eye-toggle */
.pw-input {
  position: relative;
}
.pw-input input {
  padding-right: 44px;       /* room for the eye button */
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em;
}
.pw-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 16px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  padding: 0;
}
.pw-eye:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.pw-eye.active {
  color: var(--accent);
}
.login-error {
  margin-top: 14px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 8px;
  color: #ef4444;
  font-size: 13px;
}
.login-btn {
  margin-top: 22px;
  width: 100%;
  padding: 12px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #05060a;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
}
.login-btn:hover { background: color-mix(in srgb, var(--accent) 80%, white); }
.login-btn:active { transform: scale(0.98); }
.login-btn:disabled { opacity: 0.6; cursor: wait; }

.login-btn-secondary {
  margin-top: 22px;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  flex: 1;
}
.login-btn-secondary:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.cp-actions {
  display: flex;
  gap: 10px;
}
.cp-actions .login-btn { flex: 1; margin-top: 22px; }

.login-success {
  margin-top: 14px;
  padding: 10px 14px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 8px;
  color: #10b981;
  font-size: 13px;
}

/* Light theme override for login mark */
:root[data-theme="light"] .login-mark {
  color: #ffffff;
}

/* ---------- Error banner ---------- */
.error-banner {
  margin-top: 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #ef4444;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
}

/* ---------- TV scaling ----------
   Goal: fit cleanly within 100vh on a 1920×1080 TV (and bigger).
   Vertical padding is intentionally tight; horizontal can be generous. */
@media (min-width: 1900px) {
  .topbar { padding: 18px 56px; }
  .brand .titles .t1 { font-size: 26px; }
  .clock .time { font-size: 32px; }
  .kpis { padding: 14px 56px; gap: 16px; }
  .kpi { padding: 14px 22px; }
  .kpi .v { font-size: 38px; }
  .kpi .l { font-size: 12px; margin-bottom: 6px; }
  .kpi .delta { margin-top: 4px; }
  .board-shell { padding: 8px 56px 16px; }
  .board-head { padding: 0 4px 10px; }
  .col-head { padding: 12px 14px 10px; }
  .col-head .count { font-size: 32px; }
  .col-head .row1 { margin-bottom: 6px; }
  .pill { padding: 10px 12px; }
  .pill .name { font-size: 15px; }
  .pill .sub { font-size: 12px; }
}
@media (min-width: 2400px) {
  .topbar { padding: 22px 64px; }
  .kpis { padding: 18px 64px; }
  .kpi .v { font-size: 48px; }
  .col-head .count { font-size: 40px; }
  .pill .name { font-size: 17px; }
  .board-shell { padding: 10px 64px 20px; }
}

/* Short-screen safety: shrink KPIs/topbar when viewport is short
   so the board never gets cropped. */
@media (max-height: 800px) {
  .kpis { padding: 12px 32px; gap: 12px; }
  .kpi { padding: 12px 16px; }
  .kpi .v { font-size: 28px; }
  .topbar { padding: 14px 32px; }
}
