/* ===================== 공통 기본 ===================== */
:root {
  --brand: #0B3D91;
  --ink: #222;
  --muted: #9aa0a6;
  --line: #e5e7eb;
  --bg: #ffffff;
  --chip: #f7f7f8;
  --panel: #fafafa;
  --radius: 14px;

  /* 헤더 + 메뉴 높이 (PC 기준) */
  --offset-top: 145px;
  /* 모바일 검색바 높이 */
  --searchH: 56px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

/* ===================== 공통 컴포넌트 ===================== */
.rail {
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rail-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 78px;
  padding: 10px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}

.rail-ico {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.rail-ico img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.rail-copy strong {
  font-size: 12px;
  color: #333;
  font-weight: 700;
  line-height: 1.2;
}

.panel {
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search {
  position: relative;
}

.search input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  font-size: 14px;
  background: #fff;
}

.icon-search {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: 2px solid #333;
  border-radius: 50%;
}

.icon-search:after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: -5px;
  width: 8px;
  height: 2px;
  background: #333;
  transform: rotate(45deg);
}

.btn-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 18px;
  line-height: 26px;
  cursor: pointer;
}

.list {
  overflow: auto;
  padding-right: 4px;
}

.item {
  display: flex;
  align-items: center;
  gap: 10px;
  /* 사용자 기본 10px 마진 취향 반영 */
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
}

.thumb {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border: 1px dashed #d6d6d6;
  border-radius: 10px;
  overflow: hidden;

  background-color: #f9f9f9;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
}



.meta {
  min-width: 0;
}

.name {
  font-weight: 700;
  margin: 0 0 4px;
}

.desc {
  margin: 0;
  color: #666;
  font-size: 12px;
}


.badge {
  margin-left: auto;
  display: inline-block;
  width: 62px;
  text-align: center;
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 8px;
  background: #eef3ff;
  color: var(--brand);
  font-size: 12px;
  border: 1px solid #dbe7ff;
  box-sizing: border-box;
  margin-left: auto;
}

/* 🚩 먹거리 (food) 배지 스타일 재정의: #DFA88C 계열 (갈색/주황색 연한색) 🚩 */
.item[data-type="food"] .badge {
  /* 연한 배경: #A6A6A6 기반의 아주 연한 회색 (#F5F5F5) */
  background: #F5F5F5;

  /* 텍스트 색상: #A6A6A6 마커 색상 그대로 사용 */
  /* (만약 글자가 너무 흐려 보이면 #808080 정도로 진하게 조정 추천) */
  color: #808080;

  /* 테두리 색상: 배경과 텍스트 사이의 중간 톤 회색 */
  border-color: #E0E0E0;
}

/* 🚩 편의시설 (toilet) 배지 스타일 재정의: #2F97FD 계열 (파란색 연한색) 🚩 */
.item[data-type="toilet"] .badge {
  /* 연한 배경: #2F97FD (RGB: 47, 151, 253)에서 채도와 밝기를 조정 */
  background: #E8F5FF;
  /* 텍스트 색상: #2F97FD 색상 그대로 사용 */
  color: #2F97FD;
  /* 테두리 색상: 조금 더 연하게 */
  border-color: #D3E7F8;
}

.item .name {
  /* 기존 스타일 유지 */
  margin-bottom: 4px;
  /* 원하는 만큼의 간격 (예: 4px)을 추가합니다. */
}

.mobile-list-btn {
  display: none;
}

/* 지도 */
#map {
  min-height: 420px;
  background: #eef1f3;
  position: relative;
}

#map iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.map-inner {
  height: 100%;
}

/* 칩 공통 */
.chips {
  display: none;
}

.chip {
  min-width: 92px;
  padding: 10px 8px;
  text-align: center;
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
  white-space: nowrap;
}

/* 기본 X버튼 숨김 */
.search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.search input::-ms-clear {
  display: none;
  width: 0;
  height: 0;
}

