/* ══════════════════════════════════════════════════
   1대간 9정맥 AI 등산코스 추천 — Design System
   Dark Mountain Theme · Glassmorphism · Premium UI
   ══════════════════════════════════════════════════ */

/* ── CSS 변수 ── */
:root {
  --bg-base: #080e1a;
  --bg-surface: #101828;
  --bg-card: #141f33;
  --bg-elevated: #1a2740;
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(255, 255, 255, 0.07);

  --green: #22c55e;
  --green-dark: #16a34a;
  --green-glow: rgba(34, 197, 94, 0.2);
  --amber: #f59e0b;
  --amber-dark: #d97706;
  --amber-glow: rgba(245, 158, 11, 0.2);
  --red: #ef4444;
  --red-glow: rgba(239, 68, 68, 0.2);
  --blue: #38bdf8;
  --blue-glow: rgba(56, 189, 248, 0.2);
  --purple: #a78bfa;
  --purple-glow: rgba(167, 139, 250, 0.2);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;

  --header-h: 64px;
  --left-w: 420px;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
}

/* ── 기본 리셋 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Noto Sans KR', 'Outfit', -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* ── 스크롤바 ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ══════════════════════════════════════
   HEADER
   ══════════════════════════════════════ */
#main-header {
  height: var(--header-h);
  background: rgba(8, 14, 26, 0.95);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 12px rgba(34, 197, 94, 0.5));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.logo-text { display: flex; flex-direction: column; }
.logo-title {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, #22c55e, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}
.logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
}

/* 산줄기 탭 */
.ridgeline-tabs {
  display: flex;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0;
}
.ridgeline-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  font-family: 'Noto Sans KR', sans-serif;
}
.tab-btn:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.15);
}
.tab-btn.active {
  background: linear-gradient(135deg, var(--green-dark), #0ea5e9);
  border-color: transparent;
  color: white;
  font-weight: 600;
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.3);
}

/* 완등 뱃지 */
.completed-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.15), rgba(167, 139, 250, 0.05));
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 20px;
  font-size: 12px;
  color: var(--purple);
  font-weight: 600;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--transition);
}
.completed-badge:hover {
  background: rgba(167, 139, 250, 0.2);
  box-shadow: 0 0 16px var(--purple-glow);
}
.badge-icon { font-size: 14px; }

/* ══════════════════════════════════════
   MAIN LAYOUT
   ══════════════════════════════════════ */
#app-main {
  display: flex;
  height: 100vh;
  padding-top: var(--header-h);
}

/* ══════════════════════════════════════
   LEFT PANEL
   ══════════════════════════════════════ */
#left-panel {
  width: var(--left-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-right: 1px solid var(--glass-border);
  overflow: hidden;
}

/* 패널 탭 */
.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--glass-border);
  background: var(--bg-base);
  flex-shrink: 0;
}
.panel-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: 'Noto Sans KR', sans-serif;
  position: relative;
}
.panel-tab:hover { color: var(--text-secondary); background: var(--glass); }
.panel-tab.active {
  color: var(--green);
  border-bottom: 2px solid var(--green);
  background: rgba(34, 197, 94, 0.05);
}
.tab-badge {
  background: var(--purple);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* 패널 콘텐츠 */
.panel-content { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.panel-content.active { display: flex; }

/* ── 채팅 패널 ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 검색 결과 영역 */
.results-area {
  flex-shrink: 0;
  max-height: 45%;
  overflow-y: auto;
  padding: 0 12px 12px;
  border-top: 1px solid var(--glass-border);
  background: var(--bg-base);
}

/* ── 메시지 버블 ── */
.message {
  display: flex;
  gap: 10px;
  animation: msgIn 0.3s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
}

.ai-message .message-avatar {
  background: linear-gradient(135deg, rgba(34,197,94,0.2), rgba(56,189,248,0.2));
  border-color: rgba(34, 197, 94, 0.3);
}

.message-content { flex: 1; min-width: 0; }

.message-bubble {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 4px var(--radius) var(--radius) var(--radius);
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-primary);
  backdrop-filter: blur(10px);
}

.user-message { flex-direction: row-reverse; }
.user-message .message-bubble {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(56, 189, 248, 0.1));
  border-color: rgba(34, 197, 94, 0.25);
  border-radius: var(--radius) 4px var(--radius) var(--radius);
}
.user-message .message-avatar {
  background: linear-gradient(135deg, #16a34a, #0ea5e9);
  color: white;
}

/* 마크다운 스타일 */
.message-bubble strong { color: var(--amber); font-weight: 600; }
.message-bubble p { margin-bottom: 6px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul, .message-bubble ol { padding-left: 18px; margin: 6px 0; }
.message-bubble li { margin-bottom: 3px; }
.message-bubble code {
  background: rgba(255,255,255,0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
}
.message-bubble h2, .message-bubble h3 {
  font-family: 'Outfit', sans-serif;
  color: var(--green);
  margin: 10px 0 6px;
}

/* 환영 메시지 */
.welcome-message .message-bubble {
  border-color: rgba(34, 197, 94, 0.2);
  background: linear-gradient(135deg, rgba(34,197,94,0.08), rgba(56,189,248,0.05));
}
.welcome-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 8px;
}

/* 추천 칩 */
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.chip {
  padding: 6px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Noto Sans KR', sans-serif;
}
.chip:hover {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--green);
  transform: translateY(-1px);
}

/* 로딩 점 */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 14px;
  align-items: center;
}
.typing-dot {
  width: 7px; height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* 입력창 */
.chat-input-wrap {
  padding: 12px;
  border-top: 1px solid var(--glass-border);
  background: var(--bg-base);
  flex-shrink: 0;
}
.chat-input-box {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.chat-input-box:focus-within {
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}
#chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13.5px;
  line-height: 1.6;
  resize: none;
  max-height: 100px;
  font-family: 'Noto Sans KR', sans-serif;
}
#chat-input::placeholder { color: var(--text-muted); }
#send-btn {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--green-dark), #0ea5e9);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}
#send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.4);
}
#send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.input-hint { font-size: 10px; color: var(--text-muted); margin-top: 5px; text-align: right; }

