/* ============================================
   NEARBY AIRPORTS EXPLORER - PREMIUM DESIGN SYSTEM
   Mobile-first responsive CSS
   ============================================ */

/* ----------------------------------------
   1. DESIGN TOKENS (CSS Custom Properties)
   ---------------------------------------- */
:root {
  /* Primary Color Palette - Aviation Blue/Cyan */
  --color-primary-50: #eff6ff;
  --color-primary-100: #dbeafe;
  --color-primary-200: #bfdbfe;
  --color-primary-300: #93c5fd;
  --color-primary-400: #60a5fa;
  --color-primary-500: #3b82f6;
  --color-primary-600: #2563eb;
  --color-primary-700: #1d4ed8;
  --color-primary-800: #1e40af;
  --color-primary-900: #1e3a8a;

  /* Accent Colors */
  --color-cyan-400: #22d3ee;
  --color-cyan-500: #06b6d4;
  --color-cyan-600: #0891b2;
  --color-emerald-400: #34d399;
  --color-emerald-500: #10b981;
  --color-amber-500: #f59e0b;
  --color-rose-500: #f43f5e;
  --color-rose-600: #e11d48;

  /* Neutral Scale */
  --color-neutral-25: #fcfcfd;
  --color-neutral-50: #f9fafb;
  --color-neutral-100: #f3f4f6;
  --color-neutral-200: #e5e7eb;
  --color-neutral-300: #d1d5db;
  --color-neutral-400: #9ca3af;
  --color-neutral-500: #6b7280;
  --color-neutral-600: #4b5563;
  --color-neutral-700: #374151;
  --color-neutral-800: #1f2937;
  --color-neutral-900: #111827;
  --color-neutral-950: #030712;

  /* Spacing Scale (4px base) */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

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

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;

  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;
  --radius-3xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
  --shadow-glow-primary: 0 0 20px rgb(59 130 246 / 0.35);
  --shadow-glow-cyan: 0 0 20px rgb(6 182 212 / 0.35);

  /* Transitions */
  --duration-75: 75ms;
  --duration-100: 100ms;
  --duration-150: 150ms;
  --duration-200: 200ms;
  --duration-300: 300ms;
  --duration-500: 500ms;

  --ease-linear: linear;
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-index Scale */
  --z-base: 0;
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-fixed: 30;
  --z-sidebar: 35;
  --z-backdrop: 40;
  --z-modal: 9999;
  --z-tooltip: 10000;

  /* Layout */
  --sidebar-width: 320px;
  --sidebar-toggle-width: 48px;
  --header-height: 64px;
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
}

/* ----------------------------------------
   2. CSS RESET & BASE STYLES
   ---------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-neutral-900);
  background: linear-gradient(180deg, var(--color-neutral-50) 0%, white 50%, var(--color-neutral-100) 100%);
  min-height: 100vh;
  min-height: 100dvh;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

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

ul, ol {
  list-style: none;
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--color-primary-500);
  outline-offset: 2px;
}

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

/* ----------------------------------------
   3. TYPOGRAPHY UTILITIES
   ---------------------------------------- */
.text-overline {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--color-primary-600);
}

.text-h1 {
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  color: var(--color-neutral-900);
}

.text-h2 {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  line-height: var(--leading-snug);
  color: var(--color-neutral-900);
}

.text-h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  line-height: var(--leading-snug);
  color: var(--color-neutral-900);
}

.text-body {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-neutral-700);
}

.text-body-sm {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--color-neutral-700);
}

.text-caption {
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--color-neutral-600);
}

@media (min-width: 640px) {
  .text-h1 {
    font-size: var(--text-3xl);
  }
  .text-h2 {
    font-size: var(--text-2xl);
  }
}

@media (min-width: 1024px) {
  .text-h1 {
    font-size: var(--text-4xl);
  }
}

/* ----------------------------------------
   4. APP SHELL & LAYOUT
   ---------------------------------------- */
.app-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: -1;
}

.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.6;
}

.bg-blob--primary {
  width: 400px;
  height: 400px;
  background: var(--color-cyan-400);
  top: -100px;
  left: -100px;
}

