/* ─────────────────────────────────────────────────────────────
   DASHBOARD SCREEN  –  ZappQ Flow TV
   ───────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

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

:root {
  --bg:          #f0f8f2;
  --white:       #ffffff;
  --teal:        #16a34a;
  --teal-light:  #dcfce7;
  --blue:        #16a34a;
  --blue-light:  #f0fdf4;
  --border:      #d1fae5;
  --text-dark:   #052e16;
  --text-light:  #6b7280;
  --shadow-sm:   0 4px 16px rgba(0,0,0,0.05);
  --shadow-md:   0 8px 28px rgba(0,0,0,0.09);
}

html, body {
  width: 100%; height: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  overflow: hidden;
}

#dashboard-screen {
  display: flex; flex-direction: column;
  width: 100%; height: 100vh;
  animation: fadeIn 0.9s ease both;
}
#dashboard-screen.hidden { display: none !important; }

@keyframes fadeIn { from { opacity:0 } to { opacity:1 } }

/* ══════════════════════════════
   TOP BAR
══════════════════════════════ */
#top-bar {
  height: 80px;
  flex-shrink: 0;
  background: var(--white);
  border-bottom: 1.5px solid #e4eaf2;
  box-shadow: 0 3px 12px rgba(0,0,0,0.06);
  display: flex; align-items: center;
  padding: 0 24px; gap: 0;
}

#top-logo {
  height: 52px; width: auto;
  object-fit: contain;
  flex-shrink: 0;
}
.top-logo-fallback {
  width: 52px; height: 52px;
  background: transparent;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
#top-logo {
  width: 52px; height: 52px;
  border-radius: 14px;
  object-fit: contain;
}

.top-divider {
  width: 1px; height: 40px;
  background: #e4eaf2;
  margin: 0 18px; flex-shrink: 0;
}

#clinic-info {
  flex: 1; overflow: hidden;
}
#clinic-name {
  font-size: 20px; font-weight: 800; letter-spacing: 0.2px;
  color: var(--text-dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity 0.4s;
}
#live-badge {
  display: flex; align-items: center; gap: 6px; margin-top: 5px;
}
.live-dot {
  width: 7px; height: 7px;
  background: #22c55e; border-radius: 50%;
  animation: blink 1s ease-in-out infinite alternate;
}
@keyframes blink { from { opacity:0.3 } to { opacity:1 } }
#live-label {
  font-size: 9.5px; font-weight: 800; letter-spacing: 1.8px;
  color: var(--teal);
}

#clinic-logo-wrap {
  width: 48px; height: 48px;
  background: #f4f7fb;
  border-radius: 12px;
  border: 1.5px solid #e4eaf2;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  margin-right: 16px; flex-shrink: 0;
}
#clinic-logo-wrap img { width: 100%; height: 100%; object-fit: contain; }

#clock-wrap { flex-shrink: 0; text-align: right; }
#clock-time {
  font-size: 23px; font-weight: 700; letter-spacing: 0.8px;
  color: var(--text-dark); font-variant-numeric: tabular-nums;
  font-family: monospace;
}
#clock-date {
  font-size: 11px; font-weight: 500; color: var(--text-light); margin-top: 2px;
}

#settings-btn {
  background: none; border: none; cursor: pointer;
  color: #9ca3af; font-size: 20px;
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-left: 12px;
  transition: background 0.2s, color 0.2s;
}
#settings-btn:hover { background: #f1f5f9; color: #374151; }

/* ══════════════════════════════
   BODY AREA
══════════════════════════════ */
#body-area {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ── MAIN QUEUE AREA ── */
#queue-area {
  flex: 1;
  padding: 12px 6px 8px 12px;
  overflow: hidden;
  display: flex; flex-direction: column;
}

/* ── EMPTY STATE ── */
#empty-state {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 24px;
}
#empty-state .empty-icon {
  width: 96px; height: 96px;
  background: var(--white);
  border-radius: 28px;
  border: 2px solid var(--border);
  box-shadow: 0 6px 20px rgba(0,0,0,0.05);
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
}
.empty-title { font-size: 22px; font-weight: 700; color: var(--text-dark); }
.empty-sub   { font-size: 14px; color: var(--text-light); }

/* ── DOCTORS PAGE ── */
#doctors-container {
  flex: 1; position: relative; overflow: hidden;
}
.doctors-page {
  position: absolute; inset: 0;
  display: grid; gap: 0;
  opacity: 0; transition: opacity 0.7s ease, transform 0.7s ease;
  transform: translateX(50px);
  pointer-events: none;
}
.doctors-page.active {
  opacity: 1; transform: translateX(0); pointer-events: auto;
}
.doctors-page.exit {
  opacity: 0; transform: translateX(-50px);
}

