/* Reset. min-width:0 stops flex/grid children (selects, inputs) from overflowing. */
* { box-sizing: border-box; margin: 0; padding: 0; min-width: 0; }
/* Without this, elements that also set their own "display" ignore the hidden attribute. */
[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #eef4f6;
  min-height: 100vh;
  background: #10203a;
  display: flex;
  flex-direction: column;
}

/* flex:1 + footer's margin-top:auto keeps the footer pinned to the bottom of the
   viewport instead of floating right after short content with dead space below it. */
.vz-container {
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 24px 40px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.vz-header {
  text-align: center;
  color: #eef4f6;
  margin-bottom: 20px;
}

.vz-header-icon { font-size: 2rem; color: #14b8a6; margin-bottom: 6px; }
.vz-header h1 { font-size: 1.6rem; font-weight: 700; }
.vz-subtitle { color: #a9c3cc; margin-top: 4px; font-size: 0.9rem; }

.vz-config-warning {
  background: #1c2a1f;
  border: 1px solid #f59e0b;
  color: #fde9c8;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.vz-config-warning[hidden] { display: none !important; }
.vz-config-warning code { background: rgba(0,0,0,0.25); padding: 2px 6px; border-radius: 4px; }

/* Full-width search bar: holds both the "check" and "browse" flows, one row each. */
.vz-searchbar {
  background: #fff;
  color: #1f2937;
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 18px;
}

.vz-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.vz-search-icon { color: #14b8a6; font-size: 1.1rem; margin-bottom: 10px; }
.vz-arrow-icon { color: #14b8a6; font-size: 1.1rem; margin-bottom: 10px; }

.vz-field { position: relative; display: flex; flex-direction: column; gap: 4px; flex: 1 1 160px; }
.vz-field-grow { flex: 2 1 220px; }
.vz-field label { font-size: 0.8rem; font-weight: 600; color: #374151; }

.vz-field input,
.vz-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.95rem;
  color: #1f2937;
  background: #fff;
}
.vz-select { flex: 1 1 150px; align-self: end; }
.vz-field input:focus, .vz-select:focus {
  outline: none;
  border-color: #14b8a6;
}

.vz-divider-inline {
  text-align: center;
  color: #9ca3af;
  font-weight: 600;
  font-size: 0.75rem;
  margin: 14px 0;
  position: relative;
}
.vz-divider-inline::before, .vz-divider-inline::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 44%;
  height: 1px;
  background: #e5e7eb;
}
.vz-divider-inline::before { left: 0; }
.vz-divider-inline::after { right: 0; }

.vz-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-top: 4px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  z-index: 20;
  display: none;
}
.vz-suggestions.vz-open { display: block; }
.vz-suggestion-item { padding: 9px 12px; cursor: pointer; font-size: 0.9rem; }
.vz-suggestion-item:hover, .vz-suggestion-item.vz-highlighted { background: #f0fdfa; }

.vz-hint { color: #ef4444; font-size: 0.85rem; margin-top: 8px; }

.vz-btn {
  border: none;
  border-radius: 6px;
  padding: 11px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}
.vz-btn-primary { background: #14b8a6; color: #0b1e2d; }
.vz-btn-primary:hover { background: #0e7490; color: #fff; }
.vz-btn-secondary { background: #e5e7eb; color: #1f2937; }
.vz-btn-secondary:hover:not(:disabled) { background: #d1d5db; }
.vz-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.vz-search-row .vz-btn { margin-top: 0; }

.vz-check-result { margin-top: 18px; }

.vz-loading, .vz-error {
  background: #fff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 32px;
  text-align: center;
  margin-bottom: 18px;
}
.vz-spinner {
  width: 32px; height: 32px;
  border: 3px solid #e5e7eb;
  border-top-color: #14b8a6;
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: vz-spin 0.8s linear infinite;
}
@keyframes vz-spin { to { transform: rotate(360deg); } }
.vz-error i { font-size: 1.6rem; color: #ef4444; margin-bottom: 8px; }

/* Live totals computed client-side from the fetched dataset. */
.vz-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.vz-stat-item {
  background: #fff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.vz-stat-value { display: block; font-size: 1.6rem; font-weight: 700; color: #14b8a6; }
.vz-stat-label { font-size: 0.8rem; color: #6b7280; }

/* Results panel: header + grid/list toggle, cards, pagination. */
.vz-results {
  background: #fff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 22px;
}
.vz-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.vz-view-toggle { display: flex; gap: 6px; }
.vz-view-btn {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #6b7280;
  border-radius: 6px;
  padding: 7px 11px;
  cursor: pointer;
}
.vz-view-btn.vz-active { background: #0e7490; color: #fff; border-color: #0e7490; }

.vz-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.vz-results-list { display: flex; flex-direction: column; gap: 8px; }

.vz-result-card {
  background: #fff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
}
.vz-result-card:hover { border-color: #14b8a6; }
.vz-results-list .vz-result-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.vz-result-name { font-weight: 600; margin-bottom: 8px; }
.vz-results-list .vz-result-name { margin-bottom: 0; }
.vz-result-region { font-size: 0.8rem; color: #6b7280; margin-top: 6px; }
.vz-results-list .vz-result-region { margin-top: 0; margin-right: auto; padding-left: 10px; }

/* Colors match the Aurora Teal spec: free/arrival/required/eta. */
.vz-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}
.vz-badge-free { background: #22c55e; }
.vz-badge-arrival { background: #f59e0b; }
.vz-badge-required { background: #ef4444; }
.vz-badge-eta { background: #8b5cf6; }
.vz-badge-unknown { background: #9ca3af; }

.vz-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.vz-footer {
  text-align: center;
  color: #a9c3cc;
  font-size: 0.85rem;
  margin-top: auto;
  padding-top: 24px;
}
.vz-footer-credit { font-size: 0.75rem; margin-top: 4px; opacity: 0.8; }
.vz-footer a { color: #14b8a6; }

/* Country detail modal, opened from a result card click. */
.vz-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16,32,58,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.vz-modal-overlay[hidden] { display: none !important; }
.vz-modal-content {
  background: #fff;
  color: #1f2937;
  border-radius: 10px;
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
}
.vz-modal-close {
  position: absolute;
  top: 14px; right: 14px;
  border: none;
  background: #f3f4f6;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
}

.vz-detail-section { margin-top: 14px; }
.vz-detail-section h4 { font-size: 0.8rem; text-transform: uppercase; color: #6b7280; margin-bottom: 6px; letter-spacing: 0.03em; }
.vz-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; font-size: 0.9rem; }
.vz-detail-grid div span { display: block; color: #6b7280; font-size: 0.75rem; }
.vz-detail-section a { color: #0e7490; }

/* Below 1000px the browse row (field + 3 selects + button) doesn't have room to
   wrap cleanly inline — it strands the button on its own line. Stack it instead. */
@media (max-width: 1000px) {
  .vz-search-row { flex-direction: column; align-items: stretch; }
  .vz-field, .vz-select { flex: none; }
  .vz-search-icon, .vz-arrow-icon { display: none; }
}

@media (max-width: 700px) {
  .vz-container { padding: 20px 12px 40px; }
  .vz-searchbar, .vz-results, .vz-loading, .vz-error { padding: 16px; }
  .vz-stats { grid-template-columns: 1fr; }
  .vz-detail-grid { grid-template-columns: 1fr; }
}