/* ══════════════════════════════════════
   TRAIL CARDS
   ══════════════════════════════════════ */
.trail-cards-section {
  padding: 12px 0;
}
.trail-cards-title {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  padding-top: 4px;
}

.trail-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.trail-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--green), var(--blue));
  opacity: 0;
  transition: opacity var(--transition);
}
.trail-card:hover {
  border-color: rgba(34, 197, 94, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.trail-card:hover::before { opacity: 1; }

/* 완등된 카드 */
.trail-card.completed-card {
  border-color: rgba(167, 139, 250, 0.3);
  background: linear-gradient(135deg, rgba(167,139,250,0.05), var(--bg-card));
  opacity: 0.7;
}
.trail-card.completed-card::before {
  background: linear-gradient(90deg, var(--purple), rgba(167,139,250,0.4));
  opacity: 1;
}

.card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; gap: 8px; }
.card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  flex: 1;
}
.completed-stamp {
  background: rgba(167,139,250,0.15);
  border: 1px solid rgba(167,139,250,0.4);
  color: var(--purple);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

.card-badges { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.badge-ridgeline {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: var(--green);
}
.badge-diff-하, .badge-diff-하중 {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: var(--blue);
}
.badge-diff-중 {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--amber);
}
.badge-diff-중상 {
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.25);
  color: #fb923c;
}
.badge-diff-상 {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--red);
}
.badge-np {
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.25);
  color: var(--purple);
}

.card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.stat-box {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 7px;
  text-align: center;
}
.stat-box .s-val { display: block; font-size: 13px; font-weight: 700; color: var(--amber); }
.stat-box .s-lbl { display: block; font-size: 10px; color: var(--text-muted); margin-top: 1px; }

.card-route {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  padding: 7px 10px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
}
.route-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.route-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.route-dot.red { background: var(--red); box-shadow: 0 0 6px var(--red); }
.route-arrow { color: var(--text-muted); flex: 1; text-align: center; }

.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.tag {
  font-size: 10px;
  padding: 2px 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  color: var(--text-muted);
}

.card-actions { display: flex; gap: 6px; }
.card-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid;
  font-family: 'Noto Sans KR', sans-serif;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.btn-map {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.3);
  color: var(--blue);
}
.btn-map:hover { background: rgba(56, 189, 248, 0.15); box-shadow: 0 0 10px var(--blue-glow); }
.btn-plan {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--amber);
}
.btn-plan:hover { background: rgba(245, 158, 11, 0.15); box-shadow: 0 0 10px var(--amber-glow); }
.btn-complete {
  background: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.3);
  color: var(--purple);
}
.btn-complete:hover { background: rgba(167, 139, 250, 0.15); box-shadow: 0 0 10px var(--purple-glow); }
.btn-complete.done {
  background: rgba(167, 139, 250, 0.15);
  border-color: var(--purple);
}

/* ══════════════════════════════════════
   완등 기록 패널
   ══════════════════════════════════════ */
#panel-completed {
  overflow-y: auto;
  padding: 16px;
  gap: 14px;
}

.completed-header {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
}

.completed-stats {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin-bottom: 14px;
}
.stat-item { text-align: center; }
.stat-number {
  display: block;
  font-size: 22px;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.stat-divider { width: 1px; height: 32px; background: var(--glass-border); }

.progress-section { }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.progress-bar-wrap {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  border-radius: 6px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.5);
}

