/* ============================================================
   Family Fall Trip Vote — main stylesheet
   ============================================================ */

:root {
  --bg:        #fdf6ec;
  --bg-soft:   #f6ede0;
  --ink:       #1c2541;
  --ink-soft:  #4a5275;
  --muted:     #7a7e95;
  --line:      #e7e0d2;
  --card:      #ffffff;
  --shadow:    0 6px 24px rgba(28,37,65,.07), 0 1px 2px rgba(28,37,65,.04);
  --shadow-l:  0 12px 40px rgba(28,37,65,.10), 0 2px 4px rgba(28,37,65,.06);
  --primary:   #ff6b6b;
  --primary-d: #e95757;
  --ok:        #1aa179;
  --warn:      #d97706;
  --err:       #c0392b;
  --radius:    18px;
  --radius-sm: 12px;
  --maxw:      980px;

  --font-sans:    "Inter", "Noto Sans SC", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Fraunces", "Noto Sans SC", Georgia, serif;
}

/* Chinese-active font tweak (optional) */
html[lang="zh"] {
  --font-display: "Noto Sans SC", "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

/* HTML `hidden` attribute must always win, even on flex/grid containers. */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--primary-d); }

img { max-width: 100%; display: block; }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  padding: 56px 20px 84px;
  overflow: hidden;
  isolation: isolate;
  text-align: center;
  background: linear-gradient(180deg, #fff8ea 0%, #fdf6ec 100%);
}
.hero-compact { padding: 36px 20px 56px; }

.hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(680px 360px at 12% 10%,  rgba(255,107,107,.18), transparent 60%),
    radial-gradient(580px 320px at 92% 18%,  rgba(67,97,238,.16),  transparent 60%),
    radial-gradient(720px 400px at 50% 100%, rgba(6,214,160,.14),  transparent 60%);
  filter: blur(4px);
}
.hero-inner {
  max-width: var(--maxw);
  margin: 0 auto;
}
.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}
.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
}
.lang-btn {
  background: var(--ink);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: transform .15s, background .15s;
}
.lang-btn:hover { background: var(--primary-d); transform: translateY(-1px); }

.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.1;
  letter-spacing: -.01em;
  margin: 0 0 12px;
}
.hero-subtitle {
  font-size: clamp(16px, 2vw, 19px);
  color: var(--ink-soft);
  margin: 0 auto 14px;
  max-width: 620px;
}
.hero-origin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

/* ============================================================
   Generic card / button
   ============================================================ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.card + .card { margin-top: 24px; }

button { font-family: inherit; }

.primary-btn {
  background: var(--ink);
  color: white;
  border: none;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  font-size: 15px;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.primary-btn:hover {
  background: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255,107,107,.35);
}
.primary-btn:disabled { opacity: .55; cursor: progress; transform: none; }

.ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  font-size: 14px;
  transition: background .15s, border-color .15s;
}
.ghost-btn:hover { background: var(--bg-soft); border-color: var(--ink); }

input, textarea, select {
  font-family: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(28,37,65,.10);
}

label {
  display: block;
  margin: 14px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
}
label > input, label > textarea {
  margin-top: 6px;
}

.muted { color: var(--muted); }
.error { color: var(--err); margin-top: 8px; font-size: 14px; }
.center-card { max-width: 480px; margin: 60px auto; text-align: center; }
.center-text { text-align: center; }
.row-between {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}

/* ============================================================
   Auth panel (always visible at top of page)
   ============================================================ */
.auth-panel {
  max-width: var(--maxw);
  margin: -52px auto 0;          /* lift card up over hero */
  padding: 0 20px;
  position: relative; z-index: 3;
}
.auth-card {
  max-width: 720px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.auth-card .auth-text h2 {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 0 0 6px;
}
.auth-card .auth-text p { margin: 0; }
#auth-form {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-top: 8px;
}
#auth-form label { margin: 0; }
#auth-form button { white-space: nowrap; height: 46px; }
@media (max-width: 720px) {
  #auth-form { grid-template-columns: 1fr; }
  #auth-form button { width: 100%; }
}
.auth-hint {
  margin: 8px 0 0;
  font-size: 13px;
  background: #fff5e0;
  border: 1px dashed #f0d6a0;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: #7a4a0c;
}

/* Logged-in pill */
.auth-pill {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  background: #eafbf0;
  border: 1px solid #b9e8cc;
  color: #0f6e4d;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 15px;
  max-width: 720px;
  margin: 0 auto;
}
.auth-pill strong { font-family: var(--font-display); }
.auth-pill .dot.ok {
  width: 10px; height: 10px; border-radius: 50%;
  background: #1aa179;
  box-shadow: 0 0 0 4px rgba(26,161,121,.2);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 4px rgba(26,161,121,.2); }
  50%     { box-shadow: 0 0 0 8px rgba(26,161,121,.05); }
}
.auth-pill .ghost-btn { margin-left: auto; padding: 6px 14px; font-size: 13px; }

/* ============================================================
   #app + voted banner
   ============================================================ */
