/* ============================================
   AIRLIFT ROUTE EXPLORER
   Aviation-inspired light theme with soft accents
   ============================================ */

:root {
  /* Core Colors - Light aviation palette */
  --bg-deep: #f6f8fb;
  --bg-primary: #ffffff;
  --bg-secondary: #f0f4f8;
  --bg-elevated: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);

  /* Accent Colors - Sky blue aviation style */
  --accent-primary: #0ea5e9;
  --accent-secondary: #0284c7;
  --accent-glow: rgba(14, 165, 233, 0.14);
  --accent-glow-strong: rgba(14, 165, 233, 0.26);

  /* Destination/Route colors */
  --origin-color: #0ea5e9;
  --dest-color: #f97316;
  --route-gradient-start: #0ea5e9;
  --route-gradient-end: #f97316;

  /* Text Colors */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-accent: #0284c7;

  /* Borders & Surfaces */
  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-default: rgba(15, 23, 42, 0.12);
  --border-accent: rgba(14, 165, 233, 0.3);
  --surface-muted: rgba(15, 23, 42, 0.04);

  /* Shadows & Effects */
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.18);
  --shadow-glow: 0 0 40px rgba(14, 165, 233, 0.12);

  /* Spacing & Sizing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Typography */
  --font-display: "Outfit", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-smooth: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   RESET & BASE
   ============================================ */

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

html,
body {
  height: 100%;
  font-family: var(--font-display);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   AMBIENT BACKGROUND EFFECTS
   ============================================ */

.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

.ambient-glow-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(
    circle,
    rgba(0, 212, 255, 0.15) 0%,
    transparent 70%
  );
  top: -200px;
  left: -100px;
  animation: float 20s ease-in-out infinite;
}

.ambient-glow-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(
    circle,
    rgba(255, 107, 53, 0.1) 0%,
    transparent 70%
  );
  bottom: -150px;
  right: -100px;
  animation: float 25s ease-in-out infinite reverse;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(30px, -30px) scale(1.05);
  }
  66% {
    transform: translate(-20px, 20px) scale(0.95);
  }
}

/* ============================================
   MAIN LAYOUT
   ============================================ */

#layout {
  display: flex;
  height: 100%;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* ============================================
   SIDEBAR
   ============================================ */

#sidebar {
  width: 550px;
  min-width: 480px;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(
    180deg,
    var(--bg-primary) 0%,
    var(--bg-secondary) 100%
  );
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  border-right: none;
}

#sidebar::-webkit-scrollbar {
  width: 6px;
}

#sidebar::-webkit-scrollbar-track {
  background: transparent;
}

#sidebar::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--border-accent);
}

/* Sidebar gradient overlay */
#sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(
    180deg,
    rgba(0, 212, 255, 0.03) 0%,
    transparent 100%
  );
  pointer-events: none;
}

/* ============================================
   HEADER / BRAND
   ============================================ */

.header {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  z-index: 1;
}

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

.logo-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    135deg,
    var(--accent-primary) 0%,
    var(--accent-secondary) 100%
  );
  border-radius: var(--radius-md);
  color: var(--bg-deep);
  box-shadow: 0 4px 16px rgba(0, 212, 255, 0.3);
}

.logo-icon svg {
  width: 24px;
  height: 24px;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.logo-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.download-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  font-family: var(--font-display);
  transition: background 0.2s;
}

.download-btn:hover {
  background: rgba(0, 212, 255, 0.2);
}

.download-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* About / Contact — styled like .download-btn, pinned to the top-right */
#aboutBtn {
  margin-left: auto;
}