/* Grid variants */
.doctors-page[data-count="1"] { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.doctors-page[data-count="2"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.doctors-page[data-count="3"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.doctors-page[data-count="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

/* ── DOCTOR CARD ── */
.doctor-card {
  background: var(--white);
  border-radius: 22px;
  border: 1.5px solid var(--border);
  margin: 5px;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 5px 16px rgba(0,0,0,0.055);
  transition: border-color 0.4s, box-shadow 0.4s, transform 0.5s;
}
.doctor-card.card-large { margin: 8px; }
.doctor-card.calling {
  border-color: var(--teal) !important;
  border-width: 2.5px !important;
  transform: scale(1.02);
}
.doctor-card.calling.pulse-on {
  box-shadow: 0 4px 28px rgba(0,168,150,0.3), 0 0 0 3px rgba(0,168,150,0.15) !important;
}

/* CARD HEADER */
.card-header {
  padding: 10px 16px;
  background: #f8fafd;
  border-bottom: 1px solid #e8eef7;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.card-large .card-header { padding: 14px 32px; gap: 18px; }

.doc-avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  width: 48px; height: 48px;
}
.card-large .doc-avatar { width: 70px; height: 70px; }
.avatar-fallback {
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  width: 48px; height: 48px;
}
.card-large .avatar-fallback { width: 70px; height: 70px; font-size: 36px; }

.doc-info { flex: 1; overflow: hidden; }
.doc-name {
  font-size: 16px; font-weight: 800; color: var(--text-dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity 0.4s;
}
.card-large .doc-name { font-size: 28px; }
.doc-spec {
  font-size: 9px; font-weight: 700; letter-spacing: 1.4px;
  color: #15803d; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 3px; transition: opacity 0.4s;
}
.card-large .doc-spec { font-size: 12px; }

.status-pill {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 50px;
  border: 1.2px solid;
  flex-shrink: 0;
  transition: all 0.4s;
}
.card-large .status-pill { padding: 8px 18px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-text { font-size: 8.5px; font-weight: 800; letter-spacing: 0.8px; text-transform: uppercase; }
.card-large .status-text { font-size: 12px; }

/* CARD BODY */
.card-body {
  flex: 1;
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

.token-display {
  display: flex; flex-direction: column; align-items: center;
  padding: 18px;
  gap: 4px;
}
.now-serving-label {
  font-size: 11px; font-weight: 700; letter-spacing: 2.5px;
  color: var(--text-light);
}
.card-large .now-serving-label { font-size: 16px; }
.token-number {
  font-size: 62px; font-weight: 900; line-height: 1;
  color: var(--teal);
  animation: tokenPop 0.5s cubic-bezier(.22,1,.36,1) both;
}
.card-large .token-number { font-size: 130px; }
@keyframes tokenPop {
  from { transform: scale(0.7); opacity:0; }
  to   { transform: scale(1);   opacity:1; }
}
.token-sub-pill {
  display: flex; align-items: center;
  padding: 4px 12px; border-radius: 50px;
  border: 1px solid;
  font-size: 10px; font-weight: 700; letter-spacing: 0.3px;
}
.card-large .token-sub-pill { padding: 7px 20px; font-size: 15px; }

/* CARD FOOTER (next queue) */
.card-footer {
  padding: 10px 14px;
  background: var(--blue-light);
  border-top: 1px solid #bbf7d0;
  display: flex; align-items: center; gap: 7px;
  flex-shrink: 0; overflow: hidden;
}
.card-large .card-footer { padding: 16px 28px; gap: 10px; }
.next-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--blue); flex-shrink: 0;
}
.card-large .next-dot { width: 10px; height: 10px; }
.next-label {
  font-size: 10px; font-weight: 800; letter-spacing: 1.2px;
  color: #15803d; flex-shrink: 0;
}
.card-large .next-label { font-size: 15px; }
.next-tokens {
  display: flex; gap: 6px;
  overflow: hidden;
}
.next-token-chip {
  padding: 4px 10px; border-radius: 10px;
  font-size: 14px; font-weight: 800; flex-shrink: 0;
  transition: all 0.3s;
}
.card-large .next-token-chip { padding: 8px 20px; font-size: 26px; }
.chip-first {
  background: var(--blue); color: #fff;
  box-shadow: 0 3px 8px rgba(22,163,74,0.25);
}
.chip-rest {
  background: #fff; color: #15803d;
  border: 1.5px solid #bbf7d0;
}
.no-queue { font-size: 11px; color: var(--text-light); font-style: italic; }
.card-large .no-queue { font-size: 16px; }

/* ── PAGE DOTS ── */
#page-dots {
  display: flex; justify-content: center; gap: 8px;
  padding: 6px 0 4px;
  flex-shrink: 0;
}
.page-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #cbd5e1; transition: all 0.3s;
}
.page-dot.active { background: #16a34a; transform: scale(1.3); }

/* ══════════════════════════════
   RIGHT PANEL
══════════════════════════════ */
#right-panel {
  width: 200px;
  flex-shrink: 0;
  margin: 10px 12px 8px 0;
  display: flex; flex-direction: column; gap: 8px;
}

/* Logo card */
#logo-card {
  flex: 3;
  background: var(--white);
  border-radius: 24px;
  border: 1.5px solid var(--border);
  box-shadow: 0 8px 20px rgba(22,163,74,0.1);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 16px;
  animation: floatUp 3s ease-in-out infinite;
  text-align: center; gap: 10px;
}
@keyframes floatUp {
  0%,100% { transform: translateY(0);   }
  50%      { transform: translateY(-3px); }
}
#logo-card img { height: 72px; object-fit: contain; border-radius: 16px; }
.right-logo-title { font-size: 14px; font-weight: 800; color: var(--text-dark); letter-spacing: 0.3px; }
.right-logo-sub   { font-size: 10px; color: var(--text-light); font-weight: 500; }

/* QR card */
#qr-card {
  flex: 4;
  background: linear-gradient(135deg, #052e16, #166534);
  border-radius: 24px;
  box-shadow: 0 8px 20px rgba(22,163,74,0.35);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 14px;
  gap: 10px;
  animation: floatDown 3s ease-in-out infinite;
  text-align: center;
}
@keyframes floatDown {
  0%,100% { transform: translateY(0);    }
  50%      { transform: translateY(3px); }
}
.qr-card-label {
  font-size: 10px; font-weight: 800; letter-spacing: 1.4px;
  color: rgba(255,255,255,0.9);
}
.qr-image-wrap {
  position: relative;
  width: 116px; height: 116px;
}
.qr-image-wrap img {
  width: 100%; height: 100%;
  border-radius: 16px;
  padding: 5px; background: #fff;
  display: block;
  box-shadow: 0 0 16px rgba(255,255,255,0.35);
}
.qr-ring {
  position: absolute;
  inset: -6px;
  border-radius: 22px;
  border: 2.5px solid rgba(255,255,255,0.55);
  animation: pulseRingQR 2s ease-out infinite;
}
@keyframes pulseRingQR {
  0%   { transform: scale(1);    opacity:0.9; }
  100% { transform: scale(1.14); opacity:0;   }
}
.qr-text {
  font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.9); line-height: 1.4;
}
.qr-badge {
  background: rgba(255,255,255,0.18);
  border-radius: 20px; padding: 4px 12px;
  font-size: 10px; font-weight: 700; color: #fff; letter-spacing: 0.5px;
}

/* ══════════════════════════════
   MARQUEE TICKER
══════════════════════════════ */
#ticker-bar {
  height: 40px; flex-shrink: 0;
  background: linear-gradient(90deg, #052e16, #166534, #15803d);
  display: flex; align-items: center;
  overflow: hidden;
}
.ticker-info-tab {
  height: 100%;
  padding: 0 18px;
  background: rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 800; letter-spacing: 1.5px;
  color: rgba(255,255,255,0.7);
  flex-shrink: 0;
}
.ticker-divider { width: 1px; height: 100%; background: rgba(255,255,255,0.12); flex-shrink:0; }
#ticker-content {
  flex: 1; overflow: hidden; position: relative;
}
#ticker-text {
  display: inline-block;
  white-space: nowrap;
  font-size: 13px; font-weight: 500; letter-spacing: 0.3px;
  color: rgba(255,255,255,0.75);
  animation: tickerScroll 60s linear infinite;
  padding-left: 100%;
}
@keyframes tickerScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-200%); }
}

/* ══════════════════════════════
   STATUS COLORS (reusable tokens)
══════════════════════════════ */
.s-available  { --sc: #059669; --sb: #ecfdf5; --sbl: #a7f3d0; }
.s-lunch      { --sc: #d97706; --sb: #fffbeb; --sbl: #fde68a; }
.s-late       { --sc: #ea580c; --sb: #fff7ed; --sbl: #fed7aa; }
.s-emergency  { --sc: #dc2626; --sb: #fef2f2; --sbl: #fecaca; }
.s-operation  { --sc: #7c3aed; --sb: #f5f3ff; --sbl: #ddd6fe; }
.s-unavail    { --sc: #dc2626; --sb: #fef2f2; --sbl: #fecaca; }