#app {
  max-width: var(--maxw);
  margin: 32px auto 0;
  padding: 0 20px 80px;
  position: relative; z-index: 1;
}

.voted-banner {
  margin-top: 14px;
  max-width: 720px;
  margin-left: auto; margin-right: auto;
  background: linear-gradient(135deg, #fff7d6 0%, #ffe9d6 100%);
  border: 1px solid #f3deba;
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
}
.voted-banner em { font-style: normal; font-weight: 700; }
.voted-banner .dot { color: var(--muted); margin: 0 4px; }

/* ============================================================
   Overview map + comparison table
   ============================================================ */
.overview { margin-bottom: 32px; }
.section-h {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 28px 0 8px;
}

.overview-map {
  height: 380px;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  margin: 16px 0;
  background: #eaf3fa;
}

.compare-wrap {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 660px;
}
.compare-table th, .compare-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.compare-table th {
  background: var(--bg-soft);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.compare-table tr:last-child td { border-bottom: none; }
.compare-table tr:hover td { background: #fbf6ec; }
.compare-table .name-cell {
  display: flex; align-items: center; gap: 10px;
}
.compare-table .name-cell .em { font-size: 22px; }
.compare-table .pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-soft);
  color: var(--ink-soft);
}
.compare-table .pill.fly   { background: #e3eaff; color: #2d3fa8; }
.compare-table .pill.drive { background: #e0f4ea; color: #0f6e4d; }

/* ============================================================
   Destination cards
   ============================================================ */
.destinations {
  display: grid;
  gap: 32px;
}

.dest-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.dest-card:hover { box-shadow: var(--shadow-l); }

.dest-banner {
  padding: 28px;
  color: white;
  display: flex; align-items: center; gap: 18px;
  position: relative;
  overflow: hidden;
}
.dest-banner::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(400px 200px at 90% 0%, rgba(255,255,255,.25), transparent 60%);
  pointer-events: none;
}
.dest-emoji {
  font-size: 56px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.15));
}
.dest-banner-text { flex: 1; min-width: 0; }
.dest-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.15;
}
.dest-tagline { margin: 4px 0 0; opacity: .92; font-size: 15px; }

.dest-stats {
  padding: 16px 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.stat {
  display: inline-flex; align-items: center; gap: 6px;
  background: white;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--line);
  color: var(--ink);
}
.stat .stat-icon { font-size: 16px; line-height: 1; }
.stat strong { color: var(--ink); }

/* Two-column grid: map left, activities right */
.dest-grid {
  display: grid;
  grid-template-columns: minmax(0, 320px) 1fr;
  gap: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
}
@media (max-width: 720px) {
  .dest-grid { grid-template-columns: 1fr; }
}

.dest-map-col {
  padding: 22px 22px;
  border-right: 1px solid var(--line);
  background: #fafafa;
}
@media (max-width: 720px) {
  .dest-map-col { border-right: none; border-bottom: 1px solid var(--line); }
}
.dest-mini-map {
  width: 100%;
  height: 220px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: linear-gradient(135deg, #e0f0fa 0%, #cfe5f3 100%);
  margin-bottom: 12px;
}
.dest-travel-detail {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
}
.dest-travel-detail strong { color: var(--ink); }
.dest-travel-detail .travel-row {
  display: flex; align-items: baseline; gap: 6px;
  padding: 4px 0;
}
.dest-travel-detail .travel-row .icon { width: 18px; }

/* Activities column */
.dest-activities { padding: 22px 26px 22px; }
.activities-h {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0 0 10px;
}
.persona-block { margin: 12px 0; }
.persona-block h5 {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.persona-icon { font-size: 20px; }
.act-list {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 6px;
}
.act-list li {
  display: flex; gap: 8px; align-items: baseline;
  font-size: 14.5px;
  line-height: 1.5;
}
.act-list .a-icon { font-size: 17px; flex: 0 0 22px; }

/* Climate */
.dest-climate { padding: 22px 28px; border-bottom: 1px solid var(--line); }
.dest-climate h4 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0 0 10px;
}
.chart-wrap { position: relative; height: 280px; }
.chart-wrap.big { height: 360px; }
.pack-line {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
  background: #fff7d6;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

/* Cost */
.dest-cost { padding: 22px 28px; border-bottom: 1px solid var(--line); }
.dest-cost h4 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0 0 10px;
}
.cost-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}
@media (max-width: 600px) {
  .cost-grid { grid-template-columns: 1fr; }
}
.cost-cell {
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.cost-cell .cost-label {
  font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.cost-cell .cost-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  color: var(--ink);
}
.cost-cell.cost-total {
  background: #eafbf0; color: #0f6e4d;
}
.cost-cell.cost-total .cost-val { color: #0f6e4d; }

.hotel-examples {
  list-style: none; padding: 0; margin: 8px 0 0;
  display: grid; gap: 4px;
  font-size: 14px;
  color: var(--ink-soft);
}
.hotel-examples li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}
.hotel-examples li:last-child { border-bottom: none; }
.hotel-examples li .price { color: var(--ink); font-weight: 600; }

.cost-disclaimer { font-size: 12px; margin-top: 8px; }

/* Callouts */
.dest-callouts { padding: 0 28px; }
.callout {
  margin: 14px 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: flex; gap: 10px; align-items: flex-start;
  line-height: 1.5;
}
.callout.tip  { background: #e8f4fd; color: #0c4d7a; border-left: 4px solid #4361ee; }
.callout.warn { background: #fff3df; color: #7a4a0c; border-left: 4px solid #d97706; }

/* Vote button row */
.dest-vote-row {
  padding: 22px 28px 28px;
  text-align: center;
}
.vote-btn { font-size: 16px; padding: 14px 28px; }
.vote-btn[data-current="1"] {
  background: #1aa179;
}
.vote-btn[data-current="1"]:hover {
  background: #138961;
  box-shadow: 0 6px 20px rgba(26,161,121,.35);
}

/* ============================================================
   Modal
   ============================================================ */
.modal {
  position: fixed; inset: 0;
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(28,37,65,.45);
  backdrop-filter: blur(4px);
  cursor: pointer;
}
.modal-card {
  position: relative;
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  max-width: 460px;
  width: 100%;
  box-shadow: var(--shadow-l);
  animation: pop .18s ease-out;
}
.modal-card h3 {
  font-family: var(--font-display);
  margin: 0 0 6px;
  font-size: 22px;
}
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 14px;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink); color: white;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow-l);
  z-index: 60;
  max-width: 90vw;
  animation: toast-in .3s ease-out;
}
.toast.error { background: var(--err); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%); }
}

