
:root{
  --bg: #0b1220;
  --panel: #111b2e;
  --panel2: #0f1930;
  --text: #eef2ff;
  --muted: rgba(238,242,255,.72);
  --line: rgba(255,255,255,.12);

  --accent: #CBA135;
  --kobe:  #FF0000;  /* 빨간색 */
  --kyoto: #0000FF;  /* 파란색 */
  --osaka: #800080;  /* 보라색 */
  --tokyo: #00FF99;  /* 민트색 */
--radius: 18px;
  --shadow: 0 18px 50px rgba(0,0,0,.45);
}

*{ box-sizing:border-box; }
html,body{
  height:100%;
  margin:0;
  background: radial-gradient(1200px 900px at 15% 10%, rgba(203,161,53,.12), transparent 55%),
              radial-gradient(1000px 700px at 80% 40%, rgba(37,99,235,.10), transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Noto Sans KR", Segoe UI, Roboto, Arial, sans-serif;
}

#app{
  display:flex;
  height: calc(100vh - 0px);
  width:100%;
}

/* Header/Footer */
.site-header{
  position:sticky;
  top:0;
  z-index:999;
  backdrop-filter: blur(10px);
  background: rgba(15, 25, 48, .65);
  border-bottom: 1px solid var(--line);
}
.header-inner{
  max-width: 1200px;
  margin:0 auto;
  padding: 12px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 16px;
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color: var(--text);
}
.brand-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(203,161,53,.65);
}
.brand-title{
  font-weight: 800;
  letter-spacing: .2px;
}
.header-nav .nav-link{
  color: var(--muted);
  text-decoration:none;
  font-weight:700;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.header-nav .nav-link:hover{
  border-color: var(--line);
  background: rgba(255,255,255,.04);
}

.site-footer{
  border-top: 1px solid var(--line);
  background: rgba(15, 25, 48, .55);
  backdrop-filter: blur(10px);
}
.footer-inner{
  max-width: 1200px;
  margin:0 auto;
  padding: 14px 16px;
  color: var(--muted);
  font-size:.92rem;
}

/* Sidebar */
#sidebar{
  width: 420px;
  min-width: 320px;
  max-width: 460px;
  background: linear-gradient(180deg, rgba(17,27,46,.95), rgba(15,25,48,.95));
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
  display:flex;
  flex-direction:column;
}
.sidebar-top{
  padding: 16px 16px 12px 16px;
}
.title{
  margin:0 0 6px 0;
  font-size: 1.05rem;
  font-weight: 900;
}
.subtitle{
  margin:0 0 14px 0;
  color: var(--muted);
  font-size: .9rem;
}

.region-buttons{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom: 12px;
}
.region-buttons button{
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 999px;
  cursor:pointer;
  font-weight: 800;
}
.region-buttons button.active{
  border-color: rgba(203,161,53,.45);
  background: rgba(203,161,53,.12);
  box-shadow: 0 0 0 3px rgba(203,161,53,.08) inset;
}
.search-container{
  position:relative;
  display:flex;
  align-items:center;
  gap:10px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 12px;
}
.result-count{
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
}
.search-icon{ color: rgba(238,242,255,.75); }
#search-input{
  flex:1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: .95rem;
}
.clear-btn{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(238,242,255,.75);
  cursor:pointer;
  display:none;
}
.clear-btn.visible{ display:inline-flex; align-items:center; justify-content:center; }
.clear-btn:hover{
  border-color: var(--line);
  background: rgba(255,255,255,.05);
}

.hint{
  margin-top: 12px;
  display:flex;
  gap:10px;
  align-items:center;
  color: var(--muted);
  font-weight:700;
}

.warn-box{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 196, 0, .25);
  background: rgba(255, 196, 0, .08);
  color: rgba(255, 238, 178, .95);
  font-size: .9rem;
}
.warn-box.hidden{ display:none; }

.toggle-list{
  margin-top: 12px;
  width:100%;
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  border-radius: 14px;
  padding: 12px 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-weight: 900;
}
.toggle-list:hover{ background: rgba(255,255,255,.06); }

.places-list-container{
  padding: 10px 12px 16px 12px;
  overflow:auto;
  flex:1;
}
#sidebar.list-collapsed .places-list-container{ display:none; }
.places-list{
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 0;
}
.place-card{
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.035);
  padding: 16px;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.place-card:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.05);
  border-color: rgba(203,161,53,.25);
}
.place-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.place-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 900;
}
.place-desc {
  margin: 8px 0;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.4;
}
.place-extra {
  margin: 0;
  font-size: .85rem;
  color: rgba(238,242,255,.6);
}
.card-title{
  margin: 0 0 6px 0;
  font-size: 1rem;
  font-weight: 900;
}
.card-desc{
  margin:0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow:hidden;
}
.badge{
  margin-top: 8px;
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:.85rem;
  font-weight:900;
  color: rgba(238,242,255,.88);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
}
.dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display:inline-block;
}
.dot.kobe{ background: var(--kobe); }
.dot.kyoto{ background: var(--kyoto); }
.dot.osaka{ background: var(--osaka); }
.dot.tokyo{ background: var(--tokyo); }
.dot.all{ background: var(--accent); }