/* 산줄기별 진행 */
.ridgeline-progress-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ridgeline-progress-item {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.rp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.rp-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.rp-count { font-size: 11px; color: var(--text-muted); }
.rp-bar-wrap { height: 4px; background: rgba(255,255,255,0.06); border-radius: 4px; overflow: hidden; }
.rp-bar { height: 100%; border-radius: 4px; transition: width 0.6s ease; }

/* 완등 목록 */
.completed-list { display: flex; flex-direction: column; gap: 8px; }

.completed-item {
  background: var(--bg-card);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: var(--radius);
  padding: 12px;
  animation: msgIn 0.3s ease;
  position: relative;
}
.ci-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ci-medal { font-size: 18px; }
.ci-name { flex: 1; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.ci-ridgeline {
  font-size: 10px;
  padding: 2px 8px;
  background: rgba(167,139,250,0.1);
  border: 1px solid rgba(167,139,250,0.3);
  border-radius: 10px;
  color: var(--purple);
  font-weight: 600;
}
.ci-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.ci-note { font-size: 11.5px; color: var(--text-secondary); font-style: italic; }
.ci-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.ci-remove-btn {
  background: none;
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: rgba(239, 68, 68, 0.5);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Noto Sans KR', sans-serif;
}
.ci-remove-btn:hover { border-color: var(--red); color: var(--red); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 40px; display: block; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 13px; line-height: 1.7; }

/* ══════════════════════════════════════
   MAP PANEL
   ══════════════════════════════════════ */
#map-panel {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#kakao-map {
  width: 100%;
  height: 100%;
  background: var(--bg-card);
}

.map-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}
.map-btn {
  padding: 8px 14px;
  background: rgba(8, 14, 26, 0.85);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: all var(--transition);
  font-family: 'Noto Sans KR', sans-serif;
}
.map-btn:hover, .map-btn.active {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--green);
}

.map-legend {
  position: absolute;
  bottom: 24px;
  left: 14px;
  display: flex;
  gap: 12px;
  background: rgba(8, 14, 26, 0.85);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  backdrop-filter: blur(12px);
  z-index: 10;
}
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-secondary); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.legend-dot.red { background: var(--red); box-shadow: 0 0 6px var(--red); }
.legend-dot.amber { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.legend-dot.blue { background: var(--blue); box-shadow: 0 0 6px var(--blue); }

/* 지도 위 트레일 정보 */
.map-trail-info {
  position: absolute;
  bottom: 24px;
  right: 14px;
  width: 260px;
  background: rgba(8, 14, 26, 0.9);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 14px;
  backdrop-filter: blur(16px);
  z-index: 10;
  animation: msgIn 0.3s ease;
}
.info-close {
  position: absolute;
  top: 8px; right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}
.info-close:hover { color: var(--text-primary); }

/* ══════════════════════════════════════
   ITINERARY
   ══════════════════════════════════════ */
.itinerary-wrap {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 12px 0;
  animation: msgIn 0.3s ease;
}
.itinerary-header {
  background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(34,197,94,0.1));
  padding: 14px 16px;
  border-bottom: 1px solid var(--glass-border);
}
.itinerary-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 4px;
  font-family: 'Outfit', sans-serif;
}
.itinerary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-secondary);
}
.itinerary-meta span { display: flex; align-items: center; gap: 4px; }

.itinerary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
}
.istat {
  padding: 10px;
  text-align: center;
  background: var(--bg-card);
}
.istat .iv { font-size: 16px; font-weight: 700; font-family: 'Outfit', sans-serif; color: var(--amber); }
.istat .il { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* 타임라인 */
.timeline { padding: 14px 16px; }
.timeline-item {
  display: flex;
  gap: 12px;
  padding-bottom: 16px;
  position: relative;
}
.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: var(--glass-border);
}
.tl-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  border: 2px solid var(--glass-border);
  background: var(--bg-elevated);
  position: relative;
  z-index: 1;
}
.tl-icon.start { border-color: var(--green); background: rgba(34,197,94,0.1); }
.tl-icon.hike { border-color: var(--blue); background: rgba(56,189,248,0.1); }
.tl-icon.peak { border-color: var(--amber); background: rgba(245,158,11,0.1); }
.tl-icon.rest { border-color: var(--purple); background: rgba(167,139,250,0.1); }
.tl-icon.end { border-color: var(--red); background: rgba(239,68,68,0.1); }