/* ============================================================
   Admin
   ============================================================ */
.admin-body { background: #f4eede; }
#admin-app { max-width: var(--maxw); margin: -28px auto 0; padding: 0 20px 80px; position: relative; z-index: 2; }
.admin-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 10px; flex-wrap: wrap;
}
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  background: white; border: 1px solid var(--line);
  font-weight: 600;
  color: var(--ink-soft);
}
.admin-summary {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: center;
}
@media (max-width: 720px) { .admin-summary { grid-template-columns: 1fr; } }
.summary-list { list-style: none; padding: 0; margin: 0; }
.summary-list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.summary-list li:last-child { border-bottom: none; }
.summary-list li .count { font-family: var(--font-display); font-weight: 700; }
.summary-list li.lead {
  background: #eafbf0;
  margin: 0 -12px; padding: 8px 12px;
  border-radius: var(--radius-sm);
  border-bottom: none;
}

.setting-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px dashed var(--line);
}
.setting-row:last-child { border-bottom: none; }

.add-family-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin: 12px 0;
}
.add-family-row input {
  flex: 1 1 180px; min-width: 0;
}
.add-voter-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr auto;
  gap: 8px;
  margin: 12px 0;
}
.add-voter-grid input { min-width: 0; }
@media (max-width: 720px) {
  .add-voter-grid { grid-template-columns: 1fr 1fr; }
  .add-voter-grid button { grid-column: 1 / -1; }
}
#admin-app { max-width: var(--maxw); margin: 0 auto; padding: 16px 20px 80px; position: relative; z-index: 2; }
#admin-gate { margin-top: -40px; }
.admin-table .copy-btn, .admin-table .del-btn {
  font-size: 12px; padding: 5px 10px;
}
.admin-table .del-btn { color: #c0392b; border-color: #f3c8c2; }
.admin-table .del-btn:hover { background: #fce8e6; border-color: #c0392b; }

.table-wrap { overflow-x: auto; margin-top: 8px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 600px; }
.admin-table th, .admin-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.admin-table th {
  background: var(--bg-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-soft);
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .code { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 13px; }

/* ============================================================
   Results page
   ============================================================ */
.results-main { max-width: var(--maxw); margin: -32px auto 0; padding: 0 20px 80px; position: relative; z-index: 2; }
.winner-banner {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, #ffe7c2 0%, #ffd6e8 100%);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 16px 0;
}
.winner-emoji { font-size: 44px; }
.winner-banner h3 { margin: 0; font-family: var(--font-display); font-size: 22px; }
.voter-list {
  list-style: none; padding: 0; margin: 8px 0 0;
  display: grid; gap: 6px;
}
.voter-list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 12px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.voter-list li .who { font-weight: 600; }
.voter-list li .what { color: var(--ink-soft); }
.voter-list li .comment { color: var(--muted); font-style: italic; flex: 1; text-align: right; }

/* ============================================================
   Footer
   ============================================================ */
.foot {
  text-align: center;
  padding: 32px 0 12px;
  font-size: 13px;
}

/* ============================================================
   Leaflet attribution overrides for cleanliness
   ============================================================ */
.leaflet-container { font-family: var(--font-sans); border-radius: var(--radius-sm); }
.leaflet-control-attribution {
  font-size: 10px !important;
  background: rgba(255,255,255,.85) !important;
}
.leaflet-popup-content { font-family: var(--font-sans); }