/* floor-selector 기본 위치 설정 */
.floor-selector {
  position: absolute;
  top: 20px;
  /* 상단 여백 */
  right: 20px;
  /* 오른쪽 여백 */
  z-index: 10;
  /* 지도 위에 표시되도록 z-index 설정 */
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  /* 버튼을 세로로 정렬 */
  background-color: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* 1. PC 기본 위치 및 스타일 */
.floor-selector {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  /* 지도 요소들 위, 검색 오버레이 아래에 위치 */

  display: flex;
  flex-direction: column;
  background-color: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  /* 그림자 강화 */
  overflow: hidden;
}

/* 층 버튼 스타일 (기존과 동일) */
.floor-btn {
  padding: 8px 12px;
  border: none;
  border-bottom: 1px solid #eee;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  color: #333;
  transition: background-color 0.2s;
}

.floor-btn:last-child {
  border-bottom: none;
}

.floor-btn.active {
  background-color: var(--brand);
  color: white;
}

/* data-filter 버튼이 선택되었을 때의 스타일 */
.rail-btn.active {
  /* 예시: 버튼 배경색 변경 및 텍스트/아이콘 색상 강조 */
  background-color: var(--brand, #007bff);
}

.rail-btn.active .rail-copy,
.rail-btn.active .rail-ico {
  /* 텍스트와 아이콘을 대비되는 색상으로 변경 */
  color: white;
  filter: brightness(0) invert(1);
  /* 아이콘 이미지를 흰색으로 보이게 함 */
}

/* ===================== 데스크탑 (≥769px) ===================== */
@media (min-width: 769px) {
  .page {
    height: calc(100dvh - var(--offset-top));
    display: grid;
    grid-template-columns: 92px 320px 1fr;
    grid-template-rows: 1fr;
    max-width: 1520px;
    /* margin: 0 auto; */
    isolation: isolate;
    /* z-index 정리 */
  }

  .rail {
    grid-column: 1;
    grid-row: 1;
    overflow-y: auto;
    z-index: 10;
  }

  .panel {
    grid-column: 2;
    grid-row: 1;
    overflow-y: auto;
    z-index: 20;
    background: var(--panel);
  }

  #map {
    grid-column: 3;
    grid-row: 1;
    position: relative;
    z-index: 1;
    min-height: calc(100dvh - var(--offset-top));
  }

  /* 모바일 전용 요소 숨김 */
  #map .m-overlay {
    display: none !important;
  }

  .chips {
    display: none !important;
  }
}

