/* Routerr Health — Shared Theme
   Dark-mode design system extracted from dispatcher prototype */

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

/* ── CSS Variables ── */
:root {
  /* Background layers */
  --bg:          #0a0e17;
  --bg-alt:      #0d1321;
  --surface:     #141a2a;
  --surface-2:   #1a2236;
  --surface-3:   #212b40;

  /* Borders */
  --border:      #1e2a42;
  --border-light:#2a3a5c;

  /* Text */
  --text:        #e2e8f0;
  --text-dim:    #8892a8;
  --text-muted:  #5a6478;

  /* Accent / Brand */
  --accent:      #3b82f6;
  --accent-dim:  #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.15);

  /* Status colors */
  --green:       #22c55e;
  --green-dim:   rgba(34, 197, 94, 0.15);
  --blue:        #3b82f6;
  --blue-dim:    rgba(59, 130, 246, 0.15);
  --yellow:      #eab308;
  --yellow-dim:  rgba(234, 179, 8, 0.15);
  --orange:      #f97316;
  --orange-dim:  rgba(249, 115, 22, 0.15);
  --red:         #ef4444;
  --red-dim:     rgba(239, 68, 68, 0.15);
  --purple:      #a855f7;
  --purple-dim:  rgba(168, 85, 247, 0.15);
  --cyan:        #06b6d4;
  --cyan-dim:    rgba(6, 182, 212, 0.15);

  /* Clinician route colors */
  --clin-1: #3b82f6;  /* Marcus – blue */
  --clin-2: #22c55e;  /* Priya  – green */
  --clin-3: #f97316;  /* Jordan – orange */
  --clin-4: #a855f7;  /* Aisha  – purple */
  --clin-5: #06b6d4;  /* Derek  – cyan */

  /* Spacing */
  --gap-xs: 4px;
  --gap-sm: 8px;
  --gap-md: 12px;
  --gap-lg: 16px;
  --gap-xl: 24px;

  /* Radius */
  --radius-sm: 4px;
  --radius:    6px;
  --radius-lg: 10px;
  --radius-xl: 14px;

  /* Shadows */
  --shadow:    0 2px 8px rgba(0,0,0,.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.4);

  /* Fonts */
  --font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Transitions */
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ── Typography ── */
html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Utility classes ── */
.text-dim   { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: 0.85rem; }
.text-xs    { font-size: 0.75rem; }
.text-mono  { font-family: var(--font-mono); }
.font-bold  { font-weight: 700; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.flex     { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-xs   { gap: var(--gap-xs); }
.gap-sm   { gap: var(--gap-sm); }
.gap-md   { gap: var(--gap-md); }
.gap-lg   { gap: var(--gap-lg); }
.gap-xl   { gap: var(--gap-xl); }

.hidden { display: none !important; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-green    { background: var(--green-dim); color: var(--green); }
.badge-blue     { background: var(--blue-dim);  color: var(--blue); }
.badge-yellow   { background: var(--yellow-dim); color: var(--yellow); }
.badge-orange   { background: var(--orange-dim); color: var(--orange); }
.badge-red      { background: var(--red-dim);   color: var(--red); }
.badge-purple   { background: var(--purple-dim); color: var(--purple); }
.badge-cyan     { background: var(--cyan-dim);  color: var(--cyan); }
.badge-gray     { background: rgba(100,116,139,.15); color: #94a3b8; }

/* Status-specific */
.badge-completed      { background: var(--green-dim); color: var(--green); }
.badge-inprogress     { background: var(--blue-dim);  color: var(--blue); }
.badge-enroute        { background: var(--blue-dim);  color: var(--blue); }
.badge-assigned       { background: rgba(100,116,139,.15); color: #94a3b8; }
.badge-scheduled      { background: rgba(100,116,139,.15); color: #94a3b8; }
.badge-readytodispatch { background: var(--cyan-dim); color: var(--cyan); }
.badge-needsreview    { background: var(--orange-dim); color: var(--orange); }
.badge-cancelled      { background: var(--red-dim);   color: var(--red); }
.badge-unassigned     { background: var(--yellow-dim); color: var(--yellow); }
.badge-draft          { background: transparent; color: var(--purple); border: 1.5px dashed var(--purple); }

/* Urgency badges */
.badge-stat       { background: var(--red-dim);   color: var(--red); font-weight: 700; animation: urgPulse 1.5s ease-in-out infinite; }
.badge-routine    { background: rgba(100,116,139,.1); color: #94a3b8; }

@keyframes urgPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-light); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dim); }

.btn-danger {
  background: var(--red-dim);
  border-color: rgba(239,68,68,.3);
  color: var(--red);
}
.btn-danger:hover { background: rgba(239,68,68,.25); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-sm { padding: 4px 10px; font-size: 0.78rem; }
.btn-xs { padding: 2px 8px; font-size: 0.72rem; }

.btn-icon {
  padding: 6px;
  border-radius: var(--radius-sm);
  line-height: 1;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--gap-lg);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-md);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── Toast notification ── */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s var(--ease);
  max-width: 360px;
}

.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--red); }
.toast-info    { border-left: 3px solid var(--accent); }

.toast.fade-out {
  animation: toastOut .3s var(--ease) forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}

/* ── Highlight flash (cross-link) ── */
.highlight-flash {
  animation: flashRow 1.5s var(--ease);
}

@keyframes flashRow {
  0%, 100% { background: transparent; }
  30%      { background: var(--accent-glow); }
}

/* ── Color dot (clinician indicator) ── */
.color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Pill (modality badges) ── */
.pill {
  display: inline-flex;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

/* ── Hover tooltip (Issue #5) — shared across Gantt and other surfaces ── */
.hover-tooltip {
  position: fixed;
  z-index: 10001;
  background: rgba(19,24,32,0.97);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text);
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  max-width: 260px;
  line-height: 1.4;
  opacity: 0;
  transition: opacity .12s;
}
.hover-tooltip.visible { opacity: 1; }
.hover-tooltip-name { font-weight: 700; margin-bottom: 2px; color: var(--text); }
.hover-tooltip-row { font-size: 11px; color: var(--text-dim); display: flex; gap: 6px; align-items: center; }
.hover-tooltip-row svg { flex-shrink: 0; opacity: 0.7; }

/* Leaflet tooltip override for consistency with hover-tooltip */
.leaflet-tooltip.map-tip {
  background: rgba(19,24,32,0.97);
  border: 1px solid var(--border-light);
  color: var(--text);
  font-size: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  padding: 8px 10px;
  border-radius: 6px;
  font-family: inherit;
}
.leaflet-tooltip.map-tip::before { display: none; }

/* ── Loading spinner ── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Map marker pulse (shared across dispatcher + tech-console maps) ── */
@keyframes markerPulse {
  0%   { transform: scale(1);   opacity: 0.5; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ── Tech badge (shared across dispatcher Gantt, schedule-builder Gantt + popover) ── */
.tech-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--border-light), var(--surface-2));
  border: 1.5px solid var(--text-dim);
  flex-shrink: 0;
  color: var(--text);
}
.tech-badge svg { opacity: 0.9; }
.tech-badge-initial {
  position: absolute;
  right: -4px; bottom: -4px;
  min-width: 14px; height: 14px;
  padding: 0 3px;
  border-radius: 7px;
  background: var(--bg);
  border: 1.5px solid var(--text);
  color: var(--text);
  font-size: 9px; font-weight: 800; letter-spacing: -0.3px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

/* ── Neutral person-icon swatch (recommendation panel, anywhere identity hint is needed) ── */
.clin-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ── Map legend — shared between dispatcher and tech console ── */
.legend-section { margin-bottom: 0; }
.legend-subtitle { font-size: 10px; color: var(--text-muted); margin-bottom: 5px; }
.legend-item { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; font-size: 12px; }
.legend-item:last-child { margin-bottom: 0; }
.legend-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 7px 0; }
.legend-pin { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; border: 2px solid white; box-shadow: 0 0 4px rgba(0,0,0,0.3); }
.legend-route-icon { flex-shrink: 0; }
.legend-van { width: 18px; height: 18px; flex-shrink: 0; border-radius: 50%; background: linear-gradient(135deg,#2a3a5c,#1a2236); border: 1.5px solid #e2e8f0; display: flex; align-items: center; justify-content: center; }
