/* =============================================
   촌픽 여행 지도 페이지 스타일 (시골 감성 / 미연시 톤)
   travel-map.css
   ============================================= */

:root {
  --green: #28734c;
  --green-dark: #16442e;
  --green-light: #D3EFA4;
  --green-pale: #f0fbe4;
  --lime: #dcefae;
  --ink: #1d2b22;
  --muted: #647168;
  --line: #e4e8df;
  --bg: #f8fbf4;
  --shadow-sm: 0 4px 14px rgba(34,65,47,.08);
  --shadow: 0 14px 36px rgba(34,65,47,.12);
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --header-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }
body { font-family: Pretendard, 'Noto Sans KR', sans-serif; background: var(--bg); color: var(--ink); word-break: keep-all; }
button, input, select { font: inherit; }
a { text-decoration: none; color: inherit; }

/* ── HEADER (home.css 네비 이식) ── */
.tm-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(211, 239, 164, .92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #b8db86;
  }
  .tm-header-inner {
    max-width: 1160px;
    margin: auto;
    padding: 0 32px;
    height: var(--header-h);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
  }

.tm-logo {
  justify-self: start;
  display: flex;
  align-items: center;
}

.tm-logo img {
  width: auto;
  height: 60px;
  object-fit: contain;
  display: block;
}

.tm-nav {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid #b8db86;
  border-radius: 999px;
  background: rgba(255, 255, 255, .4);
  color: #37662f;
  font-size: 15px;
  font-weight: 600;
}

.tm-nav a {
  padding: 8px 16px;
  border-radius: 999px;
  white-space: nowrap;
  text-decoration: none;
  color: inherit;
}

.tm-nav a:hover {
  background: rgba(63, 148, 87, .14);
  color: #276b34;
}

.tm-nav a.active {
  color: #276b34;
  background: rgba(63, 148, 87, .14);
}

/* .tm-header-btn {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  border: 1px solid #fff;
  border-radius: 99px;
  padding: 10px 20px;
  background: #B8DD8A;
  color: #314c31;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(46, 107, 60, .12);
  text-decoration: none;
  cursor: pointer;
}

.tm-header-btn:hover {
  background: #fff;
  color: #20401f;
} */




/* ── 3열 레이아웃 ── */
.tm-layout {
  display: grid;
  grid-template-columns: 360px 1fr 340px;
  height: calc(100vh - var(--header-h));
  /* iPad Safari 등에서 주소창 높이 변동 시 하단 입력창이 잘리지 않도록 보정 */
  height: calc(100dvh - var(--header-h));
  margin-top: var(--header-h);
  overflow: hidden;
}

/* ── 왼쪽 챗 패널 (덕이 대화) ── */
.tm-chat-panel {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: #f6f6f1;
  overflow: hidden;
}

.chat-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(115deg, #3f9457, #276b34);
  color: #fff;
  flex: none;
}
.chat-header-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-header-avatar {
  width: 40px; height: 40px; object-fit: contain; flex: none;
  background: rgba(255,255,255,.16); border-radius: 50%; padding: 5px;
}
.chat-header small {
  display: block;
  opacity: .82;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
}
.chat-header strong {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}
.chat-header-weather {
  display: flex; align-items: center; gap: 7px; flex: none;
  background: rgba(255,255,255,.14); border-radius: 12px; padding: 5px 11px 5px 9px;
}
.chat-header-weather span { font-size: 19px; line-height: 1; }
.chat-header-weather small { display: block; font-size: 10px; opacity: .85; white-space: nowrap; text-transform: none; letter-spacing: normal; font-weight: 400; }
.chat-header-weather strong { font-size: 13px; white-space: nowrap; }

.tm-chat-body {
  flex: 1; overflow-y: auto;
  padding: 20px 18px;
  display: flex; flex-direction: column; gap: 12px;
  background: #f6f6f1;
}

/* ── AI Chatbot Duck Style Unification ── */
.chat-row {
  display: flex;
  margin-bottom: 16px;
  width: 100%;
  align-items: flex-start;
  animation: message-in .25s ease-out;
}
.bot-chat-row {
  justify-content: flex-start;
  gap: 10px;
}
.user-chat-row {
  justify-content: flex-end;
}
.chat-duck-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: #f0fbe4;
  border: 1px solid #d3efa4;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.chat-duck-bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 78%;
  gap: 4px;
}
.chat-duck-name {
  font-size: 12px;
  font-weight: 700;
  color: #3b5a40;
  margin-left: 2px;
}