.bg-blob--secondary {
  width: 500px;
  height: 500px;
  background: var(--color-primary-200);
  bottom: -150px;
  right: -150px;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* ----------------------------------------
   5. SIDEBAR / HISTORY PANEL
   ---------------------------------------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  z-index: var(--z-sidebar);
  pointer-events: none;
}

.sidebar > * {
  pointer-events: auto;
}

.sidebar__content {
  width: var(--sidebar-width);
  max-width: 85vw;
  background: linear-gradient(180deg, var(--color-neutral-25) 0%, white 100%);
  border-right: 1px solid var(--color-neutral-200);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  box-shadow: var(--shadow-xl);
  padding-top: var(--safe-area-top);
}

.sidebar[data-state="expanded"] .sidebar__content,
html.sidebar-expanded .sidebar__content {
  transform: translateX(0);
}

.sidebar__header {
  padding: var(--space-5);
  padding-right: calc(var(--space-5) + 48px); /* Extra space for toggle button */
  border-bottom: 1px solid var(--color-neutral-100);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  flex-shrink: 0;
}

.sidebar__title-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar__description {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  color: var(--color-neutral-600);
  border-bottom: 1px solid var(--color-neutral-100);
  flex-shrink: 0;
}

.sidebar__scroll {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  scrollbar-width: thin;
  scrollbar-color: var(--color-neutral-300) transparent;
}

.sidebar__scroll::-webkit-scrollbar {
  width: 6px;
}

.sidebar__scroll::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar__scroll::-webkit-scrollbar-thumb {
  background: var(--color-neutral-300);
  border-radius: var(--radius-full);
}

/* Sidebar Toggle Button - Fixed at top left, chevron arrow */
.sidebar__toggle {
  position: fixed;
  left: var(--space-3);
  top: var(--space-3);
  width: 40px;
  height: 40px;
  background: white;
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  z-index: var(--z-sidebar);
  transition: all var(--duration-200) var(--ease-out);
}

/* When expanded, position at right edge of sidebar */
.sidebar[data-state="expanded"] .sidebar__toggle,
html.sidebar-expanded .sidebar__toggle {
  left: calc(var(--sidebar-width) - 40px - var(--space-3));
  background: var(--color-neutral-50);
}

@media (max-width: 767px) {
  .sidebar[data-state="expanded"] .sidebar__toggle,
  html.sidebar-expanded .sidebar__toggle {
    left: calc(min(var(--sidebar-width), 85vw) - 40px - var(--space-3));
  }
}

.sidebar__toggle:hover {
  background: var(--color-neutral-100);
  box-shadow: var(--shadow-lg);
}

.sidebar__toggle-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-neutral-700);
}

/* Show open icon (panel-left-open) when collapsed, hide close icon */
.sidebar__toggle-icon--open {
  display: flex;
}
.sidebar__toggle-icon--close {
  display: none;
}

/* When expanded: show close icon (panel-left-close), hide open icon */
.sidebar[data-state="expanded"] .sidebar__toggle-icon--open,
html.sidebar-expanded .sidebar__toggle-icon--open {
  display: none;
}
.sidebar[data-state="expanded"] .sidebar__toggle-icon--close,
html.sidebar-expanded .sidebar__toggle-icon--close {
  display: flex;
}

/* Hide the label - using icon only */
.sidebar__toggle-label {
  display: none;
}

/* Sidebar Backdrop (mobile) */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(15 23 42 / 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  z-index: calc(var(--z-sidebar) - 1);
}

.sidebar[data-state="expanded"] ~ .sidebar-backdrop,
html.sidebar-expanded .sidebar-backdrop {
  opacity: 1;
  visibility: visible;
}

/* Desktop: hide backdrop, push content */
@media (min-width: 768px) {
  .sidebar-backdrop {
    display: none;
  }
}

/* ----------------------------------------
   6. MAIN CONTENT AREA
   ---------------------------------------- */
.main-content {
  flex: 1;
  min-width: 0;
  margin-left: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

/* When sidebar is expanded, push content on desktop */
/* Using both html.sidebar-expanded (immediate) and data-state (runtime) for flicker-free loading */
@media (min-width: 768px) {
  .sidebar[data-state="expanded"] ~ .main-content,
  html.sidebar-expanded .main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
  }
}

