/* Term Smart — visual identity
   Fresh travel-app look: airy neutral canvas, slim frosted-glass header with
   the school-tie app mark, coral reserved for actions.
   Type: Sora (display) + Figtree (body). */
:root {
  --bg: #f2f5f8;
  --card: #ffffff;
  --ink: #17232e;
  --muted: #64748b;
  --accent: #ff6b4a;
  --accent-dark: #e14e2c;
  --accent-soft: #ffede6;
  --accent-border: #ffd4c2;
  --deep: #0b3552;
  --deep2: #0f5c7f;
  --match: #16a34a;
  --warn: #d97706;
  --nomatch: #9ca3af;
  --border: #e2e8f0;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.06);
  --radius: 14px;
  --font-body: 'Figtree', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: 'Sora', 'Figtree', -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
}

/* ---------- Top bar ---------- */
/* Slim frosted-glass bar that stays put while you scroll (z-index above
   Leaflet's 1000). Ocean lives in the app mark, not a heavy banner. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 22px;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  backdrop-filter: blur(14px) saturate(1.5);
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  display: block;
  border-radius: 11px;
  box-shadow: 0 2px 8px rgba(11, 53, 82, 0.25);
}
.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.4px;
  line-height: 1.05;
  color: var(--ink);
}
.tagline { margin: 2px 0 0; font-size: 12.5px; font-weight: 500; color: var(--muted); letter-spacing: 0.1px; }

.profiles { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--ink);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.chip:hover { background: #f1f5f9; border-color: #cbd5e1; }
.chip.active { background: var(--deep); color: #fff; border-color: var(--deep); font-weight: 700; }
.chip .del { margin-left: 8px; opacity: 0.6; font-weight: 700; }
.chip .del:hover { opacity: 1; }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 18px;
  padding: 18px 20px;
  align-items: start;
}
/* Desktop: controls top-left, results bottom-left, map right (spans both,
   stays sticky). Mobile (single column, DOM order): controls, map, results —
   so the map isn't buried under the whole results list. */
.panel { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; gap: 14px; }
.map-wrap { grid-column: 2; grid-row: 1 / span 2; }
.results { grid-column: 1; grid-row: 2; align-self: start; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.card summary {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.card summary::before { content: "▸ "; color: var(--accent); }
.card[open] summary::before { content: "▾ "; }
.card h2 { margin: 0 0 12px; font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.2px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 8px 0 12px; line-height: 1.45; }

/* ---------- Forms ---------- */
.row { display: flex; gap: 8px; margin-top: 10px; }
input[type="text"], input[type="number"], input[type="date"], select {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 74, 0.18);
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(225, 78, 44, 0.28);
  transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--accent-dark); box-shadow: 0 4px 12px rgba(225, 78, 44, 0.35); transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn-ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--border); box-shadow: none; }
.btn-ghost:hover { background: #f1f5f9; border-color: #cbd5e1; box-shadow: none; transform: none; }
.btn-small { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }

.field { display: block; margin-bottom: 10px; }
.field span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field em { font-weight: 400; color: var(--muted); font-style: normal; font-size: 12px; }

/* ---------- Children editor ---------- */
.child-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #f8fafc;
}
.child-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.child-head strong { font-size: 15px; }
.dob-line { display: flex; align-items: center; gap: 6px; margin: 2px 0 8px; font-size: 12px; color: var(--muted); }
.dob-input { width: auto !important; padding: 4px 6px !important; font-size: 12px !important; }
.age-note { font-size: 11px; font-style: italic; }
.link-btn { background: none; border: none; color: #dc2626; font-size: 12.5px; cursor: pointer; padding: 2px 4px; }
.link-btn:hover { text-decoration: underline; }

.holiday-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #e9f3fa;
  border: 1px solid #d0e3f2;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  margin-bottom: 5px;
}
.holiday-pill .dates { color: var(--muted); }
.empty-note { font-size: 12.5px; color: var(--muted); font-style: italic; margin: 4px 0 8px; }

.holiday-form { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 6px; }
.holiday-form .grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 6px;
}
.holiday-form label { font-size: 11.5px; color: var(--muted); display: block; }

/* ---------- School picker & date finder ---------- */
.school-section { margin-bottom: 8px; }
.school-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  margin-bottom: 6px;
}
.school-name { font-weight: 600; }
.find-dates-btn { margin-bottom: 4px; }

.school-input-wrap { position: relative; }
.school-suggest {
  position: absolute;
  z-index: 1000;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.16);
  max-height: 260px;
  overflow-y: auto;
}
.suggest-opt {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 9px 12px;
  font-size: 13.5px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
}
.suggest-opt:hover, .suggest-opt:focus { background: var(--accent-soft); }

