/* 후쿠오카 일정 생성기 — 모바일 우선. 여행지에서 폰으로 보는 화면이 기본이다. */

:root {
  --bg: #fbf8f4;
  --surface: #ffffff;
  --surface-2: #f4efe8;
  --text: #2a2520;
  --text-dim: #6f665c;
  --text-faint: #9a9088;
  --border: #e7ded2;
  --accent: #d4503a;
  --accent-soft: #fbeae6;

  --c-food: #d4503a;
  --c-sight: #3f8f6b;
  --c-shop: #8360b8;
  --c-cafe: #a06a3c;
  --c-rest: #3d8ba0;
  --c-hotel: #4a6fa5;
  --c-move: #9a9088;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(42, 37, 32, .05), 0 4px 16px rgba(42, 37, 32, .05);
  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15120f;
    --surface: #1e1a16;
    --surface-2: #262019;
    --text: #f0eae2;
    --text-dim: #a89e93;
    --text-faint: #7d7469;
    --border: #322b23;
    --accent: #e8705a;
    --accent-soft: #3a201b;

    --c-food: #e8705a;
    --c-sight: #5cb08a;
    --c-shop: #a487d6;
    --c-cafe: #c08a5c;
    --c-rest: #5aa8bd;
    --c-hotel: #7292c4;
    --c-move: #7d7469;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .2);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* ── 히어로 ─────────────────────────────────────────── */

.hero { padding: 24px 0 32px; }

.hero-eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--accent);
}

.hero-title {
  margin: 0 0 12px;
  font-size: clamp(28px, 7vw, 40px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -.02em;
}

.hero-desc {
  margin: 0;
  color: var(--text-dim);
  font-size: 15px;
  max-width: 46ch;
}

/* ── 폼 ─────────────────────────────────────────────── */

.form { display: flex; flex-direction: column; gap: 16px; }

.field-group {
  margin: 0;
  padding: 20px 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.legend {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 0;
  font-weight: 700;
  font-size: 15px;
}

.legend-num {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.field { flex: 1 1 220px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-sm { flex: 0 1 120px; }

.label { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.label em { color: var(--accent); font-style: normal; }

input[type="text"], input[type="datetime-local"], select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

input:focus, select:focus, button:focus-visible, .chip-toggle:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.hint {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text-faint);
}

.hint-strong { color: var(--accent); font-weight: 600; }

/* 선택형 칩 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.chip-toggle { position: relative; cursor: pointer; }
.chip-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }

.chip-toggle span {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  font-size: 14px;
  transition: background .12s, border-color .12s, color .12s;
}

.chip-toggle input:checked + span {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* 라디오 세그먼트 */
.segmented { display: flex; gap: 8px; }
.segmented label { flex: 1; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; }

.segmented span {
  display: block;
  padding: 10px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 14px;
}

.segmented input:checked + span {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* 버튼 */
.actions { display: flex; gap: 10px; margin-top: 8px; }

.btn {
  padding: 13px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary { flex: 1; background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }

.btn-ghost { background: transparent; color: var(--text-dim); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { padding: 8px 16px; font-size: 14px; }

.form-error {
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}

.foot { margin-top: 32px; text-align: center; }
.foot p { margin: 0; font-size: 12px; color: var(--text-faint); }

/* ── 결과 화면 ───────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.back { color: var(--text-dim); text-decoration: none; font-size: 15px; font-weight: 600; }
.back:hover { color: var(--accent); }

.loading, .empty { text-align: center; color: var(--text-dim); padding: 48px 0; }
.empty a { color: var(--accent); }

.card {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* 지도 카드 — Leaflet 인스턴스가 여기 들어간다 */
.map-card { margin-bottom: 16px; overflow: hidden; }

.map-view {
  height: 260px;
  width: 100%;
  /* Leaflet 타일은 항상 밝은 배경이라, 다크 모드에서도 지도 영역만은
     자체적으로 밝게 보이는 게 정상이다 — 페이지 전체를 반전시키지 않는다. */
  background: #e8eaed;
}

.map-caption {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 0;
  padding: 8px 14px;
  font-size: 11.5px;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
}

.map-legend { display: inline-flex; align-items: center; gap: 5px; }

.map-pin-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--accent);
}

.map-pin-swatch-approx {
  background: var(--text-faint);
  box-shadow: 0 0 0 1px var(--text-faint);
  opacity: .7;
}

.map-credit { margin-left: auto; }

/* Leaflet의 divIcon 마커 — 번호가 매겨진 원형 핀 */
.map-pin {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: "Consolas", monospace;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}

.map-pin-approx {
  background: var(--text-faint);
  opacity: .85;
}

.summary {
  padding: 20px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.summary-title { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.summary-sub { margin: 4px 0 0; color: var(--text-dim); font-size: 14px; }

.summary-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

.chip {
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px;
  color: var(--text-dim);
}

.chip-food { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.mock-banner {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  font-size: 13px;
  color: var(--text-faint);
}

/* 일자 탭 */
.day-tabs {
  display: flex;
  gap: 8px;
  margin: 20px 0 16px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.day-tab {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-dim);
  font: inherit;
  cursor: pointer;
}

.day-tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.day-tab-label { font-size: 14px; font-weight: 700; }
.day-tab-date { font-size: 12px; opacity: .8; }

.day-panel { display: none; }
.day-panel.is-active { display: block; }

/* 타임라인 */
.timeline { list-style: none; margin: 0; padding: 0; }

.block {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--c-move);
  box-shadow: var(--shadow);
}

.block-food  { border-left-color: var(--c-food); }
.block-sight { border-left-color: var(--c-sight); }
.block-shop  { border-left-color: var(--c-shop); }
.block-cafe  { border-left-color: var(--c-cafe); }
.block-rest  { border-left-color: var(--c-rest); }
.block-hotel { border-left-color: var(--c-hotel); }
.block-move  { border-left-color: var(--c-move); }

.block-time {
  flex: 0 0 46px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-top: 2px;
}

.block-start { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.block-end { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.block-body { flex: 1; min-width: 0; }
.block-head { display: flex; align-items: baseline; gap: 7px; }
.block-icon { font-size: 15px; }
.block-title { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.4; }

.block-why {
  margin: 5px 0 0;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.55;
}

.block-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }

.tag {
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--text-faint);
}

.map-link { font-size: 12px; color: var(--accent); text-decoration: none; font-weight: 600; }
.map-link:hover { text-decoration: underline; }

/* 이동 구간 — 블록 사이를 점선으로 잇는다. */
.move {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 6px 14px;
  min-height: 34px;
}

.move-line {
  width: 3px;
  align-self: stretch;
  margin-left: -14px;
  border-left: 2px dotted var(--border);
}

.move-text { font-size: 12.5px; color: var(--text-faint); }

/* 개발용 */
.schema-warning {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
}

.schema-warning ul { margin: 6px 0 0; padding-left: 18px; }

.debug { margin-top: 32px; font-size: 13px; color: var(--text-faint); }
.debug summary { cursor: pointer; }
.debug-note { margin: 10px 0; }

.debug pre {
  overflow-x: auto;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 12px;
  line-height: 1.5;
}