/* On mobile, content stays full width, sidebar overlays */
@media (max-width: 767px) {
  .sidebar[data-state="expanded"] ~ .main-content,
  html.sidebar-expanded .main-content {
    margin-left: 0;
  }
}

.content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  padding-top: calc(var(--space-4) + 52px); /* Space for toggle button */
  padding-bottom: calc(var(--space-8) + var(--safe-area-bottom));
}

@media (min-width: 640px) {
  .content-scroll {
    padding: var(--space-6);
    padding-top: calc(var(--space-6) + 52px);
  }
}

@media (min-width: 1024px) {
  .content-scroll {
    padding: var(--space-8) var(--space-10);
    padding-top: calc(var(--space-8) + 52px);
  }
}

.content-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

@media (min-width: 1024px) {
  .content-wrapper {
    gap: var(--space-8);
  }
}

/* ----------------------------------------
   7. HEADER
   ---------------------------------------- */
.app-header {
  padding: var(--space-6) 0;
  text-align: center;
}

.app-header__eyebrow {
  margin-bottom: var(--space-2);
}

.app-header__title {
  margin-bottom: var(--space-2);
}

.app-header__subtitle {
  max-width: 600px;
  margin: 0 auto;
}

.app-header__status {
  display: none;
}

@media (min-width: 1024px) {
  .app-header {
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--space-6);
  }

  .app-header__subtitle {
    margin: 0;
  }

  .app-header__status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: white;
    border: 1px solid var(--color-neutral-200);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    color: var(--color-neutral-600);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
  }

  .status-dot {
    width: 8px;
    height: 8px;
    background: var(--color-emerald-500);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ----------------------------------------
   8. CARDS
   ---------------------------------------- */
.card {
  background: white;
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: all var(--duration-200) var(--ease-out);
}

.card:hover {
  box-shadow: var(--shadow-xl);
}

.card--elevated {
  box-shadow: var(--shadow-xl);
}

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

/* Allow autocomplete dropdown to overflow card boundaries */
.card--overflow-visible {
  overflow: visible;
}

.card__header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-neutral-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}

.card__body {
  padding: var(--space-4) var(--space-5);
}

.card__footer {
  padding: var(--space-4) var(--space-5);
  background: var(--color-neutral-50);
  border-top: 1px solid var(--color-neutral-100);
}

@media (min-width: 640px) {
  .card {
    border-radius: var(--radius-2xl);
  }
  .card__header,
  .card__body {
    padding: var(--space-5) var(--space-6);
  }
}

@media (min-width: 1024px) {
  .card {
    border-radius: var(--radius-3xl);
  }
}

/* ----------------------------------------
   9. BUTTONS
   ---------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  line-height: 1;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-xl);
  border: none;
  cursor: pointer;
  transition: all var(--duration-150) var(--ease-out);
  position: relative;
  white-space: nowrap;
}

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

/* Primary Button */
.btn--primary {
  background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-cyan-500) 100%);
  color: white;
  box-shadow: var(--shadow-md), 0 4px 14px rgb(59 130 246 / 0.3);
}

.btn--primary:hover:not(:disabled) {
  box-shadow: var(--shadow-lg), 0 6px 20px rgb(59 130 246 / 0.4);
  transform: translateY(-1px);
}

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

/* Secondary Button */
.btn--secondary {
  background: white;
  color: var(--color-neutral-700);
  border: 1px solid var(--color-neutral-300);
  box-shadow: var(--shadow-sm);
}

.btn--secondary:hover:not(:disabled) {
  background: var(--color-neutral-50);
  border-color: var(--color-neutral-400);
}

/* Ghost Button */
.btn--ghost {
  background: transparent;
  color: var(--color-neutral-600);
  padding: var(--space-2) var(--space-3);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--color-neutral-100);
  color: var(--color-neutral-900);
}

/* Danger Button */
.btn--danger {
  background: var(--color-rose-500);
  color: white;
}

.btn--danger:hover:not(:disabled) {
  background: var(--color-rose-600);
}