.bot-message, .user-message {
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.6;
  max-width: 100%;
  box-shadow: 0 4px 14px rgba(46,74,40,.08);
}
.bot-message {
  background: #fff;
  border: none;
  border-radius: 18px 18px 18px 6px;
  color: #1d2b22;
  align-self: flex-start;
}
.user-message {
  background: #fee500;
  border-radius: 18px 4px 18px 18px;
  color: #191919;
  font-weight: 600;
  align-self: flex-end;
}
.tm-welcome-title { margin: 0 0 12px; font-size: 16px; font-weight: 800; color: #24331f; }
.tm-welcome-text { margin: 0 0 14px; font-size: 14.5px; line-height: 1.7; color: #4a5a44; }
.tm-welcome-divider { height: 1px; background: #eef0e6; margin: 0 0 14px; }
.tm-welcome-options { display: flex; flex-direction: column; gap: 10px; }
.tm-welcome-option {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid #e3e6da; border-radius: 13px;
  padding: 13px 16px; font-size: 14.5px; font-weight: 700; color: #37662f;
  font-family: inherit; text-decoration: none; cursor: pointer;
  transition: all .15s ease;
}
.tm-welcome-option:hover { background: #f2f7ea; border-color: #cfe0b8; }

.loading-message {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  color: #647168;
}
.loading-message i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: dot 1s infinite;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.tm-loading-msg { align-self: flex-start; display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; font-weight: 600; padding: 10px 14px; background: #fff; border-radius: 16px; border: 1px solid var(--line); }
.tm-loading-msg i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: dot 1s infinite; }
.tm-loading-msg i:nth-child(2) { animation-delay: .15s; }
.tm-loading-msg i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%,80%,100%{transform:translateY(0);opacity:.4}40%{transform:translateY(-4px);opacity:1} }

/* 미연시 선택 버튼 그룹 */
.tm-quick-wrap { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0; }
.tm-option-buttons { animation: msgIn .3s ease; }
.tm-quick-btn {
  border: 1px solid #e3e6da;
  border-radius: 13px;
  padding: 11px 15px;
  background: #fff;
  color: #37662f;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: none;
}
.tm-quick-btn:hover {
  background: #f2f7ea;
  border-color: #cfe0b8;
  transform: none;
  box-shadow: none;
}
.tm-quick-btn:active { transform: scale(.96); }

.tm-chat-input-area {
  display: flex; gap: 10px; padding: 14px 16px;
  border-top: none;
  background: #ecefe4;
}

.tm-chat-input {
  flex: 1; border: 1px solid #dbe2cf; border-radius: 999px;
  padding: 13px 18px; font-size: 14.5px; outline: none; color: #24331f;
  background: #fff;
  transition: border-color .18s;
}
.tm-chat-input:focus { border-color: var(--green); }
.tm-send-btn {
  width: 46px; height: 46px; border: none; border-radius: 50%;
  background: #3f9457; color: #fff; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(63,148,87,.35);
  transition: background .15s, transform .15s;
}
.tm-send-btn:hover { background: #33813f; transform: scale(1.05); }

/* ── 가운데 지도 패널 ── */
.tm-map-panel { position: relative; overflow: hidden; }

.tm-map-toolbar {
  position: absolute; top: 16px; left: 16px; right: 16px; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 10px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(228,232,223,.8);
}

.tm-map-label { font-size: 14px; font-weight: 800; color: var(--green-dark); }

.tm-map-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.tm-filter { border: 1.5px solid var(--line); border-radius: 99px; padding: 6px 13px; background: #fff; font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; transition: all .18s ease; }
.tm-filter.active, .tm-filter:hover { background: var(--green); border-color: var(--green); color: #fff; }

.tm-map {
  width: 100%; height: 100%;
  background: #f6faf0;
  display: flex; align-items: center; justify-content: center;
  padding: 70px 4px 6px;
}

/* 확대 축소 버튼 — 지도 오른쪽 하단 */
.tm-zoom-controls {
    position: absolute;
    right: 16px;
    bottom: 24px;
    z-index: 12;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .tm-zoom-controls button {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(228,232,223,.9);
    border-radius: 12px;
    background: rgba(255,255,255,.95);
    font-size: 20px;
    font-weight: 700;
    color: #2b4a2f;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
  }
  .tm-zoom-controls button:hover { background: #fff; }

.tm-map svg { max-height: 100%; }
.tm-map g[transform] text { pointer-events: none; user-select: none; }

.tm-map-result-banner {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--green-dark); color: #fff;
  border-radius: 99px; padding: 11px 22px;
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow);
  animation: bannerPop .3s ease;
  z-index: 10;
}
@keyframes bannerPop { from { opacity: 0; transform: translateX(-50%) translateY(12px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.tm-banner-close { border: none; background: rgba(255,255,255,.2); border-radius: 50%; width: 22px; height: 22px; color: #fff; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; }

.tm-custom-pin-label {
  background: #28734c; color: #fff; border-radius: 99px; padding: 5px 11px;
  font-size: 12px; font-weight: 800; white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,.25); animation: pinBounce .4s ease;
}
@keyframes pinBounce { 0% { transform: translateY(-10px); } 50% { transform: translateY(3px); } 100% { transform: translateY(0); } }

/* ── 오른쪽 정보 패널 ── */
.tm-info-panel {
  border-left: 1px solid var(--line);
  background: #fff;
  overflow-y: auto;
  display: flex; flex-direction: column;
}

.tm-info-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 40px 24px; color: var(--muted);
}
.tm-info-empty-icon 
{ font-size: 10px; margin-bottom: 5px; opacity: .8; }

.tm-info-empty-icon img 
{ width: auto; height: 150px;}

.tm-info-empty p { font-size: 14px; line-height: 1.7; }

/* ── 추천 목록 카드 ── */
.tm-rec-list-title { padding: 20px 20px 12px; font-size: 17px; font-weight: 800; color: var(--ink); }

.tm-rec-card {
  margin: 0 16px 14px;
  background: var(--green-pale);
  border: 1.5px solid var(--green-light);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all .2s ease;
}
.tm-rec-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); border-color: var(--green); }

.tm-rec-card-rank { font-size: 12px; font-weight: 800; color: var(--green); margin-bottom: 6px; }
.tm-rec-card-name { font-size: 17px; font-weight: 800; margin-bottom: 4px; color: var(--ink); }
.tm-rec-card-region { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.tm-rec-card-program { font-size: 12px; font-weight: 700; color: var(--green-dark); background: rgba(255,255,255,.85); border-radius: 8px; padding: 6px 10px; display: inline-block; }

/* ── 장소 상세 ── */
.tm-back-btn { display: inline-block; margin: 16px 16px 10px; border: 1.5px solid var(--line); border-radius: 99px; padding: 8px 16px; background: #fff; font-size: 13px; font-weight: 700; cursor: pointer; color: var(--muted); transition: all .18s ease; }
.tm-back-btn:hover { border-color: var(--green); color: var(--green); }

.tm-place-photo {
  height: 180px;
  background: linear-gradient(135deg, #4a7c4e 0%, #2d5a35 100%);
  background-size: cover; background-position: center;
  border-radius: 0 0 20px 20px;
}

.tm-place-body { padding: 20px; }
.tm-place-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.tm-place-name {
  font-size: 22px; font-weight: 800; letter-spacing: -.5px;
  color: var(--ink); margin: 0; flex: 1; min-width: 0;
  line-height: 1.3;
}
.tm-place-browse-btn {
  flex-shrink: 0;
  margin-top: 4px;
  padding: 7px 14px;
  border: none;
  border-radius: var(--radius);
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(40,115,76,.24);
  transition: all .18s ease;
  cursor: pointer;
}
.tm-place-browse-btn:hover {
  background: var(--green-dark);
  color: #fff;
  transform: translateY(-2px);
}
.tm-place-region { font-size: 14px; color: var(--muted); margin-bottom: 14px; }

.tm-place-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tm-place-chip { padding: 6px 11px; border-radius: 99px; background: var(--green-pale); color: var(--green-dark); font-size: 12px; font-weight: 700; border: 1px solid var(--green-light); }

.tm-place-stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.tm-place-stat { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--green-pale); border-radius: 14px; border: 1px solid var(--green-light); }
.tm-stat-icon { font-size: 24px; }
.tm-place-stat small { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; font-weight: 700; }
.tm-place-stat strong { font-size: 13px; font-weight: 800; color: var(--ink); }

.tm-place-reason {
  background: #f5f8ef;
  border-left: 3px solid var(--green);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13px; line-height: 1.6;
  margin-bottom: 16px;
  color: var(--ink);
}

.tm-place-reason strong { display: block; font-size: 15px; font-weight: 800; color: var(--green); margin-bottom: 4px; letter-spacing: .5px; }

.tm-place-exp { background: #fff7e0; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; border: 1px solid #f0e09a; }
.tm-place-exp-title { font-size: 15px; font-weight: 800; color: #7a5a00; margin-bottom: 6px; }
.tm-place-exp-list,
.tm-place-exp-list > div {
  font-size: 13px;
  color: #5a4000;
  line-height: 1.6;
}

.tm-map-open-btn {
  margin: 0 0 16px;
  display: block; width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--green);
  color: #fff;
  text-align: center;
  font-size: 15px; font-weight: 800;
  box-shadow: 0 8px 20px rgba(40,115,76,.24);
  transition: all .18s ease;
}
.tm-map-open-btn:hover { background: var(--green-dark); transform: translateY(-2px); }

/* ── 모바일 탭 (대화 / 지도 / 정보) ── */
.tm-mobile-tabs {
  display: none;
}

/* ── 반응형 ── */
@media (max-width: 1100px) {
  .tm-layout { grid-template-columns: 320px 1fr 300px; }
}

@media (max-width: 900px) {
  :root {
    --header-h: 62px;
    --tm-tabs-h: 52px;
  }

  .tm-header-inner { padding: 0 17px; }
  .tm-logo img { height: 40px; }

  .tm-mobile-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    z-index: 90;
    height: var(--tm-tabs-h);
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 4px 14px rgba(34, 65, 47, .06);
  }

  .tm-mobile-tab {
    border: 0;
    background: transparent;
    color: #647168;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    min-height: 52px;
    -webkit-tap-highlight-color: transparent;
  }

  .tm-mobile-tab.is-active {
    color: #276b34;
    box-shadow: inset 0 -3px 0 #3f9457;
    background: #f3fbea;
  }

  .tm-layout {
    display: block;
    height: calc(100dvh - var(--header-h) - var(--tm-tabs-h));
    margin-top: calc(var(--header-h) + var(--tm-tabs-h));
    overflow: hidden;
  }

  html, body {
    overflow: hidden;
    height: 100%;
  }

  .tm-chat-panel,
  .tm-map-panel,
  .tm-info-panel {
    display: none;
    height: 100%;
    min-height: 0;
    border: none;
  }

  .tm-layout[data-active-panel="chat"] .tm-chat-panel,
  .tm-layout[data-active-panel="map"] .tm-map-panel,
  .tm-layout[data-active-panel="info"] .tm-info-panel,
  .tm-layout:not([data-active-panel]) .tm-chat-panel {
    display: flex;
    flex-direction: column;
  }

  .tm-layout[data-active-panel="map"] .tm-map-panel {
    display: block;
    height: 100%;
  }

  .tm-map-panel { height: 100% !important; position: relative; }
  #tm-map { height: 100%; min-height: 280px; }

  .tm-map-toolbar {
    left: 10px;
    right: 10px;
    top: 10px;
    padding: 8px 10px;
    gap: 8px;
    overflow: hidden;
  }

  .tm-map-label {
    flex-shrink: 0;
    font-size: 12px;
  }

  .tm-map-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
  }

  .tm-map-filters::-webkit-scrollbar { display: none; }

  .tm-filter {
    flex-shrink: 0;
    min-height: 34px;
    white-space: nowrap;
  }

  .chat-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px;
    flex-shrink: 0;
  }

  .chat-header-weather {
    margin-left: auto;
  }

  .chat-header-weather small,
  .chat-header-weather strong {
    font-size: 11px;
  }

  .tm-chat-body {
    padding: 12px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .chat-duck-bubble-wrap {
    max-width: 84%;
  }

  .tm-chat-input-area {
    padding: 10px 12px max(12px, env(safe-area-inset-bottom));
    gap: 8px;
    flex-shrink: 0;
  }

  .tm-chat-input {
    min-height: 46px;
    font-size: 16px;
  }

  .tm-send-btn {
    width: 46px;
    height: 46px;
    min-width: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .tm-quick-wrap {
    width: 100%;
  }

  .tm-quick-btn,
  .tm-option-btn,
  .tm-welcome-option {
    min-height: 46px;
    font-size: 14.5px;
    width: 100%;
    justify-content: flex-start;
  }

  .tm-info-panel {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: #f8fbf4;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .tm-map-open-btn,
  .tm-back-btn {
    min-height: 48px;
  }

  /* 햄버거 열릴 때 탭/패널 위에 드로어 */
  body.nav-open .tm-mobile-tabs {
    z-index: 80;
  }
}