.date-finder {
  border: 1px solid var(--accent-border);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 8px 0;
  background: var(--accent-soft);
}
.finder-status { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.finder-suggestion {
  display: block;
  font-size: 13.5px;
  padding: 4px 0;
  cursor: pointer;
}
.finder-link {
  display: block;
  font-size: 12.5px;
  color: var(--accent);
  margin: 6px 0;
  word-break: break-all;
}
.date-finder .btn { margin-top: 8px; }

/* ---------- Results ---------- */
.summary { font-size: 13.5px; color: var(--muted); margin: 6px 0 0; }
.summary strong { color: var(--accent-dark); }

.results { display: flex; flex-direction: column; gap: 8px; }
.result-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--match);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.result-row.nomatch { border-left-color: var(--nomatch); opacity: 0.62; }
.result-row.extreme { border-left-color: var(--warn); }
.result-row:hover { border-color: var(--accent); transform: translateY(-1px); }
.result-row .name { font-weight: 700; font-size: 14.5px; }
.result-row .country { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.result-row .stats { display: flex; gap: 12px; font-size: 12.5px; color: var(--muted); margin-top: 3px; flex-wrap: wrap; }
.result-row .stats b { color: var(--ink); font-weight: 600; }

/* ---------- Map ---------- */
.map-wrap { position: sticky; top: 16px; }
#map {
  width: 100%;
  height: calc(100vh - 150px);
  min-height: 420px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.disclaimer { font-size: 11.5px; color: var(--muted); margin: 8px 2px 0; line-height: 1.45; }

/* ---------- Season legend & labels ---------- */
.legend { font-size: 12.5px; color: var(--muted); margin: 8px 2px 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.legend .dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); margin-left: 6px; }
.legend .dot:first-child { margin-left: 0; }
.dot-in { background: var(--match); }
.dot-out { background: var(--warn); }
.dot-off { background: var(--nomatch); }
.flag-label { font-weight: 600; }
.flag-good { color: #15803d; }
.flag-warn { color: #b45309; }
.rain-label { color: #0369a1; font-weight: 600; }

.dest-pin {
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
}
.leaflet-popup-content { font-family: inherit; font-size: 13.5px; line-height: 1.5; }
.popup-name { font-weight: 700; font-size: 15px; }
.popup-hint { color: var(--muted); font-size: 12px; }

/* ---------- Booking ---------- */
.book-box { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--border); }
.book-title { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
/* One button per provider per line, in the provider's brand colours
   (colours come from inline styles set in app.js). */
.book-btn {
  display: block; text-align: center;
  width: 100%; margin: 0 0 6px; padding: 9px 12px;
  border: none; border-radius: 10px;
  font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.2);
  transition: filter 0.15s ease, transform 0.08s ease;
}
.book-btn:last-of-type { margin-bottom: 2px; }
.book-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }

.book-stats-toggle {
  margin: 8px 2px 0; padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); color: var(--muted);
  font-family: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.book-stats-toggle:hover { color: var(--accent-dark); border-color: var(--accent); }
.book-stats {
  margin: 8px 2px 0; padding: 10px 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); font-size: 12.5px;
}
.book-stats-table { border-collapse: collapse; margin-bottom: 6px; }
.book-stats-table td { padding: 2px 14px 2px 0; }
.book-stats-table .num { text-align: right; font-weight: 700; }
.book-stats-table .total td { border-top: 1px solid var(--border); padding-top: 5px; font-weight: 700; }
.book-stats-actions { display: flex; gap: 14px; margin: 4px 0; }
.book-stats-note { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.insights-h { margin: 10px 0 4px; font-size: 12px; color: var(--accent-dark); font-weight: 700; }
.insights-h:first-child { margin-top: 0; }
.insights-hdr td { font-size: 10.5px; color: var(--muted); font-weight: 600; padding-bottom: 0; }
.insights-line { margin: 2px 0 6px; font-size: 12px; color: var(--ink); }

/* ---------- Habit-driven personalisation ---------- */
.fav-badge { margin: 0 2px; font-size: 13px; }
.fav-toggle { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }
.fav-toggle input { width: auto !important; margin: 0; accent-color: var(--accent); }
.habit-hint {
  margin-top: 10px; padding: 7px 12px; width: 100%;
  border: 1px solid var(--accent-border); border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-dark);
  font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background 0.15s ease;
}
.habit-hint:hover { background: #ffe0d1; }

/* ---------- Mission copy: hero, checklist, early-bird ---------- */
.hero-line { font-size: 13.5px; line-height: 1.5; }
.hero-line strong { color: var(--accent-dark); font-size: 14.5px; }
.ready-box {
  background: var(--accent-soft); border: 1px solid var(--accent-border);
  border-radius: 12px; padding: 9px 12px; margin-bottom: 10px;
}
.ready-title { margin: 0 0 4px; font-size: 12.5px; font-weight: 700; color: var(--accent-dark); }
.ready-list { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.ready-list li { padding: 1px 0; color: var(--muted); }
.ready-list li.done { color: #15803d; font-weight: 600; }
.early-bird { margin: 0 0 7px; font-size: 12px; font-weight: 600; color: #b45309; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding: 12px 12px 20px; }
  .panel, .map-wrap, .results { grid-column: 1; grid-row: auto; }
  .map-wrap { position: static; }
  #map { height: 55vh; min-height: 340px; }
  .topbar { padding: 8px 14px; }
  .brand h1 { font-size: 19px; }
  .brand-logo { width: 34px; height: 34px; border-radius: 9px; }
  /* >=16px inputs stop iOS Safari auto-zooming on focus (app-like feel) */
  input[type="text"], input[type="number"], input[type="date"], select { font-size: 16px; }
}