.about-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
}
.about-modal.hidden {
  display: none;
}
.about-modal-content {
  position: relative;
  max-width: 420px;
  width: calc(100% - 40px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md, 12px);
  padding: 24px 26px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
  color: var(--text-primary);
}
.about-modal-content h3 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
}
.about-modal-content h4 {
  margin: 18px 0 6px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.about-modal-content p {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.about-modal-content .about-contact a {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 600;
}
.about-modal-content .about-contact a:hover {
  text-decoration: underline;
}
.about-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}
.about-close:hover {
  color: var(--text-primary);
}

.download-btn svg {
  width: 13px;
  height: 13px;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pulse {
  width: 8px;
  height: 8px;
  background: var(--accent-primary);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

/* ============================================
   CARDS
   ============================================ */

.card {
  margin: 8px 12px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  position: relative;
  z-index: 1;
}

/* Non-EAS Airport Info Panel */
.non-eas-card {
  padding: 14px;
}

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

.non-eas-code {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.non-eas-name {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.3;
}

.non-eas-location {
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
  margin-top: 3px;
}

.non-eas-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.non-eas-badge.type-1 {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.non-eas-badge.type-3 {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Legend */
.legend-card {
  padding: 10px 14px;
  display: flex;
  flex-direction: row;
  gap: 14px;
  flex-wrap: wrap;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Airport tooltip */
.airport-tooltip .mapboxgl-popup-content {
  background: rgba(15, 23, 42, 0.92);
  color: #f1f5f9;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.5;
  backdrop-filter: blur(8px);
  max-width: 220px;
}

.airport-tooltip .mapboxgl-popup-tip {
  border-top-color: rgba(15, 23, 42, 0.92);
}

.airport-tooltip .tooltip-type {
  font-size: 11px;
  opacity: 0.7;
  font-style: normal;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 212, 255, 0.3),
    transparent
  );
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.card-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-glow);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  color: var(--accent-primary);
  flex-shrink: 0;
}

.card-icon svg {
  width: 20px;
  height: 20px;
}

.card-title h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.card-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================
   ORIGIN CARD SPECIFICS
   ============================================ */

.origin-card {
  flex-shrink: 0;
  z-index: 20; /* Must be above other cards so the dropdown panel paints over them */
}

/* ── Label type tags {Type X} ── */
.label-type {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.75;
  letter-spacing: 0.02em;
}

.legend-type {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.75;
}

/* ── Custom Airport Dropdown ── */
.origin-dropdown {
  position: relative;
  margin-bottom: 10px;
}

.origin-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: all var(--transition-base);
  user-select: none;
}

.origin-dropdown-trigger:hover {
  border-color: var(--border-accent);
}

.origin-dropdown-trigger.open {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.origin-trigger-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}

.origin-trigger-text.has-value {
  color: var(--text-primary);
}

.select-arrow {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.select-arrow svg {
  width: 100%;
  height: 100%;
}

.origin-dropdown-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-primary);
  border-top: none;
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 200;
  display: flex;
  flex-direction: column;
  max-height: 300px;
  overflow: hidden;
}

.origin-dropdown-panel.hidden {
  display: none;
}

.origin-dropdown-search {
  position: relative;
  padding: 8px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.origin-dropdown-search .search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

#originSearchInput {
  width: 100%;
  padding: 7px 10px 7px 34px;
  background: var(--surface-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast);
}

#originSearchInput::placeholder {
  color: var(--text-muted);
}

#originSearchInput:focus {
  border-color: var(--border-accent);
}

.origin-dropdown-list {
  overflow-y: auto;
  flex: 1;
}

.origin-dropdown-list::-webkit-scrollbar { width: 6px; }
.origin-dropdown-list::-webkit-scrollbar-track { background: transparent; }
.origin-dropdown-list::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}
.origin-dropdown-list::-webkit-scrollbar-thumb:hover {
  background: var(--border-accent);
}

.origin-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-subtle);
}

.origin-dropdown-item:last-child {
  border-bottom: none;
}

.origin-dropdown-item:hover {
  background: var(--accent-glow);
}

.origin-dropdown-item.selected {
  background: var(--accent-glow-strong);
}

.origin-dropdown-item.selected .origin-dropdown-item-code {
  color: var(--accent-primary);
}

.airport-type-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.origin-dropdown-item-code {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  flex-shrink: 0;
  min-width: 48px;
}

