/* styles.css */

/* ===== Base reset ===== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1c1f22;
  background: #f7f7f6;
}

/* ===== Layout ===== */
.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

header h1 {
  margin: 0;
  font-size: 1.6rem;
}

.sub {
  margin-top: 0.25rem;
  opacity: 0.7;
}

/* ===== Controls ===== */

label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  gap: 0.25rem;
}

input {
  padding: 0.55rem 0.6rem;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.25);
}

/* ===== Swap button ===== */
.swap-btn {
  height: 2.6rem;
  width: 2.6rem;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.25);
  background: #ffffff;
  color: #1c1f22;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;
}

.swap-btn svg {
  display: block;
  width: 18px;
  height: 18px;
}

.swap-btn:hover {
  background: #f0f0ef;
}

/* ===== Action button ===== */
#go {
  margin-top: 0.75rem;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  border: none;
  background: #4977a5;
  color: #ffffff;
  font-size: 0.95rem;
  cursor: pointer;
}

.go-row {
  display: flex;
  justify-content: center;
  margin-top: 0.75rem;
}

#go:hover {
  opacity: 0.9;
}

/* ===== Map viewport window ===== */
.map {
  position: relative;
  width: 100%;
  aspect-ratio: 5303 / 2890;

  margin: 1.25rem 0 0;
  padding: 0;

  overflow: hidden;
  border-radius: 10px;
  background: transparent;
}

/* ===== Fixed canvas that gets transformed ===== */
.map-inner {
  position: relative;
  width: 5303px;
  height: 2890px;
  transform-origin: top left;
}

/* Image is a base layer (non-interactive) */
.map-inner img {
  position: absolute;
  inset: 0;
  width: 5303px;
  height: 2890px;
  display: block;
  pointer-events: none; /* IMPORTANT: clicks go to SVG */
} 


/* SVG overlay covers the entire canvas */
.map-overlay {
  position: absolute;
  inset: 0;
  width: 5303px;
  height: 2890px;
  z-index: 2;
  pointer-events: auto;
}

/* ===== SVG helpers ===== */
.is-hidden {
  display: none;
}

.airport-label {
  font-size: 16px;
  font-weight: 700;
  fill: #000000;
  opacity: 0.75;
}

/* ===== Plane ===== */
.plane path {
  fill: #000000;
}

/* ===== Result ===== */
.route-indicator {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  opacity: 0.7;
}

