/* ==========================================================================
   SamaRX — Real-Time Pharmacy Inventory Intelligence for Prescribers
   Custom Clinical Design System (Vanilla CSS)
   ========================================================================== */

:root {
  /* Color Palette - Clinical Dark (Default) */
  --bg-primary: #090e17;
  --bg-secondary: #101726;
  --bg-surface: #172235;
  --bg-surface-hover: #1e2c45;
  --bg-card: rgba(23, 34, 53, 0.85);
  --bg-glass: rgba(16, 23, 38, 0.75);

  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #0ea5e9;
  --border-subtle: rgba(255, 255, 255, 0.04);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-heading: #ffffff;

  /* Brand Accents */
  --brand-cyan: #0ea5e9;
  --brand-cyan-glow: rgba(14, 165, 233, 0.25);
  --brand-teal: #14b8a6;
  --brand-navy: #0f172a;

  /* Clinical Status Colors */
  --status-in-stock: #10b981;
  --status-in-stock-bg: rgba(16, 185, 129, 0.12);
  --status-in-stock-border: rgba(16, 185, 129, 0.3);

  --status-low-stock: #f59e0b;
  --status-low-stock-bg: rgba(245, 158, 11, 0.12);
  --status-low-stock-border: rgba(245, 158, 11, 0.3);

  --status-out-of-stock: #ef4444;
  --status-out-of-stock-bg: rgba(239, 68, 68, 0.12);
  --status-out-of-stock-border: rgba(239, 68, 68, 0.3);

  --status-backorder: #a855f7;
  --status-backorder-bg: rgba(168, 85, 247, 0.12);
  --status-backorder-border: rgba(168, 85, 247, 0.3);

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.55);
  --shadow-glow-cyan: 0 0 20px rgba(14, 165, 233, 0.2);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Clinical Light Mode */
body.theme-light {
  --bg-primary: #f4f6fa;
  --bg-secondary: #ffffff;
  --bg-surface: #f8fafc;
  --bg-surface-hover: #eef2f6;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-glass: rgba(255, 255, 255, 0.85);

  --border-color: #e2e8f0;
  --border-focus: #0284c7;
  --border-subtle: #edf2f7;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-heading: #090e17;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.12);
  --shadow-glow-cyan: 0 0 15px rgba(2, 132, 199, 0.15);
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */

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

html, body {
  min-height: 100vh;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  color: var(--text-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
}

a {
  color: var(--brand-cyan);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  text-decoration: underline;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* Utility Helpers */
.text-cyan { color: var(--brand-cyan) !important; }
.text-teal { color: var(--brand-teal) !important; }
.text-success { color: var(--status-in-stock) !important; }
.text-warning { color: var(--status-low-stock) !important; }
.text-danger { color: var(--status-out-of-stock) !important; }
.text-purple { color: var(--status-backorder) !important; }
.text-muted { color: var(--text-muted) !important; }
.font-mono { font-family: var(--font-mono); }
.text-xs { font-size: 12px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

/* ==========================================================================
   Badges & Pills
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-in-stock {
  background: var(--status-in-stock-bg);
  color: var(--status-in-stock);
  border: 1px solid var(--status-in-stock-border);
}

.badge-low-stock {
  background: var(--status-low-stock-bg);
  color: var(--status-low-stock);
  border: 1px solid var(--status-low-stock-border);
}

.badge-out-of-stock {
  background: var(--status-out-of-stock-bg);
  color: var(--status-out-of-stock);
  border: 1px solid var(--status-out-of-stock-border);
}

.badge-backorder {
  background: var(--status-backorder-bg);
  color: var(--status-backorder);
  border: 1px solid var(--status-backorder-border);
}

.badge-critical {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.badge-moderate {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-info {
  background: rgba(14, 165, 233, 0.15);
  color: var(--brand-cyan);
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-in-stock);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ==========================================================================
   Buttons & Controls
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand-cyan);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}
.btn-primary:hover {
  background: #0284c7;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

.btn-success {
  background: var(--status-in-stock);
  color: #ffffff;
}
.btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-secondary);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
}
.btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

/* ==========================================================================
   Header Navigation
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--brand-cyan), var(--brand-teal));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #ffffff;
  font-size: 18px;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.4);
}

.brand-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-heading);
}

.brand-name span {
  color: var(--brand-cyan);
}

.brand-tag {
  font-size: 11px;
  padding: 2px 6px;
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.3);
  border-radius: 4px;
  color: var(--brand-cyan);
  font-weight: 600;
  text-transform: uppercase;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.nav-tab-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}
.nav-tab-btn:hover {
  color: var(--text-primary);
}
.nav-tab-btn.active {
  background: var(--bg-secondary);
  color: var(--brand-cyan);
  box-shadow: var(--shadow-sm);
}

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

.api-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
.api-status-pill:hover {
  border-color: var(--brand-cyan);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-in-stock);
  box-shadow: 0 0 8px var(--status-in-stock);
  animation: pulseGlow 2s infinite;
}

.prescriber-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.prescriber-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1e293b;
  color: var(--brand-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid rgba(14, 165, 233, 0.4);
}

/* ==========================================================================
   Main Application Layout
   ========================================================================== */

.app-main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
  min-height: calc(100vh - 70px);
}

/* ==========================================================================
   Hero & Search Bar
   ========================================================================== */

.search-hero-container {
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.search-hero-container::after {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.12) 0%, rgba(14, 165, 233, 0) 70%);
  pointer-events: none;
}

.hero-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.hero-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 650px;
}

.search-bar-composite {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1fr auto;
  gap: 10px;
  background: var(--bg-surface);
  padding: 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast);
}
.search-bar-composite:focus-within {
  border-color: var(--brand-cyan);
  box-shadow: var(--shadow-glow-cyan);
}