.origin-dropdown-item-name {
  font-size: 14px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.origin-dropdown-item-city {
  color: var(--text-muted);
  font-size: 12px;
}

.origin-dropdown-clear .origin-dropdown-item-name {
  color: var(--text-muted);
  font-style: italic;
}

.origin-dropdown-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

.origin-stats {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-highlight {
  color: var(--accent-primary);
  font-weight: 600;
}

/* ============================================
   DEMOGRAPHICS SECTION
   ============================================ */

.demo-section {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.demo-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.demo-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.demo-county {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

.demo-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.demo-col-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}

.demo-col-feature {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex: 1;
}

.demo-col-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.demo-col-value {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.demo-col-contrib {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  min-width: 100px;
  text-align: right;
}

.demo-category-header {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 8px 0 3px 0;
  border-bottom: 1px solid var(--border);
  margin-top: 2px;
}

.demo-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 22px;
}

.demo-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex: 1;
  min-width: 0;
}

.demo-value-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.demo-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.demo-contrib {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  min-width: 100px;
  text-align: right;
}

/* ============================================
   ML PREDICTION PANEL
   ============================================ */

.ml-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

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

.ml-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #888);
}

.ml-verdict {
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 10px;
  letter-spacing: 0.03em;
}
.ml-verdict.viable   { background: #1a3a2a; color: #4ade80; }
.ml-verdict.borderline { background: #3a2e10; color: #fbbf24; }
.ml-verdict.unlikely { background: #3a1a1a; color: #f87171; }

.ml-score-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.ml-score-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ml-score-label {
  font-size: 12px;
  color: var(--text-muted, #888);
  line-height: 1.3;
}

.ml-score-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
}

.ml-score-bar-wrap {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
  margin: 2px 0;
}

.ml-score-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}


.ml-contrib-high-up   { color: #15803d; }  /* dark green */
.ml-contrib-high-down { color: #dc2626; }  /* red — already readable */
.ml-contrib-med-up    { color: #166534; }  /* medium dark green */
.ml-contrib-med-down  { color: #b91c1c; }  /* darker red */
.ml-contrib-low-up    { color: #4b7a5e; }  /* muted green */
.ml-contrib-low-down  { color: #6b7280; }  /* neutral gray */

/* ============================================
   DESTINATIONS CARD
   ============================================ */

.destinations-card {
  display: flex;
  flex-direction: column;
}

.search-wrapper {
  position: relative;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

#searchBox {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 14px;
  transition: all var(--transition-base);
}

#searchBox::placeholder {
  color: var(--text-muted);
}

#searchBox:hover {
  border-color: var(--border-accent);
}

#searchBox:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ============================================
   TABLE
   ============================================ */

#tableWrap {
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--surface-muted);
}

/* Custom scrollbar */
#tableWrap::-webkit-scrollbar {
  width: 8px;
}

#tableWrap::-webkit-scrollbar-track {
  background: transparent;
}

#tableWrap::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 4px;
}

#tableWrap::-webkit-scrollbar-thumb:hover {
  background: var(--border-accent);
}

#destTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

#destTable th,
#destTable td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Column widths */
#destTable th:nth-child(1),
#destTable td:nth-child(1) {
  width: 30%;
} /* Destination */
#destTable th:nth-child(2),
#destTable td:nth-child(2) {
  width: 12%;
  text-align: center;
} /* Weekly */
#destTable th:nth-child(3),
#destTable td:nth-child(3) {
  width: 14%;
  text-align: center;
} /* Seats */
#destTable th:nth-child(4),
#destTable td:nth-child(4) {
  width: 28%;
} /* Operator */
#destTable th:nth-child(5),
#destTable td:nth-child(5) {
  width: 16%;
  text-align: right;
} /* Miles */

#destTable thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

#destTable thead th {
  background: var(--bg-secondary);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.th-content {
  display: flex;
  align-items: center;
  gap: 6px;
}

.th-icon {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

#destTable tbody tr {
  transition: background var(--transition-fast);
  cursor: pointer;
}

#destTable tbody tr:hover {
  background: var(--accent-glow);
}

#destTable tbody tr.selected {
  background: var(--accent-glow-strong);
}

#destTable tbody tr.selected td:first-child {
  box-shadow: inset 3px 0 0 var(--accent-primary);
}

#destTable tbody td {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

#destTable tbody td:first-child {
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  background: rgba(255, 107, 53, 0.12);
  border: 1px solid rgba(255, 107, 53, 0.2);
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
  color: var(--dest-color);
  margin-left: 4px;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.airline-name {
  display: inline;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.muted {
  color: var(--text-muted) !important;
  font-style: italic;
  text-align: center;
  padding: 40px 20px !important;
}

/* ============================================
   SIDEBAR FOOTER
   ============================================ */

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-muted);
  flex-shrink: 0;
}

