* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  background: #14161a;
  color: #e8eaed;
}

#app {
  display: flex;
  height: 100vh;
}

#map {
  flex: 1;
  min-width: 0;
  height: 100%;
  position: relative;
}

#bounds-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid #3a404c;
  background: #1c1f26;
  color: #c3c9d4;
  font-size: 12.5px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}

#bounds-btn:hover { border-color: #4c8dff; }

#bounds-btn.on {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

#sidebar {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #1c1f26;
  border-left: 1px solid #2c313a;
}

#sidebar-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid #2c313a;
}

#sidebar-header h1 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
}

#sidebar-header h1 #count {
  font-size: 13px;
  font-weight: 400;
  color: #8b93a1;
}

#controls {
  display: flex;
  gap: 8px;
}

#search {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #2c313a;
  background: #14161a;
  color: #e8eaed;
  font-size: 14px;
  outline: none;
}

#search:focus { border-color: #4c8dff; }

#filter-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #2c313a;
  background: #14161a;
  color: #e8eaed;
  font-size: 13.5px;
  cursor: pointer;
}

#filter-btn:hover { border-color: #4c8dff; }

#filter-btn.on {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

/* 필터 패널 */
#filter-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: #22262e;
  border-bottom: 1px solid #2c313a;
  box-shadow: 0 10px 24px rgba(0,0,0,.45);
  padding: 12px 16px;
  z-index: 20;
  max-height: 60vh;
  overflow-y: auto;
}

#filter-panel.hidden { display: none; }

#sidebar-header { position: relative; }

.f-sec { margin-bottom: 14px; }

.f-sec h4 {
  font-size: 12.5px;
  color: #8b93a1;
  font-weight: 600;
  margin-bottom: 7px;
}

.f-sec h4 small { font-weight: 400; }

.f-sec h4 #f-price-label { color: #4c8dff; margin-left: 6px; }

.f-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
}

.f-check input { accent-color: #1d4ed8; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid #3a404c;
  background: #14161a;
  color: #c3c9d4;
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}

.chip:hover { border-color: #4c8dff; }

.chip.on {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

.chip small { color: inherit; opacity: .65; margin-left: 2px; }

/* 가격대 듀얼 슬라이더 */
.range-wrap {
  position: relative;
  height: 26px;
  margin: 4px 2px 0;
}

.range-track {
  position: absolute;
  top: 11px;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 2px;
  background: #3a404c;
}

.range-fill {
  position: absolute;
  height: 100%;
  border-radius: 2px;
  background: #4c8dff;
}

.range-wrap input[type=range] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 26px;
  margin: 0;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.range-wrap input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #1d4ed8;
  cursor: pointer;
}

.range-wrap input[type=range]::-moz-range-thumb {
  pointer-events: auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #1d4ed8;
  cursor: pointer;
}

#f-reset {
  width: 100%;
  padding: 7px;
  border-radius: 8px;
  border: 1px solid #3a404c;
  background: none;
  color: #8b93a1;
  font-size: 13px;
  cursor: pointer;
}

#f-reset:hover { color: #fff; border-color: #4c8dff; }

#split {
  flex: 1;
  display: flex;
  min-height: 0;
}

#list-wrap {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}

/* 모바일 전용 메뉴 패널 (데스크톱에선 항상 숨김) */
#mini-menu { display: none; }

#mini-menu-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid #2c313a;
}

#mini-detail-btn, #mini-naver-btn {
  border: none;
  background: none;
  color: #4c8dff;
  font-size: 12.5px;
  cursor: pointer;
  padding: 4px 0;
}

#mini-naver-btn {
  color: #2db400;
  margin-left: 10px;
}

#mini-menu-close {
  border: none;
  background: none;
  color: #8b93a1;
  font-size: 17px;
  cursor: pointer;
  padding: 0 4px;
}

#mini-menu-name {
  font-size: 13.5px;
  font-weight: 700;
  padding: 8px 10px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#mini-menu-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 10px;
}

#list {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

#list thead th {
  position: sticky;
  top: 0;
  background: #22262e;
  color: #aab2c0;
  font-weight: 600;
  text-align: left;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  z-index: 1;
}

#list thead th:hover { color: #fff; }