/* ===================== 모바일 (≤768px) ===================== */
@media (max-width: 768px) {
  .page {
   height: calc(100dvh - var(--offset-top));
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    margin: 0;
  }

  .rail {
    display: none;
  }

  #map {
    grid-row: 1;
    position: relative !important;
    min-height: calc(100dvh - 58px) !important;
    z-index: 1 !important;
    min-height: 100% !important;
  }

  /* 오버레이: 지도 전체 덮음 */
  #map .m-overlay {
    position: absolute !important;
    inset: 0 !important;
    pointer-events: none !important;
  }

  /* 내부만 클릭 허용 */
  #map .m-overlay .panel,
  #map .m-overlay .chips {
    pointer-events: auto !important;
  }

  /* 검색바 패널 */
  #map .m-overlay .panel {
    position: absolute !important;
    left: 12px !important;
    right: 12px !important;
    top: 12px !important;
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  /* 검색창 크기 */
  .search input {
    height: var(--searchH) !important;
    padding: 0 48px !important;
    border-radius: 12px !important;
    font-size: 16px !important;
  }

  .icon-search {
    left: 16px !important;
    width: 22px !important;
    height: 22px !important;
    border: 2px solid #333 !important;
  }

  .icon-search:after {
    right: -7px !important;
    bottom: -6px !important;
    width: 11px !important;
    height: 2px !important;
    background: #333 !important;
    transform: rotate(45deg);
  }

  .btn-clear {
    right: 8px !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    font-size: 22px !important;
    border: 1px solid var(--line) !important;
    background: #fff !important;
  }

  /* 칩 */
  #map .m-overlay .chips {
    position: absolute !important;
    left: 12px !important;
    right: 12px !important;
    top: calc(12px + var(--searchH) + 12px) !important;
    display: flex !important;
    gap: 12px !important;
    overflow-x: auto !important;
    background: transparent !important;
  }

  .chip {
    width: 96px !important;
    aspect-ratio: 1 / 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    background: #fff !important;
    border: 1px solid var(--line) !important;
    border-radius: 16px !important;
    box-shadow: 0 6px 12px rgba(0, 0, 0, .08) !important;
    font-size: 13px !important;
  }

  .chip img {
    width: 36px !important;
    height: 36px !important;
    object-fit: contain !important;
    display: block !important;
  }

  /* [1] 패널(.panel) 설정: 기존 UI를 건드리지 않도록 설정 */
  /* 패널이 화면을 가리지 않게 크기를 없애고 내용만 보여줍니다 */
  .panel {
    display: block !important;
    position: static;
    /* 위치 강제 지정 안 함 (기존 흐름 따름) */
    width: auto;
    height: auto;
    background: transparent;
    border: none;
    box-shadow: none;
    pointer-events: none;
    /* 패널 빈 공간 터치 시 지도 조작 가능 */
  }

  /* 검색창(.search)은 클릭 가능해야 함 */
  .panel .search {
    pointer-events: auto;
    /* 검색창 스타일이 깨졌다면 아래 주석을 풀어주세요 */
    /* width: 95%; margin: 10px auto; background: #fff; */
  }

  /* [중요] 레일(카테고리 버튼) 숨김 코드 제거됨 -> 이제 보일 것입니다. */

  /* [2] 결과 리스트 (#resultList) */
  /* 평소에는 숨겨둡니다 */
  #resultList {
    display: none;
  }

  /* 버튼을 눌러서 .show-names 클래스가 붙으면 나타납니다 */
  #resultList.show-names {
    display: block !important;
    position: fixed;
    /* 화면 기준 배치 (무조건 뜸) */
    bottom: 80px;
    /* '목록 닫기' 버튼 위쪽으로 띄움 */
    left: 20px;
    /* 좌우 여백을 주어 카드 형태 */
    right: 20px;
    width: auto;
    /* 너비 자동 */

    background: rgba(255, 255, 255, 0.98);
    /* 살짝 투명도 줌 (세련되게) */
    border-radius: 15px;
    /* 둥근 모서리 */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    /* 진한 그림자로 붕 떠보이게 */

    max-height: 50vh;
    /* 화면 높이의 35%까지만 차지 (검색창 가리지 않게) */
    overflow-y: auto;
    /* 내용 많으면 스크롤 */
    z-index: 9999;
    /* 지도, 버튼, 모든 것 위에 표시 */
    pointer-events: auto;
    /* 리스트 클릭/스크롤 가능 */
    position: fixed;
    
    
  }

  body.no-scroll {
    overflow: hidden !important;
    /* 스크롤 잠금 */
    position: fixed;
    /* 모바일에서 오버스크롤(튕김) 방지 */
    width: 100%;
    height: 100vh;

    /* 🛑 스크롤바가 사라지면서 발생하는 레이아웃 흔들림 방지 */
    padding-right: 17px;
  }


  /* [3] 리스트 내부 내용 정리 (이름만 남기기) */
  /* 썸네일, 설명, 배지 등 불필요한 정보 숨김 */
  #resultList.show-names .thumb,

  #resultList.show-names .badge,
  #resultList.show-names .badge-wrap {
    display: none !important;
  }

  /* 아이템 박스 디자인 */
  #resultList.show-names .item {
    display: block;
    padding: 15px 0;
    /* 위아래 여백 */
    margin: 0 15px;
    /* 좌우 여백 */
    border-bottom: 1px solid #eee;
    text-align: center;
    /* 글자 가운데 정렬 */
  }

  .item {
    border: 0;
    border-radius: 0;
  }

  /* 마지막 줄은 선 없애기 */
  #resultList.show-names .item:last-child {
    border-bottom: none;
  }

  /* 이름 폰트 스타일 */
  #resultList.show-names .name {
    font-size: 17px;
    font-weight: 700;
    color: #222;
    margin: 0;
  }

  /* [4] 하단 '목록 보기/닫기' 버튼 */
  .mobile-list-btn {
    display: block;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    /* 리스트보다 더 위에 (가장 최상단) */

    padding: 12px 30px;
    background-color: #444;
    color: #fff;
    border: none;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
    pointer-events: auto;
    position: fixed;
  }
}