.hint {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.hint svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--accent-primary);
}

.footer-meta {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.6;
}

/* ============================================
   MAP CONTAINER
   ============================================ */

#map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
}

/* Mapbox overrides for dark theme */
.mapboxgl-ctrl-group {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-default) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-md) !important;
  overflow: hidden;
}

.mapboxgl-ctrl-group button {
  background: transparent !important;
  border: none !important;
  width: 36px !important;
  height: 36px !important;
}

.mapboxgl-ctrl-group button + button {
  border-top: 1px solid var(--border-subtle) !important;
}

.mapboxgl-ctrl-group button:hover {
  background: var(--accent-glow) !important;
}

.mapboxgl-ctrl-group button .mapboxgl-ctrl-icon {
  filter: none;
}

/* ============================================
   MAP OVERLAYS
   ============================================ */

.map-overlay-top {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
}

.compass {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 50%;
  backdrop-filter: blur(12px);
  color: var(--accent-primary);
}

.compass svg {
  width: 28px;
  height: 28px;
}

.map-legend {
  position: absolute;
  bottom: 24px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  font-size: 12px;
  color: var(--text-secondary);
  z-index: 10;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(15, 23, 42, 0.2);
}

.origin-dot {
  background: var(--origin-color);
  box-shadow: 0 0 8px var(--origin-color);
}

.dest-dot {
  background: var(--dest-color);
  box-shadow: 0 0 8px var(--dest-color);
}

.legend-line {
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, var(--origin-color), var(--dest-color));
  border-radius: 2px;
}

.legend-label {
  color: var(--text-muted);
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

.card {
  animation: fadeIn 0.4s ease backwards;
}

.origin-card {
  animation-delay: 0.1s;
}
.destinations-card {
  animation-delay: 0.2s;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 900px) {
  #sidebar {
    width: 340px;
    min-width: 300px;
  }

  .card {
    margin: 12px;
    padding: 16px;
  }
}

@media (max-width: 768px) {
  #layout {
    flex-direction: column;
  }

  #sidebar {
    width: 100%;
    max-width: none;
    height: 50%;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  #map-container {
    height: 50%;
  }

  .ambient-glow {
    display: none;
  }

  #hist-panel {
    display: none;
  }
}

/* ============================================
   HISTOGRAM RIGHT PANEL
   ============================================ */

#hist-panel {
  width: 380px;
  min-width: 340px;
  max-width: 400px;
  background: var(--bg-primary);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow-y: scroll;
  padding: 10px 8px 20px;
  gap: 0;
  flex-shrink: 0;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  scrollbar-width: thin;
  scrollbar-color: var(--border-accent) var(--bg-secondary);
}

#hist-panel::-webkit-scrollbar { width: 7px; }
#hist-panel::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}
#hist-panel::-webkit-scrollbar-thumb {
  background: var(--border-accent);
  border-radius: 4px;
}
#hist-panel::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

#hist-panel.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  border-left: none;
}

.demo-item.has-tooltip {
  cursor: help;
}

.demo-item.has-tooltip:hover {
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
}

.hist-panel-header {
  padding: 6px 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 8px;
}

.hist-panel-header h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 3px;
}

.hist-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
}

.hist-card {
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.hist-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.hist-canvas-wrap {
  height: 130px;
  position: relative;
}

/* ============================================
   PANEL TOGGLE PILLS
   ============================================ */

.panel-toggle-pill {
  position: absolute;
  top: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: var(--shadow-md);
  transition: background var(--transition-fast), color var(--transition-fast),
              box-shadow var(--transition-fast);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.panel-toggle-pill:hover {
  background: #ffffff;
  color: var(--accent-primary);
  box-shadow: var(--shadow-lg);
}

.panel-toggle-pill-left {
  left: 16px;
}

.panel-toggle-pill-right {
  right: 16px;
}

.pill-arrow {
  font-size: 13px;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.panel-toggle-pill:hover .pill-arrow {
  color: var(--accent-primary);
}