#list thead th .arrow { font-size: 11px; color: #4c8dff; }

#list tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid #262a33;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

#list tbody tr:hover { background: #262c38; }

#list tbody tr.active { background: #2d3a52; }

#list tbody td.col-sido, #list tbody td.col-gungu {
  color: #9aa3b2;
  font-size: 12.5px;
}

.badge-instant {
  display: inline-block;
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #1d4ed8;
  color: #fff;
  margin-left: 6px;
  vertical-align: 1px;
}

/* 상세 패널 (데스크톱: 3번째 컬럼, 선택 전 공란) */
#detail {
  width: 400px;
  flex-shrink: 0;
  background: #1c1f26;
  border-left: 1px solid #2c313a;
  overflow-y: auto;
  position: relative;
}

#detail-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #4d5462;
  font-size: 14px;
  line-height: 1.8;
}

#detail.open #detail-placeholder { display: none; }

#detail-body { display: none; }

#detail.open #detail-body { display: block; }

#detail-close {
  display: none;
  position: sticky;
  top: 8px;
  float: right;
  margin: 8px 12px 0 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #2c313a;
  color: #e8eaed;
  font-size: 18px;
  cursor: pointer;
  z-index: 6;
}

#detail.open #detail-close { display: block; }

#detail-close:hover { background: #3a404c; }

#detail-body { padding: 16px; }

#detail-body h2 {
  font-size: 18px;
  margin-bottom: 2px;
  padding-right: 40px;
}

#detail-body .en-name {
  color: #8b93a1;
  font-size: 13px;
  margin-bottom: 10px;
}

#detail-body .meta {
  font-size: 13px;
  line-height: 1.7;
  color: #c3c9d4;
  margin-bottom: 10px;
}

#detail-body .meta b { color: #8b93a1; font-weight: 600; margin-right: 4px; }

#detail-body .desc {
  font-size: 13px;
  line-height: 1.6;
  color: #aab2c0;
  background: #14161a;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  white-space: pre-line;
}

#detail-body h3 {
  font-size: 14px;
  color: #8b93a1;
  margin: 14px 0 6px;
}

.menu-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.menu-table td {
  padding: 6px 4px;
  border-bottom: 1px solid #262a33;
  vertical-align: top;
}

.menu-table td.price {
  text-align: right;
  white-space: nowrap;
  color: #ffd479;
}

.menu-table .rep {
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 6px;
  background: #b45309;
  color: #fff;
  margin-left: 5px;
  vertical-align: 1px;
}

.menu-table .tags {
  display: block;
  color: #6b7382;
  font-size: 11px;
  margin-top: 2px;
}

.resv-note {
  font-size: 12px;
  color: #8b93a1;
  line-height: 1.6;
  margin-top: 10px;
}

/* 인포윈도우(커스텀 오버레이) */
.iw {
  background: #1c1f26;
  border: 1px solid #3a404c;
  border-radius: 10px;
  padding: 8px 12px;
  color: #e8eaed;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.45);
  transform: translateY(-6px);
  cursor: pointer;
}

.iw small { color: #9aa3b2; }

/* 모바일: 지도 상단 + 목록 스크롤.
   선택 시 시도/군구 영역 자리에 메뉴 패널이 뜨고(지도·식당명 목록은 그대로),
   '상세보기'를 눌러야 상세가 전체 화면(.expanded)으로 열림 */
@media (max-width: 1000px) {
  #app { flex-direction: column; }
  #map { height: 42vh; flex: none; }
  #sidebar {
    width: 100%;
    flex: 1;
    min-height: 0;
    border-left: none;
    border-top: 1px solid #2c313a;
  }

  /* 선택되면 시도/군구 컬럼 자리를 메뉴 패널이 차지 */
  #app.selected #mini-menu {
    display: flex;
    flex-direction: column;
    width: 58%;
    min-width: 0;
    border-left: 1px solid #2c313a;
  }
  #app.selected #list th:nth-child(2),
  #app.selected #list th:nth-child(3),
  #app.selected #list td.col-sido,
  #app.selected #list td.col-gungu { display: none; }

  #detail {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    border-left: none;
    z-index: 100;
  }
  #detail.expanded { display: block; }
}
