/* ============================================
   Queue Cure '26 — style.css
   Modern healthcare theme, shared by both screens
   ============================================ */

:root {
  /* ---- Color palette: clinical blue, calm and trustworthy ---- */
  --color-primary: #1565d8;
  --color-primary-dark: #0d3f8f;
  --color-primary-light: #4f8ef0;
  --color-accent: #00b8a9;
  --color-bg: #eef3fb;
  --color-surface: #ffffff;
  --color-surface-alt: #f4f8fd;
  --color-border: #dbe6f5;
  --color-text: #16243b;
  --color-text-muted: #5b6c85;
  --color-success: #1ea672;
  --color-warning: #e0a318;
  --color-danger: #d8473f;

  /* ---- Typography ---- */
  --font-display: 'Sora', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* ---- Shape & shadow ---- */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-soft: 0 4px 18px rgba(21, 60, 130, 0.08);
  --shadow-card: 0 8px 28px rgba(21, 60, 130, 0.10);
  --shadow-pop: 0 14px 40px rgba(21, 60, 130, 0.16);

  --transition: all 0.2s ease;
}

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

html, body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(circle at 8% 8%, rgba(21, 101, 216, 0.07), transparent 40%),
    radial-gradient(circle at 92% 92%, rgba(0, 184, 169, 0.07), transparent 40%);
  background-attachment: fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}

input {
  font-family: inherit;
}

::selection {
  background: var(--color-primary-light);
  color: #fff;
}

/* Visible keyboard focus for accessibility */
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* ============================================
   Top bar (shared header)
   ============================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  box-shadow: var(--shadow-soft);
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.brand-text span {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary);
  padding: 9px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--color-primary-light);
  transition: var(--transition);
}

.nav-link:hover {
  background: var(--color-primary);
  color: #fff;
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-success);
  background: rgba(30, 166, 114, 0.1);
  padding: 7px 14px;
  border-radius: 999px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 0 0 rgba(30, 166, 114, 0.6);
  animation: pulse-dot 1.8s infinite;
}

.live-pill.offline {
  color: var(--color-danger);
  background: rgba(216, 71, 63, 0.1);
}

.live-pill.offline .live-dot {
  background: var(--color-danger);
  animation: none;
}

@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(30, 166, 114, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(30, 166, 114, 0); }
  100% { box-shadow: 0 0 0 0 rgba(30, 166, 114, 0); }
}

/* ============================================
   Layout shell
   ============================================ */
.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.page-subtitle {
  color: var(--color-text-muted);
  font-size: 14.5px;
  margin-bottom: 28px;
}

/* ============================================
   Stat cards
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 5px;
  height: 100%;
  background: linear-gradient(180deg, var(--color-primary), var(--color-accent));
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-pop);
}

.stat-label {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--color-primary-dark);
  line-height: 1;
}

.stat-value.accent {
  color: var(--color-accent);
}

.stat-unit {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-left: 4px;
}

.stat-icon {
  font-size: 16px;
}

/* ============================================
   Panels / cards (general)
   ============================================ */
.panel {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
  margin-bottom: 24px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
}

.panel-title .badge-count {
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 700;
  background: var(--color-surface-alt);
  color: var(--color-primary);
  padding: 3px 10px;
  border-radius: 999px;
  margin-left: 9px;
  border: 1px solid var(--color-border);
}

.grid-two {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr;
  gap: 24px;
  align-items: start;
}

/* ============================================
   Forms
   ============================================ */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 7px;
}

.field input[type="text"],
.field input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--color-text);
  background: var(--color-surface-alt);
  transition: var(--transition);
}

.field input:focus {
  border-color: var(--color-primary);
  background: var(--color-surface);
}

.field-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.field-row .field {
  flex: 1;
  margin-bottom: 0;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 700;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  box-shadow: 0 6px 18px rgba(21, 101, 216, 0.30);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(21, 101, 216, 0.38);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-call-next {
  background: linear-gradient(135deg, var(--color-accent), #009488);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 184, 169, 0.32);
  width: 100%;
  padding: 16px 22px;
  font-size: 16px;
}

.btn-call-next:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 184, 169, 0.40);
}