.search-input-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-field-wrap .search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-main-input {
  width: 100%;
  background: transparent;
  border: none;
  padding: 10px 12px 10px 38px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  outline: none;
}
.search-main-input::placeholder {
  color: var(--text-muted);
}

.strength-select-wrap, .zip-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  padding: 0 10px;
}

.form-select, .form-input-sub {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 8px 4px;
  outline: none;
  font-size: 13px;
  font-weight: 500;
}
.form-select option {
  background: #172235;
  color: #f8fafc;
}

.quick-category-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.quick-pill-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.quick-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 4px;
}
.quick-pill:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}
.quick-pill.active {
  background: rgba(14, 165, 233, 0.15);
  border-color: var(--brand-cyan);
  color: var(--brand-cyan);
  font-weight: 600;
}

/* ==========================================================================
   Active Drug Header & Shortage Notification
   ========================================================================== */

.active-drug-banner {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.drug-title-area {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.drug-main-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-heading);
}

.drug-generic-name {
  font-size: 14px;
  color: var(--text-secondary);
  font-style: italic;
}

.drug-meta-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.meta-chip {
  font-size: 12px;
  padding: 3px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.fda-alert-box {
  width: 100%;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: #fca5a5;
}

/* ==========================================================================
   Filter Toolbar & View Switcher
   ========================================================================== */

.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-group-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.filter-checkbox input {
  accent-color: var(--brand-cyan);
  cursor: pointer;
}

.radius-select-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.radius-select-wrap select {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.view-mode-toggle {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 3px;
  border-radius: var(--radius-md);
}

.view-mode-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.view-mode-btn.active {
  background: var(--bg-secondary);
  color: var(--brand-cyan);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Pharmacy Stock Results Cards & Table
   ========================================================================== */

.pharmacy-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(430px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.pharmacy-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.pharmacy-card:hover {
  border-color: rgba(14, 165, 233, 0.3);
  box-shadow: var(--shadow-md);
}
.pharmacy-card.highlight-card {
  border-color: var(--brand-cyan);
}

.pharmacy-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.pharmacy-name-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pharmacy-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-heading);
}

.pharmacy-address {
  font-size: 13px;
  color: var(--text-muted);
}

.distance-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-cyan);
  background: rgba(14, 165, 233, 0.1);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.stock-status-row {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stock-count-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stock-primary-label {
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stock-sub-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.pharmacy-specs-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.spec-entry {
  display: flex;
  align-items: center;
  gap: 6px;
}

.spec-entry strong {
  color: var(--text-primary);
}

.pharmacy-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.prescriber-direct-phone {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--brand-cyan);
  display: flex;
  align-items: center;
  gap: 4px;
}

.action-buttons-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   Alternatives Recommendation Widget
   ========================================================================== */

.alternatives-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}

.alternatives-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.alternatives-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
}

.alt-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: all var(--transition-fast);
}
.alt-card:hover {
  border-color: var(--brand-cyan);
}

.alt-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.alt-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-heading);
}