/* Size Variants */
.btn--sm {
  font-size: var(--text-xs);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
}

.btn--lg {
  font-size: var(--text-base);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-2xl);
}

/* Block on mobile */
@media (max-width: 639px) {
  .btn--block-mobile {
    width: 100%;
  }
}

/* ----------------------------------------
   10. FORM COMPONENTS
   ---------------------------------------- */
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-neutral-700);
}

.form-input {
  width: 100%;
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-neutral-900);
  background: white;
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-150) var(--ease-out);
}

.form-input::placeholder {
  color: var(--color-neutral-500);
}

.form-input:hover:not(:disabled) {
  border-color: var(--color-neutral-300);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary-400);
  box-shadow: var(--shadow-sm), 0 0 0 3px rgb(59 130 246 / 0.1);
}

.form-input:disabled {
  background: var(--color-neutral-50);
  cursor: not-allowed;
}

/* Select */
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right var(--space-3) center;
  background-repeat: no-repeat;
  background-size: 20px;
  padding-right: var(--space-10);
}

/* Clearable input - add padding for clear button */
.form-input--clearable {
  padding-right: var(--space-10);
}

/* Clear button inside input */
.input-clear-btn {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-neutral-100);
  border: none;
  border-radius: var(--radius-full);
  color: var(--color-neutral-500);
  cursor: pointer;
  transition: all var(--duration-150) var(--ease-out);
}

.input-clear-btn:hover {
  background: var(--color-neutral-200);
  color: var(--color-neutral-700);
}

.input-clear-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-primary-200);
}

.input-clear-btn svg {
  width: 14px;
  height: 14px;
}

/* Input wrapper with autocomplete */
.input-wrapper {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: var(--space-2);
  background: white;
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-height: 280px;
  overflow-y: auto;
  z-index: var(--z-dropdown);
}

.autocomplete-dropdown.hidden {
  display: none;
}

.autocomplete-item {
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--duration-100) var(--ease-out);
  font-size: var(--text-sm);
}

.autocomplete-item:hover,
.autocomplete-item:focus {
  background: var(--color-neutral-50);
}

.autocomplete-item--active {
  background: var(--color-primary-50);
}

/* Search Form Grid */
.search-form {
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .search-form {
    grid-template-columns: 1fr auto auto;
    align-items: end;
  }
}

/* ----------------------------------------
   11. HISTORY LIST
   ---------------------------------------- */
.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.history-item {
  background: white;
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-xl);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  transition: all var(--duration-150) var(--ease-out);
}

.history-item:hover {
  border-color: var(--color-primary-300);
  box-shadow: var(--shadow-md), var(--shadow-glow-primary);
  transform: translateX(4px);
}

.history-item:active {
  transform: translateX(2px);
}

.history-item__content {
  flex: 1;
  min-width: 0;
}

.history-item__address {
  font-weight: var(--font-semibold);
  color: var(--color-neutral-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--text-sm);
}

.history-item__meta {
  font-size: var(--text-xs);
  color: var(--color-neutral-500);
  margin-top: var(--space-1);
}

.history-item__delete {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-neutral-400);
  transition: all var(--duration-150) var(--ease-out);
  flex-shrink: 0;
}

.history-item__delete:hover {
  background: var(--color-rose-500);
  color: white;
}

/* Empty State */
.history-empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
}

.history-empty__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  background: var(--color-neutral-100);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-neutral-400);
}

.history-empty__text {
  font-weight: var(--font-semibold);
  color: var(--color-neutral-700);
}

.history-empty__hint {
  font-size: var(--text-sm);
  color: var(--color-neutral-500);
  margin-top: var(--space-1);
}

/* ----------------------------------------
   12. RESULTS SECTION
   ---------------------------------------- */
.results-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .results-summary {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.results-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-neutral-50);
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--color-neutral-600);
}

.badge strong {
  font-weight: var(--font-semibold);
  color: var(--color-neutral-900);
}

/* ----------------------------------------
   13. MAP COMPONENT
   ---------------------------------------- */
.map-section {
  background: var(--color-neutral-50);
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
}

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

