/* Backpacker Buddy — styles */
:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --ink: #1b2a2f;
  --ink-soft: #4c6069;
  --brand: #0e7c66;
  --brand-dark: #0a5c4c;
  --accent: #f4a83d;
  --accent-dark: #d98a1a;
  --line: #dde6e4;
  --good: #e7f6ef;
  --warn: #fff4e2;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(27, 42, 47, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101b1e;
    --surface: #18272c;
    --ink: #e8f0ee;
    --ink-soft: #9fb4ae;
    --brand: #2fb896;
    --brand-dark: #24997d;
    --accent: #f4a83d;
    --accent-dark: #ffbe5c;
    --line: #273b41;
    --good: #16332a;
    --warn: #3a2d16;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

header.hero {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand) 60%, #17997f);
  color: #fff;
  padding: 2.2rem 1.25rem 4.4rem;
  text-align: center;
}
.hero h1 { margin: 0 0 0.35rem; font-size: clamp(1.7rem, 4.5vw, 2.5rem); letter-spacing: -0.02em; }
.hero p { margin: 0 auto; max-width: 640px; opacity: 0.92; font-size: clamp(0.95rem, 2.5vw, 1.05rem); }

nav.tabs {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 900px;
  margin: -2.6rem auto 0;
  padding: 0 1rem;
  position: relative;
  z-index: 2;
}
.tab {
  border: none;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.12s, color 0.12s;
}
.tab:hover { transform: translateY(-2px); color: var(--brand); }
.tab.active { background: var(--accent); color: #2a1c04; }

main { max-width: 900px; margin: 1.5rem auto 4rem; padding: 0 1rem; }
.panel { display: none; }
.panel.active { display: block; animation: fadein 0.25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.1rem;
}
.card h3 { margin: 0 0 0.6rem; font-size: 1.25rem; }

form.search-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.9rem;
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
.field select, .field input {
  font: inherit;
  padding: 0.6rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  width: 100%;
}
.field select:focus, .field input:focus { outline: 2px solid var(--brand); border-color: transparent; }

.btn {
  font: inherit;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1.2rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-swap { background: transparent; border: 1px solid var(--line); color: var(--ink-soft); padding: 0.6rem 0.8rem; }
.btn-swap:hover { color: var(--brand); border-color: var(--brand); }
.btn-go { background: var(--good); color: var(--brand-dark); border: 1px solid var(--brand); font-size: 0.92rem; padding: 0.55rem 0.9rem; }
.btn-go:hover { background: var(--brand); color: #fff; }

.link-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }

.price-row { display: flex; flex-wrap: wrap; gap: 1.6rem; margin: 0.6rem 0 0.9rem; }
.price-block { display: flex; flex-direction: column; }
.price-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
.price-big { font-size: 1.55rem; font-weight: 800; color: var(--brand); }
.price-sub { font-size: 0.8rem; color: var(--ink-soft); }

.agent-tip {
  background: var(--warn);
  border-left: 4px solid var(--accent);
  padding: 0.6rem 0.85rem;
  border-radius: 0 10px 10px 0;
  font-size: 0.95rem;
}
.corridor-note { font-size: 0.92rem; color: var(--ink-soft); }
.fine-print { font-size: 0.78rem; color: var(--ink-soft); margin-bottom: 0; }
.notice { text-align: center; font-weight: 600; }

.price-table { width: 100%; border-collapse: collapse; margin: 0.4rem 0 0.9rem; }
.price-table td { padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.price-table td.num { font-weight: 800; color: var(--brand); white-space: nowrap; }
.price-table tr.over-budget td { opacity: 0.55; }

.route-card { position: relative; }
.route-card.best { border: 2px solid var(--brand); }
.best-badge, .delta-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}
.best-badge { background: var(--brand); color: #fff; }
.delta-badge { background: var(--warn); color: var(--accent-dark); }
.tagline { color: var(--ink-soft); margin-top: -0.3rem; font-style: italic; }

ol.legs { list-style: none; padding: 0; margin: 0.8rem 0; }
ol.legs li { display: flex; gap: 0.6rem; padding: 0.45rem 0; border-bottom: 1px dashed var(--line); }
ol.legs li:last-child { border-bottom: none; }
.leg-mode { flex: 0 0 auto; }
.leg-note { font-size: 0.85rem; color: var(--ink-soft); }

.route-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  padding: 0.8rem 1rem;
  background: var(--bg);
  border-radius: 10px;
  margin: 0.8rem 0;
}
.route-totals > div { display: flex; flex-direction: column; }
.route-totals .grand .price-big { color: var(--accent-dark); }

.controls-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  align-items: end;
}
input[type="range"] { accent-color: var(--brand); padding: 0; }
.range-value { font-weight: 800; color: var(--brand); }

.region-chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  margin-left: 0.5rem;
}

