:root {
  --surface-0: #05070C;
  --surface-1: #0A0D12;
  --surface-2: #0F131C;
  --surface-3: #161D2B;
  --surface-4: #1E2636;

  --accent: #38BDF8;
  --accent-muted: #0E7490;
  --emerald: #6EE7B7;
  --amber: #FBBF24;
  --rose: #FB7185;

  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --border: rgba(148, 163, 184, 0.1);
  --border-hover: rgba(148, 163, 184, 0.2);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;

  --spacing-xs: 0.5rem;
  --spacing-sm: 0.75rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;

  --text-display: clamp(2rem, 4vw, 3rem);
  --text-title: clamp(1.5rem, 3vw, 2rem);
  --text-heading: clamp(1.125rem, 2vw, 1.25rem);
  --text-body: clamp(0.9375rem, 1.5vw, 1rem);
  --text-small: clamp(0.8125rem, 1.2vw, 0.875rem);

  /* Compatibility aliases used by the secondary page styles. */
  --accent-color: var(--accent);
  --border-color: var(--border);
  --surface-deep: var(--surface-0);
  --text-tertiary: var(--text-muted);
  --spacing-xxl: 3rem;
}

:root[data-theme="light"] {
  --surface-0: #F8FAFC;
  --surface-1: #FFFFFF;
  --surface-2: #F1F5F9;
  --surface-3: #E2E8F0;
  --surface-4: #CBD5E1;
  --accent: #0284C7;
  --accent-muted: #0E7490;
  --emerald: #047857;
  --amber: #B45309;
  --rose: #BE123C;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --border: rgba(15, 23, 42, 0.12);
  --border-hover: rgba(15, 23, 42, 0.24);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 10px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 12px 24px rgba(15, 23, 42, 0.12);
}

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.6;
  background: var(--surface-0);
  color: var(--text-primary);
  min-height: 100vh;
}

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

button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.result-summary {
  color: var(--text-secondary);
  margin: 0 0 var(--spacing-md);
}

.empty-result {
  grid-column: 1 / -1;
  padding: 4rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.empty-result h2 { color: var(--text-primary); margin-bottom: .5rem; }
.empty-result code { color: var(--accent); }
.card-date { color: var(--text-muted); font-size: var(--text-small); }
.protocol-unknown { color: var(--text-muted); }

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--spacing-xl) var(--spacing-md);
}

/* Header */
.header {
  margin-bottom: var(--spacing-xl);
}

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

.logo {
  font-size: var(--text-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent) 0%, var(--emerald) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.site-logo { text-decoration: none; white-space: nowrap; }

.theme-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.theme-toggle:hover {
  background: var(--surface-3);
  border-color: var(--border-hover);
  color: var(--accent);
}

/* Search Section */
.search-section {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
}

.search-wrapper {
  position: relative;
  margin-bottom: var(--spacing-xl);
}

.search-icon {
  position: absolute;
  left: var(--spacing-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: var(--spacing-md) var(--spacing-md) var(--spacing-md) 3rem;
  font-size: var(--text-body);
  color: var(--text-primary);
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-xl);
}

.stat-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  text-align: center;
  transition: all 0.2s;
}

.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.stat-value {
  font-size: var(--text-title);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--spacing-xs);
  letter-spacing: -0.01em;
}

.stat-label {
  font-size: var(--text-small);
  color: var(--text-secondary);
}

/* Filter Section */
.filter-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.filter-label {
  font-size: var(--text-small);
  color: var(--text-secondary);
  font-weight: 500;
}

.filter-tag {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-full);
  font-size: var(--text-small);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.filter-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-tag.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface-0);
  font-weight: 500;
}

/* Airport Grid */
.airport-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.airport-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.airport-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

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

