/* ════════════════════════════════════════════════════════════════════════
   RxGranted Lead Intelligence — base.css
   Reset · design tokens · global layout · core animations
   ════════════════════════════════════════════════════════════════════════ */

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
button { font-family: inherit; border: 0; background: transparent; cursor: pointer; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; transition: color var(--dur-fast) ease; }
a:hover { color: var(--accent-hover); }
img, svg { display: block; max-width: 100%; }
::selection { background: rgba(59,130,246,0.35); color: var(--text-primary); }

/* ── Scrollbar (subtle, themed) ──────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; border: 2px solid var(--bg-2); }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── Design Tokens ───────────────────────────────────────────────────── */
:root {
  /* Core palette */
  --bg:           #070b14;
  --bg-2:         #0a0e1a;
  --surface:      #0f1724;
  --surface-2:    #161f2e;
  --surface-3:    #1c2840;
  --border:       #1e2d45;
  --border-light: #243551;
  --border-glow:  rgba(59,130,246,0.3);

  /* Accent */
  --accent:          #3b82f6;
  --accent-hover:    #60a5fa;
  --accent-dim:      rgba(59,130,246,0.10);
  --accent-glow:     rgba(59,130,246,0.25);
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);

  /* Text */
  --text-primary:   #f0f6ff;
  --text-secondary: #8fa8c8;
  --text-muted:     #4a6080;

  /* Flag colors */
  --flag-new:        #4a6080;
  --flag-priority:   #f59e0b;
  --flag-contacted:  #06b6d4;
  --flag-interested: #8b5cf6;
  --flag-pass:       #2d3748;
  --flag-converted:  #10b981;

  /* Specialty colors + glows */
  --spec-psychiatry:        #818cf8;
  --spec-psychiatry-glow:   rgba(129,140,248,0.18);
  --spec-rheumatology:      #fb923c;
  --spec-rheumatology-glow: rgba(251,146,60,0.18);
  --spec-dermatology:       #f472b6;
  --spec-dermatology-glow:  rgba(244,114,182,0.18);
  --spec-neurology:         #34d399;
  --spec-neurology-glow:    rgba(52,211,153,0.18);

  /* Semantic */
  --success: #10b981;
  --error:   #ef4444;
  --warn:    #f59e0b;

  /* Geometry */
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow:        0 1px 3px rgba(0,0,0,0.6);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.55);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.6);
  --shadow-accent: 0 0 24px rgba(59,130,246,0.18);

  /* Motion */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast:    120ms;
  --dur-mid:     220ms;
  --dur-slow:    380ms;
}

/* ── Typographic Helpers ─────────────────────────────────────────────── */
.font-display { font-family: 'Syne', 'Inter', sans-serif; letter-spacing: -0.01em; }
.font-mono    { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace; }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ── Page Wrapper ────────────────────────────────────────────────────── */
.page-wrapper { animation: pageIn 0.4s var(--ease-out) both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Background Effects (login + ambient) ───────────────────────────── */
.bg-blobs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-blobs::before,
.bg-blobs::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  will-change: transform;
}
.bg-blobs::before {
  width: 560px; height: 560px;
  background: radial-gradient(circle, rgba(59,130,246,0.15) 0%, transparent 70%);
  top: -120px; left: -120px;
  animation: drift 8s ease-in-out infinite alternate;
}
.bg-blobs::after {
  width: 440px; height: 440px;
  background: radial-gradient(circle, rgba(139,92,246,0.12) 0%, transparent 70%);
  bottom: -100px; right: -100px;
  animation: drift 8s ease-in-out infinite alternate;
  animation-delay: -4s;
}
@keyframes drift {
  0%   { transform: translate(0,0) scale(1); }
  100% { transform: translate(40px,30px) scale(1.1); }
}

/* Subtle grid overlay (premium feel) */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(59,130,246,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 0%, transparent 80%);
}

/* ── Topbar (shared) ─────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: rgba(7,11,20,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 0 rgba(59,130,246,0.1);
}
.topbar-brand {
  display: flex; align-items: baseline; gap: 8px;
  font-family: 'Syne', sans-serif;
}
.topbar-brand .wordmark {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.topbar-brand .subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-link {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  transition: color var(--dur-fast) ease;
}
.topbar-link:hover { color: var(--text-primary); }

/* Animated pulse bar under topbar */
.topbar-pulse {
  position: absolute; bottom: -1px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
  animation: pulseSlide 4s ease-in-out infinite;
  opacity: 0.7;
}
@keyframes pulseSlide {
  0%, 100% { transform: translateX(-50%); opacity: 0.0; }
  50%      { transform: translateX(50%);  opacity: 0.7; }
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  font-size: 13px; font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur-fast) ease, border-color var(--dur-fast),
              color var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-mid);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 14px rgba(59,130,246,0.3);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(59,130,246,0.45);
}
/* Shimmer sweep on hover */
.btn-primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.18) 50%, transparent 100%);
  transform: translateX(-110%);
  transition: transform 0.55s var(--ease-out);
  pointer-events: none;
}
.btn-primary:hover::after { transform: translateX(110%); }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-light);
}
.btn-outline:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: var(--accent-dim);
}

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

.btn-link {
  padding: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
}
.btn-link:hover { color: var(--accent-hover); }