.alt-rationale {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.alt-safety-note {
  font-size: 11px;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.08);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.alt-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   Map & Radar View
   ========================================================================== */

.map-radar-wrapper {
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

.map-overlay-header {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 10;
}

.map-title-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.map-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.legend-dot.in-stock { background: var(--status-in-stock); }
.legend-dot.low-stock { background: var(--status-low-stock); }
.legend-dot.out-of-stock { background: var(--status-out-of-stock); }
.legend-dot.backorder { background: var(--status-backorder); }

.map-svg-canvas {
  width: 100%;
  height: 480px;
  display: block;
}

.radar-node-pulse {
  animation: mapPulse 2s infinite ease-out;
}

/* ==========================================================================
   Modals & Drawers
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 620px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.25s ease;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}
.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-surface);
}

/* Form Styles inside Modals */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}
.form-input:focus {
  border-color: var(--brand-cyan);
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Receipt / Voucher Box */
.voucher-ticket {
  background: #0f172a;
  border: 1px dashed rgba(14, 165, 233, 0.4);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.voucher-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

/* Shortage Radar Tab */
.shortage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 18px;
}

.shortage-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.shortage-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.shortage-drug-title {
  font-size: 18px;
  margin-top: 4px;
}

.supply-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  margin-bottom: 14px;
  overflow: hidden;
}

.supply-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.shortage-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
}

.shortage-reason-box {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.clinical-guidance-box {
  font-size: 12px;
  color: var(--brand-teal);
  background: rgba(20, 184, 166, 0.08);
  border-left: 3px solid var(--brand-teal);
  padding: 10px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 16px;
}

.shortage-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

/* API Monitor Dialog */
.api-monitor-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 20px;
}

.api-monitor-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 780px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.api-monitor-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.api-monitor-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.sim-controls-panel {
  background: var(--bg-surface);
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.sim-title {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--brand-cyan);
}

.sim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

.api-connector-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 8px;
}

.connector-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connector-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.connector-indicator.online {
  background: var(--status-in-stock);
  box-shadow: 0 0 8px var(--status-in-stock);
}

.connector-specs {
  display: flex;
  align-items: center;
  gap: 20px;
  text-align: right;
}

.spec-col {
  display: flex;
  flex-direction: column;
}

.spec-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.spec-val {
  font-size: 12px;
  font-weight: 600;
}

.api-monitor-footer {
  padding: 16px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes pulseGlow {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

@keyframes mapPulse {
  0% { r: 12; opacity: 0.4; }
  50% { r: 24; opacity: 0.1; }
  100% { r: 30; opacity: 0; }
}

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

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   Mobile Phone App Layout & NPI Authentication Screen
   ========================================================================== */

/* NPI Authentication Gateway Screen */
.npi-auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 20%, #101c30 0%, #090e17 100%);
}

.npi-auth-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 460px;
  width: 100%;
  padding: 32px 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
}

.npi-auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-cyan), var(--brand-teal));
}

.npi-logo-badge {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--brand-cyan), var(--brand-teal));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #ffffff;
  margin: 0 auto 16px auto;
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.4);
}

.npi-input-hero {
  position: relative;
  margin: 20px 0 16px 0;
}

.npi-input-field {
  width: 100%;
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px 14px 44px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-align: center;
  outline: none;
  transition: all var(--transition-fast);
}
.npi-input-field:focus {
  border-color: var(--brand-cyan);
  box-shadow: var(--shadow-glow-cyan);
  background: #1e2c45;
}

.npi-icon-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--text-muted);
}

.npi-quick-picker {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 18px 0;
}

.npi-demo-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-top: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.npi-demo-chip:hover {
  border-color: var(--brand-cyan);
  background: var(--bg-surface-hover);
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(16, 23, 38, 0.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  z-index: 999;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom)) 12px;
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}
.mobile-nav-item .nav-icon {
  font-size: 18px;
}
.mobile-nav-item.active {
  color: var(--brand-cyan);
}

/* Mobile App Install Banner */
.pwa-install-banner {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.15), rgba(20, 184, 166, 0.15));
  border: 1px solid rgba(14, 165, 233, 0.3);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  .app-header .nav-tabs {
    display: none; /* Replaced by mobile bottom nav */
  }

  .mobile-bottom-nav {
    display: flex;
  }

  .app-main {
    padding: 14px 14px calc(80px + env(safe-area-inset-bottom)) 14px;
  }

  .search-hero-container {
    padding: 18px 16px;
  }

  .hero-title {
    font-size: 19px;
  }

  .search-bar-composite {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 6px;
  }

  .pharmacy-results-grid {
    grid-template-columns: 1fr;
  }

  .modal-dialog {
    max-width: 100%;
    margin: 10px;
    max-height: 90vh;
  }

  .form-row-2col {
    grid-template-columns: 1fr;
  }

  .shortage-grid {
    grid-template-columns: 1fr;
  }
}
