:root {
  --green: #2e7d32;
  --green-dark: #1b5e20;
  --green-light: #e8f5e9;
  --ink: #1f2933;
  --muted: #5b6770;
  --line: #e2e6ea;
  --bg: #f6f8f6;
  --gold: #f5a623;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--green);
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 1000;
  transition: padding 0.18s ease;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { font-size: 32px; line-height: 1; transition: font-size 0.18s ease; }
.app-header h1 { margin: 0; font-size: 22px; letter-spacing: 0.2px; transition: font-size 0.18s ease; }
.tagline { margin: 2px 0 0; font-size: 13px; opacity: 0.9; transition: opacity 0.15s ease, max-height 0.18s ease; max-height: 40px; overflow: hidden; }

/* Collapsed header (after the sidebar is scrolled): just a small "My Parks". */
.app-header.collapsed { padding: 6px 20px; }
.app-header.collapsed .brand-mark { font-size: 18px; }
.app-header.collapsed .app-header h1,
.app-header.collapsed h1 { font-size: 16px; }
.app-header.collapsed .tagline { opacity: 0; max-height: 0; margin: 0; }
.app-header.collapsed .header-actions { display: none; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.btn-sm { padding: 7px 12px; font-size: 14px; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid #ffd54f; outline-offset: 2px; }
.btn-light { background: #fff; color: var(--green-dark); box-shadow: var(--shadow); }
.btn-light:hover { background: var(--green-light); }
.btn-primary { background: var(--green); color: #fff; width: 100%; padding: 13px; font-size: 16px; }
.btn-primary:hover { background: var(--green-dark); }
.btn-back {
  background: transparent;
  color: var(--green-dark);
  padding: 8px 4px;
  border-radius: 8px;
}
.btn-back:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 0;
}
.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 16px;
}
#map { height: 100%; width: 100%; }

/* ---------- Search & filters ---------- */
.search-row { margin-bottom: 12px; }
#search {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 10px;
}
#search:focus { outline: none; border-color: var(--green); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  font: inherit;
  font-size: 13px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip[aria-pressed="true"] { background: var(--green-light); border-color: var(--green); color: var(--green-dark); }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; }

.result-count { color: var(--muted); font-size: 13px; margin: 0 0 10px; }

/* ---------- Park list ---------- */
.park-list { list-style: none; margin: 0; padding: 0; }
.park-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: pointer;
  background: #fff;
}
.park-item:hover { border-color: var(--green); box-shadow: var(--shadow); }
.park-item .swatch { width: 12px; height: 40px; border-radius: 6px; flex: 0 0 auto; margin-top: 2px; }
.park-item h3 { margin: 0 0 3px; font-size: 16px; }
.park-item .meta { font-size: 13px; color: var(--muted); }
.park-item .dist { font-size: 12px; color: var(--green-dark); font-weight: 600; }

/* ---------- Detail view ---------- */
#detail-content h2 { margin: 6px 0 4px; font-size: 22px; }
.type-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: capitalize;
}
.detail-section { margin-top: 18px; }
.detail-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.addr { color: var(--ink); margin: 6px 0 0; }

/* facilities */
.facility-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.facility {
  background: var(--green-light);
  color: var(--green-dark);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
}
.empty-note {
  background: #fff8e1;
  border: 1px dashed var(--gold);
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  color: #8a6d00;
}
.source-tag { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 6px; }

/* rating */
.stars { display: inline-flex; gap: 4px; font-size: 30px; line-height: 1; }
.star {
  cursor: pointer;
  color: #d8dde2;
  background: none;
  border: none;
  padding: 0;
  transition: transform 0.08s ease;
}
.star.filled { color: var(--gold); }
.star:hover { transform: scale(1.15); }
.rating-note { font-size: 13px; color: var(--muted); margin-top: 6px; }
.rating-avg { font-size: 14px; color: var(--green-dark); font-weight: 700; margin-top: 4px; }

/* ---------- Ads + Premium ---------- */
.ad-area { margin: 14px 0 4px; }
.ad-area[hidden] { display: none; }
.ad-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  background: linear-gradient(135deg, #fffdf5, #f1f8f1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--ink);
}
.ad-banner:hover { border-color: var(--green); }
.ad-tag {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 5px;
}
.ad-text { font-size: 13px; line-height: 1.3; }
.ad-text strong { color: var(--green-dark); white-space: nowrap; }
.btn-link {
  background: none;
  border: none;
  color: var(--green-dark);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 2px;
  text-decoration: underline;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  position: relative;
  background: #fff;
  border-radius: 18px;
  padding: 28px 26px 22px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  text-align: center;
}
.modal h2 { margin: 0 0 4px; }
.modal-sub { margin: 0 0 18px; color: var(--muted); }
.modal-close {
  position: absolute;
  top: 10px; right: 14px;
  background: none; border: none;
  font-size: 26px; line-height: 1;
  color: var(--muted); cursor: pointer;
}
.plans { display: flex; gap: 12px; justify-content: center; margin-bottom: 18px; }
.plan {
  position: relative;
  flex: 1;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 16px 10px;
}
.plan-best { border-color: var(--green); background: var(--green-light); }
.plan-badge {
  position: absolute;
  top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--green); color: #fff;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.plan-price { font-size: 26px; font-weight: 800; color: var(--ink); }
