html, body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }

/* ── Layout shell ── */
.page-wrap  { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.page-shell { padding: 32px 0 80px; }

/* ── Sub-header (mirrors dashboard .sub-header) ── */
.sub-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-title {
  font-family: var(--font-display); font-size: 30px; font-weight: 800;
  letter-spacing: -0.02em; color: var(--fg-1); margin: 0;
}
.page-sub { font-size: 14px; color: var(--fg-2); margin-top: 2px; }
.count-live { font-variant-numeric: tabular-nums; }

/* ── Search bar (mirrors dashboard SearchBar) ── */
.search-row {
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 24px; flex-wrap: wrap;
}
.search-pill {
  flex: 1; min-width: 200px;
  display: flex; align-items: center; gap: 12px;
  padding: 13px 20px; border-radius: var(--radius-pill);
  background: var(--bg-surface); box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-1);
}
.search-pill img { opacity: 0.45; flex-shrink: 0; }
.search-pill input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: var(--font-body); font-size: 14px; color: var(--fg-1);
}
.search-pill input::placeholder { color: var(--fg-3); }

/* Filter chips (mirrors dashboard filter buttons) */
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip {
  font-family: var(--font-body); font-weight: 600; font-size: 13px;
  padding: 10px 16px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-2);
  background: var(--bg-surface); color: var(--fg-2);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: all var(--dur-fast) var(--ease-soft);
  user-select: none;
}
.filter-chip:hover { color: var(--fg-1); border-color: var(--border-strong); }
.filter-chip.active {
  background: var(--mint-100); color: var(--mint-600);
  border-color: var(--mint-400);
}
.filter-chip .dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: currentColor; flex-shrink: 0;
}

/* ── Educational Level Filter Bar ── */
.filter-levels-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  padding: 8px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-pill);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.filter-bar-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-3);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}
.level-chips-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.level-filter-chip {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-1);
  background: transparent;
  color: var(--fg-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--dur-fast) var(--ease-soft);
  user-select: none;
}
.level-filter-chip:hover {
  color: var(--fg-1);
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}
.level-filter-chip.active {
  background: var(--sky-100);
  color: var(--sky-600);
  border-color: var(--sky-400, #7ec8e3);
  font-weight: 600;
}

/* Card Level Chips */
.chip-level {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
}
.chip-level-nursery {
  background: var(--peach-100);
  color: var(--peach-600);
}
.chip-level-kindergarten {
  background: var(--sunshine-100);
  color: var(--sunshine-600);
}
.chip-level-primary {
  background: var(--sky-100);
  color: var(--sky-600);
}
.chip-level-secondary {
  background: var(--lavender-100);
  color: var(--lavender-600);
}
.chip-clean-air {
  background: var(--mint-100);
  color: var(--mint-600);
}
.chip-aftercare {
  background: var(--sky-100);
  color: var(--sky-600);
}
.chip-nurse {
  background: var(--mint-100);
  color: var(--mint-600);
}
.chip-pickup {
  background: var(--lavender-100);
  color: var(--lavender-600);
}

/* ── School card grid (mirrors dashboard SchoolCard) ── */
.school-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.school-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 0;
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
  overflow: hidden;
  transition: box-shadow var(--dur-base) var(--ease-soft),
              transform var(--dur-base) var(--ease-soft),
              border-color var(--dur-fast) var(--ease-soft);
  cursor: pointer;
}
.school-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: var(--border-2);
}

/* ── Thumbnail banner ── */
.school-thumbnail {
  width: 100%; height: 148px; flex-shrink: 0;
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.school-thumbnail img.thumb-photo {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 400ms var(--ease-soft);
}
.school-card:hover .thumb-photo { transform: scale(1.04); }

/* Initials fallback inside thumbnail */
.school-thumbnail .school-avatar {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border-radius: 0;
  font-size: 40px;
}

/* Small type badge pinned to thumb top-right */
.thumb-type-chip {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
  padding: 4px 10px; border-radius: var(--radius-pill);
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

/* Avatar (legacy — kept for dashboard compat) */
.school-avatar {
  width: 56px; height: 56px; flex-shrink: 0;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 18px;
}
/* Card body — a column so the price shelf can be pinned to the bottom. */
.card-body {
  flex: 1; min-width: 0; padding: 16px 18px 18px;
  display: flex; flex-direction: column;
}
.card-name {
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  color: var(--fg-1); margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta {
  font-size: 13px; color: var(--fg-3); margin-bottom: 10px;
}
.card-chips { display: flex; gap: 6px; flex-wrap: wrap; }
/* Language lines vary wildly in length; two lines max keeps the price shelf
   from drifting up and down between cards. */
.card-chips .chip {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; text-align: left; line-height: 1.45;
}

/* ── Price shelf ──────────────────────────────────────────────────────────
   Its own line, same position on every card, tabular figures — so a column
   of cards reads as a price list you can scan straight down. */
.card-price {
  margin-top: auto;              /* pin to the bottom of the body */
  padding: 10px 12px 11px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
}
.card-chips:not(:empty) + .card-price { margin-top: 12px; }
.card-price-label {
  font-size: 11px; font-weight: 600; color: var(--fg-3);
  letter-spacing: 0.02em; margin-bottom: 3px;
}
.card-price-value {
  font-family: var(--font-display); font-weight: 800; font-size: 17px;
  font-variant-numeric: tabular-nums; color: var(--fg-1);
  line-height: 1.25;
}
.card-price-unit {
  font-family: var(--font-body); font-weight: 600; font-size: 12px;
  color: var(--fg-3); margin-left: 2px;
}
/* The entrance fee is where Thai schools differ most — surface it here so the
   first-year cost isn't a surprise on the detail page. */
.card-price-note {
  font-size: 11px; color: var(--fg-3); margin-top: 4px; line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
.card-price-none {
  font-size: 13px; color: var(--fg-3); line-height: 1.35;
}
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-body); font-weight: 600;
  font-size: 11px; padding: 4px 10px; border-radius: var(--radius-pill);
}
.chip-kindergarten { background: var(--peach-100);    color: var(--peach-600); }
.chip-private      { background: var(--mint-100);     color: var(--mint-600); }
.chip-public       { background: var(--sky-100);      color: var(--sky-600); }
.chip-charter      { background: var(--lavender-100); color: var(--lavender-600); }
.chip-international { background: var(--lavender-100); color: var(--lavender-600); }
.chip-bilingual    { background: var(--sky-100);      color: var(--sky-600); }
.chip-demonstration { background: var(--sunshine-100); color: var(--sunshine-600); }
.chip-default      { background: var(--bg-subtle);    color: var(--fg-2); }

/* Card arrow — now sits inside card-body footer row */
.card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px 14px;
  border-top: 1px solid var(--border-1);
}
.card-arrow {
  flex-shrink: 0; width: 28px; height: 28px;
  border-radius: 999px; background: var(--bg-subtle);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast) var(--ease-soft);
}
.school-card:hover .card-arrow { background: var(--mint-100); }
.card-arrow img { opacity: 0.5; }
.school-card:hover .card-arrow img { opacity: 1; }