.map-container {
  position: relative;
  background: var(--color-neutral-100);
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.map-wrapper {
  height: 280px;
}

@media (min-width: 640px) {
  .map-wrapper {
    height: 360px;
  }
}

@media (min-width: 1024px) {
  .map-wrapper {
    height: 450px;
  }
}

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

/* Map loading state */
.map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-neutral-50);
  z-index: 1;
}

.map-loading.hidden {
  display: none;
}

.map-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-neutral-200);
  border-top-color: var(--color-primary-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.map-loading__text {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-neutral-500);
}

/* Route info */
.route-info {
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: white;
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  color: var(--color-neutral-700);
}

.route-info:empty {
  display: none;
}

/* Leaflet recenter control */
.leaflet-control-recenter {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 30px;
  height: 30px;
  background: white;
  color: #333;
  cursor: pointer;
  text-decoration: none;
}

.leaflet-control-recenter:hover {
  background: #f4f4f4;
  color: #000;
}

.leaflet-control-recenter svg {
  display: block;
}

/* ----------------------------------------
   14. DATA TABLE (Desktop) / CARDS (Mobile)
   ---------------------------------------- */
.airports-table-wrapper {
  overflow-x: auto;
  margin: 0 calc(-1 * var(--space-5));
  padding: 0 var(--space-5);
}

@media (min-width: 640px) {
  .airports-table-wrapper {
    margin: 0;
    padding: 0;
    overflow-x: visible;
  }
}

.airports-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

@media (min-width: 768px) {
  .airports-table {
    min-width: auto;
  }
}

.airports-table th {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-neutral-500);
  text-align: left;
  background: var(--color-neutral-50);
  border-bottom: 1px solid var(--color-neutral-200);
  white-space: nowrap;
}

.airports-table td {
  padding: var(--space-4);
  vertical-align: middle;
  border-bottom: 1px solid var(--color-neutral-100);
}

.airports-table tbody tr {
  transition: background var(--duration-100) var(--ease-out);
}

.airports-table tbody tr:hover {
  background: var(--color-neutral-50);
}

/* Airport name cell */
.airport-name {
  font-weight: var(--font-semibold);
  color: var(--color-neutral-900);
}

.airport-location {
  font-size: var(--text-xs);
  color: var(--color-neutral-500);
  margin-top: var(--space-1);
}

/* Type badge */
.airport-type {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  background: var(--color-neutral-100);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-neutral-600);
  text-transform: capitalize;
}

/* Clickable elements */
.table-link {
  color: var(--color-primary-600);
  font-weight: var(--font-semibold);
  cursor: pointer;
  transition: color var(--duration-100) var(--ease-out);
}

.table-link:hover {
  color: var(--color-primary-500);
}

/* Expand button */
.expand-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-primary-600);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.expand-btn:hover {
  color: var(--color-primary-500);
}

.expand-icon {
  font-size: var(--text-base);
  font-weight: var(--font-bold);
  transition: transform var(--duration-200) var(--ease-out);
}

.expand-icon.expanded {
  transform: rotate(45deg);
}

/* Expanded row */
.airports-table .expand-row {
  background: var(--color-neutral-50);
}

.airports-table .expand-row.hidden {
  display: none;
}

.expand-content {
  padding: var(--space-4) var(--space-6);
}

.expand-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

@media (min-width: 640px) {
  .expand-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .expand-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.expand-item {
  font-size: var(--text-sm);
}

.expand-item__label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  color: var(--color-neutral-600);
  margin-bottom: var(--space-1);
}

.expand-item__value {
  color: var(--color-neutral-700);
}

/* Mobile: Card layout */
@media (max-width: 767px) {
  .airports-table,
  .airports-table thead,
  .airports-table tbody,
  .airports-table th,
  .airports-table td,
  .airports-table tr {
    display: block;
  }

  .airports-table thead {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  .airports-table tbody tr {
    margin-bottom: var(--space-4);
    border: 1px solid var(--color-neutral-200);
    border-radius: var(--radius-xl);
    background: white;
    box-shadow: var(--shadow-sm);
  }

  .airports-table tbody tr:hover {
    box-shadow: var(--shadow-md);
  }

  .airports-table td {
    padding: var(--space-3) var(--space-4);
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-neutral-100);
  }

  .airports-table td:last-child {
    border-bottom: none;
  }

  .airports-table td::before {
    content: attr(data-label);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    color: var(--color-neutral-500);
    flex-shrink: 0;
    margin-right: var(--space-3);
  }

  .airports-table .expand-row {
    margin-top: calc(-1 * var(--space-4) + 1px);
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }

  .expand-content {
    padding: var(--space-4);
  }
}