.plan-per { font-size: 13px; color: var(--muted); }
.modal .btn-primary { width: 100%; margin-bottom: 8px; }
.modal .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.modal-note { font-size: 12px; color: var(--muted); margin: 10px 0 0; }

/* ---------- Park finder ---------- */
.finder-launch { width: 100%; }
.modal-wide { max-width: 480px; text-align: left; }
.finder-prefs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.finder-near { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 14px; cursor: pointer; }
.modal-wide .btn-primary { width: 100%; }
.finder-results { margin-top: 12px; }
.finder-h { margin: 4px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.finder-empty { font-size: 14px; color: #8a6d00; background: #fff8e1; border: 1px dashed var(--gold); border-radius: 10px; padding: 12px; }
.finder-result { display: block; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; cursor: pointer; font: inherit; }
.finder-result:hover { border-color: var(--green); box-shadow: var(--shadow); }
.fr-name { font-weight: 700; font-size: 16px; color: var(--ink); }
.fr-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.fr-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fr-tags span { background: var(--green-light); color: var(--green-dark); border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 600; }

/* ---------- Welcome / sign-in ---------- */
.welcome {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(160deg, var(--green), var(--green-dark));
}
.welcome[hidden] { display: none; }
.welcome-card {
  background: #fff; border-radius: 20px; padding: 34px 30px; max-width: 380px; width: 100%;
  text-align: center; box-shadow: 0 16px 50px rgba(0, 0, 0, 0.3);
}
.welcome-mark { font-size: 46px; line-height: 1; }
.welcome-card h1 { margin: 8px 0 4px; font-size: 28px; }
.welcome-sub { color: var(--muted); margin: 0 0 22px; font-size: 15px; }
.btn-google {
  width: 100%; background: #fff; color: #3c4043; border: 1.5px solid var(--line);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-google:hover { background: #f7f8f8; }
.g-mark { font-weight: 800; color: #4285f4; font-family: Arial, sans-serif; }
.welcome-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 16px 0; }
.welcome-or::before, .welcome-or::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.email-form { display: flex; flex-direction: column; gap: 10px; }
.email-form input { font: inherit; padding: 12px 14px; border: 2px solid var(--line); border-radius: 10px; }
.email-form input:focus { outline: none; border-color: var(--green); }
.email-form .btn-primary { width: 100%; }
.welcome-msg { font-size: 13px; color: var(--green-dark); min-height: 18px; margin: 10px 0 6px; }
.welcome .btn-link { margin-top: 6px; }

/* header identity */
.whoami {
  font-size: 13px; color: rgba(255, 255, 255, 0.9);
  max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- Polish ---------- */
.park-item { transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease; }
.park-item:hover { transform: translateY(-1px); }
.app-header h1 { font-weight: 800; }

/* ---------- UI refinements ---------- */
body { line-height: 1.45; }

/* Header: subtle gradient + cleaner identity cluster */
.app-header {
  background: linear-gradient(120deg, var(--green) 0%, var(--green-dark) 100%);
  border-bottom: none;
}
.header-actions { gap: 10px; }
.icon-btn {
  background: rgba(255, 255, 255, 0.18); color: #fff; border: none; border-radius: 999px;
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; text-decoration: none; cursor: pointer; transition: background 0.15s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.32); }
.icon-btn[hidden] { display: none; }

/* "Go Pro" accent button */
.btn-pro { background: var(--gold); color: #3a2c00; }
.btn-pro:hover { background: #e6951c; }

/* Sidebar primary actions */
.sidebar-actions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.near-btn { width: 100%; border: 1.5px solid var(--line); }

/* Sidebar footer links */
.sidebar-foot {
  margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center;
}
.sidebar-foot a { color: var(--green-dark); text-decoration: none; font-weight: 600; }
.sidebar-foot a:hover { text-decoration: underline; }

/* Card + type refinements */
.park-item { border-radius: 12px; }
.park-item .swatch { width: 6px; height: 38px; border-radius: 999px; }
.park-item h3 { font-size: 15.5px; letter-spacing: -0.1px; }
.result-count { font-weight: 600; }
#search { background: #fff; }
#search::placeholder { color: #9aa4ac; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 45% 55%; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--line); }
  .app-header { flex-wrap: wrap; }
}