/* Map */
#map-container{ flex:1; min-width:0; }
#map{ height:100%; width:100%; }

/* 장소명 라벨 — 기본 (선택 안 된 상태) */
.name-label {
  background: rgba(17,27,46,.70) !important;
  border: 1px solid rgba(255,255,255,.22) !important;
  border-radius: 6px !important;
  color: rgba(238,242,255,.80) !important;
  font-size: .75rem !important;
  font-weight: 600 !important;
  padding: 3px 7px !important;
  white-space: nowrap !important;
  box-shadow: 0 1px 4px rgba(0,0,0,.3) !important;
  pointer-events: none !important;
}
.name-label::before { display: none !important; }

/* 장소명 라벨 — 선택된 상태 (검정 배경 + 흰 글씨) */
.name-label.selected {
  background: #111 !important;
  border: 1.5px solid #fff !important;
  color: #fff !important;
  font-weight: 800 !important;
  font-size: .82rem !important;
  box-shadow: 0 2px 10px rgba(0,0,0,.55) !important;
  z-index: 9999 !important;
}

/* Leaflet Popup */
.leaflet-popup-content-wrapper{
  border-radius: 16px;
  background: rgba(17,27,46,.95);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.leaflet-popup-tip{ background: rgba(17,27,46,.95); }

.popup{ width: 360px; }
.popup-title{
  font-weight: 950;
  font-size: 1.02rem;
  margin-bottom: 4px;
}
.popup-sub{
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 10px;
}

/* ✅ 팝업 이미지: "가려짐/잘림" 방지 (contain + 자동 높이) */
.popup-media{
  width: 100%;
  border-radius: 14px;
  overflow:hidden;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.18);
  max-height: 55vh;
}
.popup-media img{
  width: 100%;
  height: auto;
  max-height: 55vh;
  object-fit: contain; /* ✅ 절대 안 잘림 */
  display:block;
}

/* ✅ 사진 위에 UI 겹치지 않게: 아래 컨트롤바 */
.popup-media-controls{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 10px 8px 0 8px;
}
.popup-media-controls .navs{ display:flex; gap:8px; }
.popup-media-controls button{
  cursor:pointer;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  width: 38px;
  height: 38px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.popup-media-controls button:hover{ background: rgba(255,255,255,.06); }

.popup-media-controls .dots{
  display:flex;
  gap:8px;
  align-items:center;
  justify-content:center;
  flex:1;
}
.popup-media-controls .dots button{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  padding:0;
  border:0;
  background: rgba(255,255,255,.35);
}
.popup-media-controls .dots button.active{
  background: rgba(203,161,53,.95);
}

.popup-desc{
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.35;
  font-weight: 700;
}
.popup-actions{
  margin-top: 12px;
  display:flex;
  justify-content:flex-end;
}
.popup-actions a{
  text-decoration:none;
  font-weight: 950;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(203,161,53,.35);
  background: rgba(203,161,53,.12);
}
.popup-actions a:hover{ background: rgba(203,161,53,.18); }
/* 모바일 */
@media (max-width: 860px){
  /* #app 높이 고정 해제 → 지도+패널+목록이 순서대로 쌓임 */
  #app{
    flex-direction: column;
    height: auto;
  }

  /* 지도 먼저 */
  #map-container {
    order: 1;
    height: 45vh;
    min-height: 220px;
    flex-shrink: 0;
  }
  #map { height: 45vh; min-height: 220px; }

  /* 목록 나중 */
  #sidebar{
    order: 3;
    width: 100%;
    max-width: none;
    min-width: 0;
    border-right: none;
    border-top: 1px solid var(--line);
    height: auto;
  }
  .popup{ width: 220px; }

  /* 모바일 팝업: 이름+배지만 작게 */
  .popup-mobile-simple .popup-slider,
  .popup-mobile-simple .popup-desc,
  .popup-mobile-simple .popup-coord,
  .popup-mobile-simple .popup-footer { display: none !important; }
  .popup-mobile-simple {
    padding: 6px 4px 2px;
  }

  /* 지도 아래 상세 패널 (order:2 → 지도와 목록 사이) */
  #mobile-detail-panel {
    display: none;
    order: 2;
    flex-shrink: 0;
    background: rgba(17,27,46,.97);
    border-top: 2px solid var(--accent);
    border-bottom: 1px solid var(--line);
    padding: 14px 16px;
    position: relative;
  }
  #mobile-detail-panel.visible { display: block; }
  #mobile-detail-panel .mdp-close {
    position: absolute;
    top: 10px; right: 12px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 1.1rem;
    cursor: pointer;
  }
  #mobile-detail-panel .mdp-name {
    font-size: 1rem;
    font-weight: 900;
    margin: 0 0 6px;
  }
  #mobile-detail-panel .mdp-desc {
    font-size: .88rem;
    color: var(--muted);
    line-height: 1.5;
    margin: 0 0 8px;
  }
  #mobile-detail-panel .mdp-coord {
    font-size: .78rem;
    color: rgba(238,242,255,.4);
    font-family: monospace;
    margin: 0 0 10px;
  }
  #mobile-detail-panel .mdp-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
}