/* ----------------------------------------
   15. INFO CARDS
   ---------------------------------------- */
.info-grid {
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 768px) {
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.info-card {
  background: var(--color-neutral-50);
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
}

.info-card__label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-neutral-500);
  margin-bottom: var(--space-2);
}

.info-card__value {
  font-size: var(--text-base);
  color: var(--color-neutral-900);
}

.tips-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.tips-list li {
  display: flex;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-neutral-600);
}

.tips-list li::before {
  content: "•";
  color: var(--color-primary-500);
  font-weight: bold;
}

/* ----------------------------------------
   16. EMPTY STATE
   ---------------------------------------- */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
}

.empty-state__title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--color-neutral-900);
  margin-bottom: var(--space-2);
}

.empty-state__text {
  color: var(--color-neutral-600);
  max-width: 400px;
  margin: 0 auto;
}

/* ----------------------------------------
   17. ALERT / ERROR MESSAGE
   ---------------------------------------- */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-xl);
  font-size: var(--text-sm);
}

.alert--error {
  background: rgb(254 226 226);
  border: 1px solid rgb(254 202 202);
  color: rgb(153 27 27);
}

.alert--warning {
  background: rgb(254 243 199);
  border: 1px solid rgb(253 230 138);
  color: rgb(146 64 14);
}

.alert--success {
  background: rgb(220 252 231);
  border: 1px solid rgb(187 247 208);
  color: rgb(22 101 52);
}

#alert-container:empty {
  display: none;
}

/* ----------------------------------------
   18. MODAL
   ---------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(15 23 42 / 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-200) var(--ease-out);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--color-neutral-200);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-width: 400px;
  padding: var(--space-6);
  transform: scale(0.95);
  transition: transform var(--duration-200) var(--ease-out);
}

.modal-backdrop.active .modal {
  transform: scale(1);
}

.modal__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-neutral-900);
  margin-bottom: var(--space-2);
}

.modal__text {
  font-size: var(--text-sm);
  color: var(--color-neutral-600);
  margin-bottom: var(--space-4);
}

.modal__details {
  font-size: var(--text-sm);
  color: var(--color-neutral-800);
  background: var(--color-neutral-50);
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  margin-bottom: var(--space-5);
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* ----------------------------------------
   19. ANIMATIONS
   ---------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-fade-in {
  animation: fadeIn var(--duration-300) var(--ease-out);
}

.animate-fade-in-up {
  animation: fadeInUp var(--duration-300) var(--ease-out);
}

.animate-fade-in-left {
  animation: fadeInLeft var(--duration-300) var(--ease-out);
}

/* Staggered animation for list items */
.animate-stagger > * {
  animation: fadeInUp var(--duration-300) var(--ease-out) both;
}

.animate-stagger > *:nth-child(1) { animation-delay: 0ms; }
.animate-stagger > *:nth-child(2) { animation-delay: 50ms; }
.animate-stagger > *:nth-child(3) { animation-delay: 100ms; }
.animate-stagger > *:nth-child(4) { animation-delay: 150ms; }
.animate-stagger > *:nth-child(5) { animation-delay: 200ms; }
.animate-stagger > *:nth-child(6) { animation-delay: 250ms; }
.animate-stagger > *:nth-child(7) { animation-delay: 300ms; }
.animate-stagger > *:nth-child(8) { animation-delay: 350ms; }

/* ----------------------------------------
   20. UTILITIES
   ---------------------------------------- */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.font-mono {
  font-family: var(--font-mono);
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--color-neutral-900);
  color: white;
  border-radius: var(--radius-md);
  z-index: var(--z-tooltip);
  transition: top var(--duration-200) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-4);
}