.btn-sm { font-size: 11px; padding: 5px 10px; border-radius: 6px; }
.btn-lg { font-size: 14px; padding: 12px 22px; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Color-themed buttons */
.btn-doximity {
  background: rgba(59,130,246,0.10);
  color: #60a5fa;
  border-color: rgba(59,130,246,0.35);
}
.btn-doximity:hover { background: rgba(59,130,246,0.18); border-color: var(--accent); }
.btn-linkedin {
  background: rgba(99,102,241,0.10);
  color: #a5b4fc;
  border-color: rgba(99,102,241,0.35);
}
.btn-linkedin:hover { background: rgba(99,102,241,0.18); border-color: #818cf8; }

/* ── Pills ───────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text-secondary);
}
.pill-mini { font-size: 10px; padding: 2px 8px; text-transform: none; letter-spacing: 0; }

/* Specialty-colored pills with subtle glow */
.pill-psychiatry {
  background: rgba(129,140,248,0.12); color: var(--spec-psychiatry);
  border-color: rgba(129,140,248,0.25);
  box-shadow: 0 0 10px var(--spec-psychiatry-glow);
}
.pill-rheumatology {
  background: rgba(251,146,60,0.12); color: var(--spec-rheumatology);
  border-color: rgba(251,146,60,0.25);
  box-shadow: 0 0 10px var(--spec-rheumatology-glow);
}
.pill-dermatology {
  background: rgba(244,114,182,0.12); color: var(--spec-dermatology);
  border-color: rgba(244,114,182,0.25);
  box-shadow: 0 0 10px var(--spec-dermatology-glow);
}
.pill-neurology {
  background: rgba(52,211,153,0.12); color: var(--spec-neurology);
  border-color: rgba(52,211,153,0.25);
  box-shadow: 0 0 10px var(--spec-neurology-glow);
}

/* Status/outreach pills */
.pill-status-new        { background: rgba(74,96,128,0.18); color: #94a3b8; border-color: rgba(148,163,184,0.2); }
.pill-status-approved   { background: rgba(16,185,129,0.12); color: #34d399; border-color: rgba(52,211,153,0.25); }
.pill-status-contacted  { background: rgba(6,182,212,0.12); color: #22d3ee; border-color: rgba(34,211,238,0.25); }
.pill-status-replied    { background: rgba(139,92,246,0.12); color: #a78bfa; border-color: rgba(167,139,250,0.25); }
.pill-status-converted  { background: rgba(16,185,129,0.18); color: #6ee7b7; border-color: rgba(110,231,183,0.3); }

/* ── Form Elements ───────────────────────────────────────────────────── */
.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-mid), background var(--dur-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
  cursor: pointer;
}
.textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
         font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }

/* ── Cards & Sections ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--dur-mid), box-shadow var(--dur-mid), transform var(--dur-mid) var(--ease-out);
}

/* ── Skeleton Loading ────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--surface-2) 0%,
    var(--surface-3) 50%,
    var(--surface-2) 100%);
  background-size: 1200px 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--radius);
  display: block;
  height: 14px;
  margin: 4px 0;
}
.skeleton.h-lg { height: 20px; }
.skeleton.h-xl { height: 32px; }
.skeleton.h-card { height: 220px; border-radius: var(--radius-lg); }
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

/* ── Toast System ────────────────────────────────────────────────────── */
.toast-stack {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9999; pointer-events: none;
  max-width: 360px;
}
.toast {
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 12px 18px;
  min-width: 220px;
  font-size: 13px;
  color: var(--text-primary);
  pointer-events: auto;
  animation: toastIn 0.25s var(--ease-out);
  display: flex; align-items: center; gap: 10px;
}
.toast.toast-out { animation: toastOut 0.25s var(--ease-out) forwards; }
.toast.success   { border-left: 3px solid var(--success); }
.toast.error     { border-left: 3px solid var(--error); }
.toast.info      { border-left: 3px solid var(--accent); }
.toast .toast-icon { font-size: 16px; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px) scale(0.95); }
}

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: backdropIn 0.2s ease;
  overflow-y: auto;
}
.modal-backdrop.closing { animation: backdropOut 0.2s ease forwards; }
@keyframes backdropIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdropOut { to   { opacity: 0; } }

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: 0 32px 80px rgba(0,0,0,0.7), var(--shadow-accent);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.3s var(--ease-spring);
}
.modal-card.closing { animation: modalOut 0.2s ease forwards; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.93) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes modalOut {
  to { opacity: 0; transform: scale(0.96) translateY(8px); }
}
.modal-header {
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 1;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.modal-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.modal-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--dur-fast);
}
.modal-close:hover { background: var(--surface-3); color: var(--text-primary); transform: rotate(90deg); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  position: sticky; bottom: 0;
  background: var(--surface);
}

/* ── Utility ─────────────────────────────────────────────────────────── */
.flex     { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-1   { flex: 1; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.gap-6  { gap: 24px; }
.mb-2   { margin-bottom: 8px; }
.mb-3   { margin-bottom: 12px; }
.mb-4   { margin-bottom: 16px; }
.mb-6   { margin-bottom: 24px; }
.mt-2   { margin-top: 8px; }
.mt-4   { margin-top: 16px; }
.mt-6   { margin-top: 24px; }
.text-xs    { font-size: 11px; }
.text-sm    { font-size: 12px; }
.text-md    { font-size: 14px; }
.text-lg    { font-size: 16px; }
.text-xl    { font-size: 20px; }
.text-2xl   { font-size: 24px; }
.text-3xl   { font-size: 30px; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.uppercase     { text-transform: uppercase; letter-spacing: 0.06em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden   { display: none !important; }

/* ── Empty State ─────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
  animation: pageIn 0.4s var(--ease-out);
}
.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}
.empty-state .empty-title {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.empty-state .empty-sub { font-size: 13px; margin-bottom: 16px; }

/* ── Reduced Motion (accessibility) ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