.btn-call-next:disabled,
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-ghost {
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  border: 1.5px solid var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.btn-block {
  width: 100%;
}

/* ============================================
   Queue list
   ============================================ */
.queue-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}

.queue-list::-webkit-scrollbar {
  width: 6px;
}

.queue-list::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 999px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  animation: slide-in 0.3s ease;
}

.queue-item:first-child {
  border-color: var(--color-primary-light);
  background: linear-gradient(90deg, rgba(21, 101, 216, 0.06), transparent);
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.queue-token {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  min-width: 52px;
  text-align: center;
  flex-shrink: 0;
}

.queue-item:first-child .queue-token {
  background: var(--color-accent);
}

.queue-name {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}

.queue-position {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 600;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 3px 10px;
  border-radius: 999px;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--color-text-muted);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.empty-state-title {
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
  font-size: 15px;
}

.empty-state-sub {
  font-size: 13.5px;
}

/* ============================================
   Toast notifications
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background: var(--color-text);
  color: #fff;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-pop);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.25s ease, toast-out 0.25s ease 2.6s forwards;
  max-width: 320px;
}

.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px); }
}

/* ============================================
   PATIENT WAITING ROOM — TV display style
   ============================================ */
.patient-body {
  background: radial-gradient(ellipse at top, #0f2a5c 0%, #081a3d 55%, #050f24 100%);
  color: #eaf1ff;
  min-height: 100vh;
}

.patient-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 36px 32px 48px;
}

.patient-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.patient-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.patient-brand .brand-mark {
  width: 50px;
  height: 50px;
  font-size: 21px;
}

.patient-brand h1 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

.patient-brand span {
  font-size: 13px;
  color: #93acdd;
  font-weight: 500;
}

.clock {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: #cfe0ff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
}

.current-token-hero {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  padding: 48px;
  text-align: center;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.current-token-hero::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0, 184, 169, 0.18), transparent 70%);
  top: -300px;
  right: -200px;
  pointer-events: none;
}

.hero-label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7fa3e8;
  margin-bottom: 18px;
}

.hero-token {
  font-family: var(--font-display);
  font-size: 140px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff, #9fc4ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: all 0.4s ease;
}

.hero-token.flash {
  animation: flash-update 0.7s ease;
}

@keyframes flash-update {
  0% { transform: scale(1); }
  30% { transform: scale(1.08); text-shadow: 0 0 50px rgba(0, 184, 169, 0.7); }
  100% { transform: scale(1); }
}

.hero-name {
  font-size: 20px;
  font-weight: 600;
  color: #cfe0ff;
  margin-top: 14px;
}

.patient-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.patient-stat-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  backdrop-filter: blur(6px);
}

.patient-stat-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7fa3e8;
  margin-bottom: 12px;
}

.patient-stat-value {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.patient-stat-value .unit {
  font-size: 18px;
  color: #93acdd;
  font-weight: 600;
  margin-left: 6px;
}

.patient-queue-panel {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.patient-queue-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.patient-queue-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.patient-queue-item {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  animation: slide-in 0.3s ease;
}

.patient-queue-item:first-child {
  border-color: rgba(0, 184, 169, 0.6);
  background: rgba(0, 184, 169, 0.12);
}

.patient-queue-token {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.patient-queue-name {
  font-size: 13px;
  color: #93acdd;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.patient-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #7fa3e8;
}

.patient-footer-note {
  text-align: center;
  margin-top: 32px;
  font-size: 13px;
  color: #5f80bc;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
  .grid-two {
    grid-template-columns: 1fr;
  }
  .stats-grid,
  .patient-stats-grid {
    grid-template-columns: 1fr;
  }
  .hero-token {
    font-size: 90px;
  }
  .current-token-hero {
    padding: 32px 20px;
  }
}

@media (max-width: 600px) {
  .shell, .patient-shell {
    padding: 18px;
  }
  .topbar, .patient-topbar {
    padding: 14px 18px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .field-row {
    flex-direction: column;
    align-items: stretch;
  }
  .stat-value {
    font-size: 28px;
  }
  .hero-token {
    font-size: 64px;
  }
  .patient-queue-list {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  .clock {
    font-size: 15px;
    padding: 8px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}