/* ── Empty state (mirrors dashboard empty-pip) ── */
.empty-pip {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 64px 32px; gap: 12px;
}
.empty-pip img { width: 96px; height: 96px; }
.empty-pip h3 {
  font-family: var(--font-display); font-size: 20px;
  font-weight: 700; color: var(--fg-1); margin: 0;
}
.empty-pip p { color: var(--fg-2); max-width: 40ch; margin: 0; }
.empty-pip button {
  font-family: var(--font-body); font-weight: 600; font-size: 13px;
  padding: 10px 20px; border-radius: var(--radius-pill);
  border: none; background: var(--bg-subtle); color: var(--fg-2);
  cursor: pointer; margin-top: 4px;
  transition: background var(--dur-fast) var(--ease-soft);
}
.empty-pip button:hover { background: var(--border-1); }

/* ── Entry animation ── */
@keyframes fade-up { from { transform: translateY(6px); } to { transform: none; } }
.fade-in { opacity: 1; animation: fade-up 480ms cubic-bezier(0.22, 0.61, 0.36, 1); }

@media (max-width: 700px) {
  .school-grid { grid-template-columns: 1fr; }
  .sub-header { flex-direction: column; align-items: flex-start; }
  .school-thumbnail { height: 120px; }
  .map-top-bar { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Map & Radius Features ── */
.sub-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-2);
  background: var(--bg-surface);
  color: var(--fg-1);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-soft);
  box-shadow: var(--shadow-sm);
}
.view-toggle-btn:hover {
  border-color: var(--mint-400);
  background: var(--mint-50);
}
.view-toggle-btn.active {
  background: var(--mint-600);
  color: #fff;
  border-color: var(--mint-600);
}
.view-toggle-btn.active svg {
  stroke: #fff;
}

/* ── Radius Filter Button in search row ── */
.radius-filter-wrap {
  display: flex;
  align-items: center;
}
.radius-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--peach-300, #F4C4AA);
  background: var(--peach-50, #FFF5ED);
  color: var(--peach-700, #B24822);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-soft);
  user-select: none;
}
.radius-filter-btn:hover {
  background: var(--peach-100);
  border-color: var(--peach-400);
}
.radius-filter-btn.active {
  background: var(--peach-600);
  color: #fff;
  border-color: var(--peach-600);
}
.radius-filter-btn.loading {
  opacity: 0.7;
  cursor: wait;
}

/* ── Map Section ── */
.map-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
  animation: fade-up 320ms var(--ease-soft);
}
.map-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-1);
  flex-wrap: wrap;
  gap: 10px;
}
.map-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-2);
}
.map-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.map-tool-btn {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-2);
  background: var(--bg-surface);
  color: var(--fg-2);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-soft);
}
.map-tool-btn:hover {
  background: var(--border-1);
  color: var(--fg-1);
}
.schools-map-container {
  width: 100%;
  height: 440px;
  z-index: 1;
}

/* ── Radius Banner ── */
.radius-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--mint-50);
  border: 1px solid var(--mint-200, #BBE4DC);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.radius-banner-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--mint-700, #1F6052);
}
.btn-clear-radius {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--mint-400);
  background: #fff;
  color: var(--mint-700, #1F6052);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-soft);
}
.btn-clear-radius:hover {
  background: var(--mint-100);
}

/* ── Card Distance Badge ── */
.card-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.card-distance-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--mint-100);
  color: var(--mint-600);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Custom Leaflet Popup Styling ── */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-md) !important;
  padding: 4px;
  font-family: var(--font-body);
}
.school-marker-popup {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.4;
  padding: 4px 6px;
  min-width: 200px;
}
.school-marker-popup h4 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--fg-1);
  margin: 0 0 4px;
}
.school-marker-popup .popup-meta {
  font-size: 12px;
  color: var(--fg-3);
  margin-bottom: 6px;
}
.school-marker-popup .popup-price {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  color: var(--fg-1);
  margin-bottom: 8px;
}
.school-marker-popup .popup-btn {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--mint-600);
  color: #fff !important;
  text-decoration: none;
  text-align: center;
}