.card-number {
  font-size: var(--text-small);
  color: var(--text-muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.card-status {
  font-size: var(--text-small);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

.status-active {
  background: rgba(110, 231, 183, 0.15);
  color: var(--emerald);
}

.status-closed {
  background: rgba(251, 113, 133, 0.15);
  color: var(--rose);
}

.card-title {
  font-size: var(--text-heading);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-md);
}

.tag {
  background: var(--surface-3);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-small);
  font-weight: 500;
}

.tag-highlight {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
}

.tag-special {
  background: rgba(251, 191, 36, 0.15);
  color: var(--amber);
}

.tag-warning {
  background: rgba(251, 113, 133, 0.15);
  color: var(--rose);
}

.card-protocols {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-lg);
}

.protocol {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-small);
  font-weight: 500;
  font-family: ui-monospace, monospace;
}

.card-footer {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  margin-top: auto;
}

.card-link {
  color: var(--accent);
  font-size: var(--text-small);
  text-decoration: none;
  transition: color 0.2s;
  font-weight: 500;
}

.card-link:hover {
  color: var(--emerald);
}

.card-link.disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  text-decoration: line-through;
}

.card-btn {
  margin-left: auto;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-full);
  font-size: var(--text-small);
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.card-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface-0);
}

/* Card Meta (Price & Rating) */
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: var(--spacing-md) 0;
  padding: var(--spacing-sm) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.card-price {
  font-size: var(--text-heading);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.card-price-na {
  color: var(--text-muted);
  font-size: var(--text-body);
  font-weight: 500;
}

.price-unit {
  font-size: var(--text-small);
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 2px;
}

.card-rating {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.rating-stars {
  color: #fbbf24;
  font-size: var(--text-body);
  line-height: 1;
  letter-spacing: -0.1em;
}

.rating-value {
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--text-secondary);
}

/* Advanced Filters */
.advanced-filters {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.filter-row:last-child {
  margin-bottom: 0;
}

.price-filter-row { flex-wrap: wrap; }
.price-filter-select,
.price-filter-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  min-height: 38px;
}
.price-filter-select { padding: .45rem 2rem .45rem .8rem; }
.price-filter-input { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .75rem; }
.price-filter-input span { color: var(--text-muted); font-size: var(--text-small); }
.price-filter-input input { width: 88px; border: 0; outline: 0; background: transparent; color: var(--text-primary); }
.price-filter-separator { color: var(--text-muted); }
.priced-only { display: inline-flex; align-items: center; gap: .45rem; color: var(--text-secondary); font-size: var(--text-small); cursor: pointer; }
.priced-only input { accent-color: var(--accent); width: 17px; height: 17px; }
.price-filter-submit,
.price-filter-clear { min-height: 38px; padding: .4rem 1rem; border-radius: var(--radius-full); cursor: pointer; }
.price-filter-submit { background: var(--accent); border: 1px solid var(--accent); color: var(--surface-0); font-weight: 600; }
.price-filter-clear { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.price-filter-select:focus-visible,
.price-filter-input:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.filter-label {
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 80px;
}

.sort-btn, .filter-tag {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-full);
  font-size: var(--text-small);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.sort-btn:hover, .filter-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sort-btn.active, .filter-tag.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface-0);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-md);
}

.pagination-btn {
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-full);
  font-size: var(--text-small);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

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

.pagination-pages {
  display: flex;
  gap: var(--spacing-xs);
  align-items: center;
}

.pagination-page {
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: var(--text-small);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination-page:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination-page.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface-0);
}

.pagination-ellipsis {
  color: var(--text-muted);
  padding: 0 var(--spacing-xs);
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: var(--spacing-md) var(--spacing-sm);
  }

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

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .filter-group {
    font-size: var(--text-small);
  }

  .price-filter-row > .filter-label { flex-basis: 100%; }
  .price-filter-input { flex: 1 1 calc(50% - .5rem); min-width: 0; }
  .price-filter-input input { width: 100%; min-width: 0; }
  .price-filter-select { flex: 1 1 100%; }
  .price-filter-separator { display: none; }
  .priced-only { flex-basis: 100%; }

  .pagination-pages {
    gap: 4px;
  }

  .pagination-page {
    width: 32px;
    height: 32px;
  }
}