/* 1) 헤더/메뉴 높이 변수: 실제 값에 맞게 숫자만 바꿔도 됨 */
:root {
  /* .header_top 높이 */
  --menu-h: 85px;
}

/* 2) 본문 시작점을 헤더 아래로 내리기 (헤더 안 건드림) */
/* body {
  /* padding-top: var(--offset-top);
} */

/* 3) 위치페이지 레이아웃 높이 계산 */
.page {
  height: calc(100dvh - var(--offset-top));
  isolation: isolate;
  /* 내부 z-index 충돌 방지 */
}

/* 4) 스크롤되는 3영역(sticky 기준은 0으로) */
.rail,
.panel,
#map {
  position: sticky;
  top: 0;
  /* header를 피하기 위해 body에 padding을 줬으니 0이 가장 안전 */
}

/* 5) 지도는 항상 뒤, 패널/레일이 위 (헤더는 더 위라 안 가려짐) */
#map {
  z-index: 1;
}

.panel,
.rail {
  z-index: 2;
}


/* 7) 모바일에서 지도 오버레이 사용하는 경우도 헤더를 침범하지 않도록 */
@media (max-width: 768px) {
  .page {
    /* height: calc(100dvh - var(--offset-top)); */
    height: calc(100dvh - var(--menu-h)); /* menu-h가 모바일 헤더 높이라고 가정 */
  }

  #map {
    grid-row: 1;
    position: relative !important;
    /* 🛑 남은 공간의 100%를 차지하도록 수정 */
    min-height: 100% !important; 
    z-index: 1 !important;
    
  }

  #map .m-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
  }

  #map .m-overlay .panel,
  #map .m-overlay .chips {
    pointer-events: auto;
  }

  .floor-selector {
    /*
         * 모바일 상단 오버레이 영역 계산:
         * 12px (상단 여백)
         * + var(--searchH) (검색창 높이, 기본 48px)
         * + 12px (검색창과 칩 사이 여백)
         * + 칩 영역 높이 (96px, aspect-ratio: 1/1)
         * + 12px (칩 영역 아래 여백)
         * => 대략 12 + 48 + 12 + 96 + 12 = 180px 정도
         * 안전하게 200px 정도 아래에 배치합니다.
         */
    top: 200px;
    /* 상단 검색/칩 영역을 피해서 배치 */
    right: 12px;
    /* 모바일 좌우 여백과 맞춥니다. */
    z-index: 5;
    /* 검색 오버레이(z-index: 1)와 리스트 패널(z-index: 2)보다 높게 설정하여 겹침 방지 */

    /* 모바일에서는 버튼 크기를 약간 줄여서 화면 공간 확보 */
    width: 48px;
  }

  .floor-selector .floor-btn {
    padding: 6px 0;
    /* 좌우 패딩 제거, width로 폭 통일 */
    font-size: 12px;
  }
}

/* 메뉴(dropdown)가 지도보다 위로 뜨게 보강만 함 */
header,
.header_top,
.header_bottom,
nav,
.mainmenu,
.mainmenu .sub {
  z-index: 9999 !important;
  /* 지도 위로 강제 */
}