.result-card {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.result-card h2 {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
}

.result-card ul {
  margin: 0.5rem 0 0 1.1rem;
  padding: 0;
}

.err {
  color: #b00020;
  margin-top: 0.5rem;
}

/* ===== Footer ===== */
.foot {
  margin-top: 2rem;
  font-size: 0.75rem;
  opacity: 0.6;
  text-align: center;
}


/* ===== Zones + sights ===== */
.map-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.toggle {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.legend {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  opacity: 0.8;
}

.legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-left: 0.5rem;
}

.dot-left { background: #2f6fb0; }
.dot-right { background: #2e8b57; }
.dot-below { background: #8a6d3b; }

.zone {
  fill: none;
  stroke: #3a5a78;
  stroke-width: 3;
  stroke-opacity: 0.35;
}

.zone.zone-crossed { fill: rgba(230, 120, 40, 0.22); }
.zone.zone-buffer { fill: rgba(230, 120, 40, 0.10); }

.zone-label {
  font-size: 30px;
  fill: #3a5a78;
  fill-opacity: 0.6;
}

.sight {
  stroke: #ffffff;
  stroke-width: 5;
}

.sight-left { fill: #2f6fb0; }
.sight-right { fill: #2e8b57; }
.sight-below,
.sight-airport { fill: #8a6d3b; }

.sight-label {
  font-size: 40px;
  font-weight: 600;
  fill: #1c1f22;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 8px;
}

.result-card .dist {
  font-weight: 400;
  opacity: 0.6;
}

.moments {
  list-style: none;
  margin: 0.5rem 0 0 !important;
  padding: 0;
}

.moment {
  padding: 0.55rem 0 0.55rem 0.7rem;
  border-left: 3px solid #ccc;
  margin-bottom: 0.4rem;
}

.moment-left { border-color: #2f6fb0; }
.moment-right { border-color: #2e8b57; }
.moment-below,
.moment-airport { border-color: #8a6d3b; }

.moment-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
}

.moment-name { font-weight: 600; }

.moment-meta {
  font-size: 0.8rem;
  opacity: 0.7;
}

.moment-see {
  font-size: 0.9rem;
  margin-top: 0.15rem;
}

.muted { opacity: 0.65; }
.small { font-size: 0.78rem; }

/* Flight line: thick enough to read when the whole map is shown */
.route-line,
#route-ACTIVE {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke: #c0392b;
  stroke-width: 10;
  opacity: 0.85;
}

/* ===== v6: trip fields ===== */
header { text-align: center; }

.route-fields {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

.stop-fields { display: contents; }

.airport-field {
  position: relative;
  flex: 1 1 170px;
  max-width: 260px;
}

.airport-input { width: 100%; }
.airport-input.needs-pick { border-color: #c97a1d; box-shadow: 0 0 0 2px rgba(201, 122, 29, 0.2); }

.stop-input-row { position: relative; }
.stop-input-row .airport-input { padding-right: 2rem; }

.remove-stop {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #666;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.remove-stop:hover { background: #f0f0ef; color: #1c1f22; }

.add-stop {
  height: 2.4rem;
  padding: 0 0.8rem;
  border-radius: 6px;
  border: 1px dashed rgba(0, 0, 0, 0.35);
  background: #ffffff;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.add-stop:hover { background: #f0f0ef; }
.add-stop:disabled { opacity: 0.45; cursor: default; }

/* ===== suggestions ===== */
.airport-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  z-index: 20;
}
.suggest-heading {
  padding: 0.4rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  background: #faf6ee;
  color: #8a5a12;
}
.airport-suggestion {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0.65rem;
  border: none;
  background: #ffffff;
  text-align: left;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}
.airport-suggestion:hover,
.airport-suggestion.is-active { background: #eef3f8; }
.suggest-meta { font-size: 0.78rem; opacity: 0.6; white-space: nowrap; }

/* ===== seat picker ===== */
.seat-pick {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}
.seat-pick-label { margin-right: 0.25rem; opacity: 0.75; }
.seat-pick label {
  position: relative;
  flex-direction: row;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 999px;
  background: #ffffff;
  font-size: 0.9rem;
  cursor: pointer;
}
.seat-pick label:has(input:checked) { background: #4977a5; border-color: #4977a5; color: #ffffff; }
.seat-pick input { position: absolute; opacity: 0; pointer-events: none; }
.seat-pick label:has(input:focus-visible) { outline: 2px solid #4977a5; outline-offset: 2px; }
.seat-pick small { opacity: 0.75; }

/* ===== results ===== */
.leg-card h2 { margin-top: 0.1rem; }
.leg-num {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.6;
}
ol.moments { list-style: none; }

.side-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  color: #ffffff;
}
.side-tag.side-left { background: #2f6fb0; }
.side-tag.side-right { background: #2e8b57; }
.side-tag.side-below { background: #8a6d3b; }

.airport-fact {
  margin-top: 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  background: #fbf7ef;
  border: 1px solid #efe4cf;
  font-size: 0.92rem;
}
.fact-head { font-size: 0.82rem; color: #7a5a22; }
.airport-fact ul { margin: 0.35rem 0 0 1.1rem; padding: 0; }
.airport-fact li { margin-bottom: 0.2rem; }
.footnote { margin-top: 0.75rem; }

/* ===== phones ===== */
@media (max-width: 640px) {
  .wrap { padding: 1rem; }
  .route-fields { flex-direction: column; align-items: stretch; }
  .airport-field { max-width: none; flex: none; }
  .swap-btn { align-self: center; }
  .add-stop { align-self: center; }
  .map-tools { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
}

/* hidden must beat the suggestion box's own display rule (this was the stray gray line) */
.airport-suggestions.is-hidden { display: none; }

.sight-leader {
  stroke: #1c1f22;
  stroke-width: 3;
  stroke-opacity: 0.45;
}