.tl-content { flex: 1; padding-top: 4px; }
.tl-time {
  font-size: 12px;
  font-weight: 700;
  color: var(--amber);
  font-family: 'Outfit', monospace;
}
.tl-activity { font-size: 13.5px; font-weight: 600; color: var(--text-primary); margin: 2px 0; }
.tl-detail { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

/* 준비물 */
.prep-section { padding: 12px 16px; border-top: 1px solid var(--glass-border); }
.prep-title { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.prep-list { display: flex; flex-wrap: wrap; gap: 5px; }
.prep-item {
  font-size: 11.5px;
  padding: 4px 10px;
  background: rgba(34,197,94,0.07);
  border: 1px solid rgba(34,197,94,0.15);
  border-radius: 12px;
  color: var(--green);
}

.itinerary-actions { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--glass-border); }
.itn-btn {
  flex: 1;
  padding: 9px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid;
  transition: all var(--transition);
  font-family: 'Noto Sans KR', sans-serif;
}
.itn-btn-map {
  background: rgba(56,189,248,0.08);
  border-color: rgba(56,189,248,0.3);
  color: var(--blue);
}
.itn-btn-complete {
  background: rgba(167,139,250,0.08);
  border-color: rgba(167,139,250,0.3);
  color: var(--purple);
}

/* ══════════════════════════════════════
   MODALS
   ══════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 380px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.itinerary-modal-box {
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 0;
}
@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.modal-icon { font-size: 32px; }
.modal-header h3 { font-size: 18px; font-weight: 700; font-family: 'Outfit', sans-serif; }

.modal-trail-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--amber);
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 16px;
}

.modal-date-wrap, .modal-note-wrap {
  margin-bottom: 14px;
}
.modal-date-wrap label, .modal-note-wrap label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.modal-date-input, .modal-note-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'Noto Sans KR', sans-serif;
  outline: none;
  transition: border-color var(--transition);
}
.modal-date-input:focus, .modal-note-input:focus {
  border-color: rgba(167,139,250,0.5);
}
.modal-date-input { color-scheme: dark; }

.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-cancel {
  flex: 1;
  padding: 11px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  font-family: 'Noto Sans KR', sans-serif;
  transition: all var(--transition);
}
.modal-cancel:hover { background: var(--glass-hover); }
.modal-confirm {
  flex: 2;
  padding: 11px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Noto Sans KR', sans-serif;
  transition: all var(--transition);
}
.modal-confirm:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4); }

.modal-close-btn {
  position: absolute;
  top: 14px; right: 14px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  z-index: 1;
}
.modal-close-btn:hover { color: var(--text-primary); background: var(--glass-hover); }

/* ── 카카오맵 커스텀 오버레이 ── */
.map-marker-label {
  background: rgba(8,14,26,0.85);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text-primary);
  white-space: nowrap;
  backdrop-filter: blur(8px);
  margin-top: 4px;
  pointer-events: none;
}

/* ── 유틸리티 ── */
.pulse {
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
}

/* 반응형 */
@media (max-width: 900px) {
  :root { --left-w: 100%; }
  #app-main { flex-direction: column; }
  #left-panel { width: 100%; height: 60vh; border-right: none; border-bottom: 1px solid var(--glass-border); }
  #map-panel { height: 40vh; }
  .ridgeline-tabs { display: none; }
}

/* ── 카카오맵 에러 가이드 ── */
.map-error-guide {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 30px;
  background: radial-gradient(circle at center, #111a2e, #080e1a);
  color: var(--text-primary);
  text-align: center;
}
.error-guide-icon {
  font-size: 54px;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 16px rgba(239, 68, 68, 0.4));
  animation: pulse-red 2s infinite;
}
@keyframes pulse-red {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.error-guide-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 10px;
}
.error-guide-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 480px;
  margin-bottom: 20px;
}
.error-guide-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: monospace;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-align: left;
}
.error-guide-meta strong {
  color: var(--amber);
}
.error-guide-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ── Leaflet 툴팁 테마 재정의 ── */
.leaflet-tooltip.map-marker-label {
  background: rgba(8, 14, 26, 0.9) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
  font-size: 11px !important;
  color: var(--text-primary) !important;
  white-space: nowrap !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  box-shadow: var(--shadow) !important;
  font-weight: 500 !important;
  font-family: 'Noto Sans KR', sans-serif !important;
}
/* Leaflet 툴팁 화살표 꼬리 제거 */
.leaflet-tooltip-top.map-marker-label::before,
.leaflet-tooltip-bottom.map-marker-label::before,
.leaflet-tooltip-left.map-marker-label::before,
.leaflet-tooltip-right.map-marker-label::before {
  border-color: transparent !important;
}

/* ── 네이버 지도 InfoWindow 기본 테두리 무력화 ── */
.naver-maps-infowindow {
  background: transparent !important;
  border: 0 none !important;
  box-shadow: none !important;
}