.fit-badge {
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  margin-bottom: 0.8rem;
}
.fit-yes { background: var(--good); color: var(--brand-dark); border: 1px solid var(--brand); }
.fit-partial { background: var(--warn); color: var(--accent-dark); border: 1px solid var(--accent); }
.fit-no { background: var(--warn); color: var(--accent-dark); border: 1px dashed var(--accent); }

.check-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0.6rem 0;
}
.check-field input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--brand); cursor: pointer; }

.add-row { display: flex; gap: 0.5rem; }
.add-row input { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.chip {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  background: var(--good);
  color: var(--brand-dark);
  border: 1px solid var(--brand);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
}
.chip:hover { background: var(--warn); border-color: var(--accent); color: var(--accent-dark); }

.builder-error { color: var(--accent-dark); font-weight: 600; font-size: 0.9rem; margin: 0.4rem 0 0; min-height: 1em; }

ol.legs li.stay-line { background: var(--bg); border-radius: 8px; padding: 0.45rem 0.6rem; border-bottom: none; }

.classic-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.classic-header h3 { margin: 0; }
.classic-header .field { min-width: 220px; }

.flex-intro { border-left: 5px solid var(--accent); }
.flex-intro p { margin-bottom: 0; }
.flex-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.flex-card { margin-bottom: 0; }
ul.flex-list { padding-left: 1.1rem; margin: 0.4rem 0 0; }
ul.flex-list li { margin-bottom: 0.65rem; font-size: 0.94rem; }
ul.flex-list li:last-child { margin-bottom: 0; }

#hacks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.hack-card { margin-bottom: 0; }
.hack-card h3 { font-size: 1.05rem; }
.hack-card p { font-size: 0.92rem; color: var(--ink-soft); margin-bottom: 0; }
.hack-icon { font-size: 1.6rem; }

footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.82rem;
  padding: 1.5rem 1rem 2.5rem;
}

/* ---- live prices ---- */
.live-block { margin-top: 1rem; }
.live-title { margin: 0 0 0.4rem; font-size: 1rem; color: var(--accent-dark); }
.live-note { font-size: 0.9rem; color: var(--ink-soft); margin: 0.4rem 0; }
.live-loading { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .live-loading { animation: none; } }

ul.offer-list { list-style: none; padding: 0; margin: 0; }
.offer-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.45rem 0.2rem;
  border-bottom: 1px dashed var(--line);
}
.offer-row:last-child { border-bottom: none; }
.offer-price { font-weight: 800; color: var(--brand); font-size: 1.1rem; min-width: 4.5rem; font-variant-numeric: tabular-nums; }
.offer-main { display: flex; flex-direction: column; flex: 1; }
.offer-sub { font-size: 0.82rem; color: var(--ink-soft); }
.offer-source {
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  vertical-align: middle;
}
.offer-source-live { background: var(--good); color: var(--brand-dark); border: 1px solid var(--brand); }
.offer-source-cached { background: var(--warn); color: var(--accent-dark); border: 1px solid var(--accent); }

.live-setup {
  max-width: 640px;
  margin: 0.8rem auto 0;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
}
.live-setup summary { cursor: pointer; font-weight: 700; }
.live-setup code { background: var(--bg); padding: 0.1rem 0.35rem; border-radius: 5px; }
.live-setup a { color: var(--brand); }
.live-setup-row { display: flex; gap: 0.5rem; }
.live-setup-row input {
  flex: 1;
  font: inherit;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
}
.live-status { font-weight: 600; min-height: 1em; }
#live-indicator { color: var(--accent-dark); font-weight: 800; }
