/* ═══════════════════════════════════════════════════════════════════
   내 지도 — 저장한 공간만 얹은 고정 프레임 지도.
   저장 상태 알약(.favorite-status)과 저장 목록의 상태 필터는 이 화면과
   /my/favorites 가 같이 쓰므로 여기 한 군데에만 둡니다.
   ═══════════════════════════════════════════════════════════════════ */

.my-map {
  display: flex;
  height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-page);
}

/* 탭바가 서는 폭에서는 지도가 탭바 위쪽만 차지합니다. */
@media (width <= 700px) {
  body.has-bottom-nav .my-map {
    height: calc(100dvh - var(--bottom-nav-total));
  }
}

/* 데스크톱에서는 모바일 프레임 그대로 가운데에 세웁니다. */
@media (width > 700px) {
  .my-map {
    max-width: 420px;
    margin: 0 auto;
    box-shadow: 0 0 0 1px var(--border-subtle), var(--shadow-lg);
  }
}

/* ── 헤더 52px ─────────────────────────────────────── */

.my-map__bar {
  display: grid;
  height: 52px;
  flex: none;
  align-items: center;
  padding: 0 var(--space-1);
  border-bottom: 1px solid var(--border-default);
  background: var(--surface-veil);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  grid-template-columns: 44px 1fr 44px;
}

.my-map__back {
  display: grid;
  width: 44px;
  height: 44px;
  color: var(--gray-900);
  place-items: center;
}

.my-map__bar-title {
  justify-self: center;
  color: var(--gray-900);
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-weight: var(--weight-strong);
  letter-spacing: var(--tracking-body);
}

/* ── 상태 필터 칩 ──────────────────────────────────── */

.my-map__filters {
  display: flex;
  flex: none;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-veil);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgb(28 26 23 / 6%);
  scrollbar-width: none;
}

.my-map__filters::-webkit-scrollbar {
  display: none;
}

.my-map__chip {
  display: inline-flex;
  min-height: 32px;
  flex: none;
  gap: var(--space-2);
  align-items: center;
  padding: 0 var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  color: var(--gray-600);
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: var(--weight-strong);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  background: var(--surface-page);
  cursor: pointer;
}

.my-map__chip.is-wish {
  border-color: var(--brand-pink);
  color: var(--brand-pink-strong);
}

.my-map__chip.is-active {
  border-color: var(--gray-900);
  color: var(--gray-50);
  background: var(--gray-900);
}

.my-map__chip-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: var(--radius-full);
}

.my-map__chip.is-wish .my-map__chip-dot {
  background: var(--brand-pink-strong);
}

.my-map__chip.is-visited .my-map__chip-dot {
  background: var(--ink-gradient);
}

/* 채운 칩 위에서는 색 점이 묻히므로 종이색 점 하나로 둡니다. */
.my-map__chip.is-active .my-map__chip-dot {
  background: var(--gray-50);
}

/* ── 지도 ──────────────────────────────────────────── */

.my-map__stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

.my-map__canvas {
  position: absolute;
  inset: 0;
  /* 네이버 지도 SDK 가 컨테이너 position 을 인라인으로 덮어써도 크기가 유지되게 명시 */
  width: 100%;
  height: 100%;
  background: var(--gray-100);
}

/* 지도를 못 세웠을 때. SDK 는 인증이 막히면 캔버스에 자기 오류 그림(auth_fail.png)을
   인라인 background 로 깔아서, 인라인을 이기려면 !important 가 필요합니다. */
.my-map__canvas.is-unavailable {
  background: var(--gray-100) !important;
}

.my-map__canvas.is-unavailable > * {
  display: none;
}

/* 타일 톤은 공개 지도와 같은 #map-tone 필터를 씁니다. */
.my-map__canvas img[src*="map.naver.net"],
.my-map__canvas img[src*="nrbe.pstatic.net"],
.my-map__canvas img[src*="map.pstatic.net/nrb/"] {
  filter: url("#map-tone") !important;
}

/* 모바일에서는 SVG 필터가 터치를 늦춰서 채도만 낮춥니다. */
@media (width <= 700px) {
  .my-map__canvas img[src*="map.naver.net"],
  .my-map__canvas img[src*="nrbe.pstatic.net"],
  .my-map__canvas img[src*="map.pstatic.net/nrb/"] {
    filter: saturate(0.35) !important;
  }
}

.my-map__locate {
  position: absolute;
  z-index: var(--z-raised);
  top: var(--space-4);
  right: var(--space-4);
  display: grid;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  color: var(--gray-900);
  background: var(--surface-page);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  place-items: center;
}

.my-map__notice {
  position: absolute;
  z-index: var(--z-raised);
  top: 50%;
  left: 50%;
  max-width: 260px;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-3);
  color: var(--gray-600);
  font-size: var(--text-xs);
  line-height: var(--leading-body);
  text-align: center;
  word-break: keep-all;
  background: var(--surface-card);
  box-shadow: var(--shadow-card);
  transform: translate(-50%, -50%);
}

.my-map__notice[hidden] {
  display: none;
}

/* ── 핀 (my_map_controller 가 문자열로 만듭니다) ────── */

.my-map-pin {
  display: grid;
  width: 38px;
  height: 38px;
  margin: 3px;
  border-radius: var(--radius-full);
  color: var(--gray-50);
  box-shadow: 0 0 0 2px var(--gray-0), 0 4px 10px rgb(28 26 23 / 22%);
  place-items: center;
}

.my-map-pin--wish {
  background: var(--brand-pink-strong);
}

.my-map-pin--visited {
  background: var(--ink-gradient);
}

.my-map-locate {
  display: block;
  width: 14px;
  height: 14px;
  margin: 4px;
  border-radius: var(--radius-full);
  background: var(--map-locate);
  box-shadow: 0 0 0 3px rgb(74 111 165 / 24%), 0 0 0 5px var(--gray-0);
}

/* ── 하단 시트 — 저장 목록 ─────────────────────────── */

.my-map__sheet {
  position: relative;
  z-index: var(--z-raised);
  display: flex;
  max-height: 46%;
  flex: none;
  flex-direction: column;
  margin-top: calc(var(--radius-sheet) * -1);
  border-top: 1px solid var(--border-default);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  background: var(--surface-page);
  box-shadow: var(--shadow-sheet);
}

.my-map__handle {
  display: block;
  width: 36px;
  height: 4px;
  flex: none;
  margin: var(--space-3) auto var(--space-1);
  border-radius: var(--radius-full);
  background: var(--border-strong);
}

.my-map__sheet-head {
  display: flex;
  flex: none;
  gap: var(--space-3);
  align-items: baseline;
  padding: var(--space-1) var(--space-5) var(--space-3);
}

.my-map__sheet-head strong {
  color: var(--gray-900);
  font-size: var(--text-md);
  font-weight: var(--weight-strong);
  letter-spacing: var(--tracking-body);
}

.my-map__sheet-count {
  color: var(--gray-500);
  font-size: var(--text-2xs);
  font-variant-numeric: tabular-nums;
}

.my-map__sheet-sort {
  margin-left: auto;
  color: var(--gray-500);
  font-size: var(--text-2xs);
  font-weight: var(--weight-strong);
}

.my-map__list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: 0 var(--space-5) var(--space-3);
  list-style: none;
  scrollbar-width: none;
}

.my-map__list::-webkit-scrollbar {
  display: none;
}

.my-map__row {
  border-top: 1px solid var(--border-default);
}

.my-map__row[hidden] {
  display: none;
}

.my-map__row-link {
  display: grid;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-3) 0;
  color: inherit;
  text-decoration: none;
  grid-template-columns: 52px minmax(0, 1fr) auto;
}

/* 핀을 누르면 목록에서 같은 공간 이름만 와인으로 짚어 줍니다. */
.my-map__row.is-active .my-map__row-copy strong {
  color: var(--brand-pink-strong);
}

.my-map__row-media {
  display: block;
  overflow: hidden;
  aspect-ratio: 1;
  border-radius: var(--radius-3);
  background: var(--gray-200);
}

.my-map__row-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.my-map__row-initial {
  display: grid;
  width: 100%;
  height: 100%;
  color: var(--gray-500);
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  place-items: center;
}

.my-map__row-copy {
  min-width: 0;
}

.my-map__row-copy strong {
  display: block;
  overflow: hidden;
  color: var(--gray-900);
  font-size: var(--text-sm);
  font-weight: var(--weight-strong);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-map__row-copy em {
  display: block;
  margin-top: 2px;
  color: var(--gray-500);
  font-size: var(--text-2xs);
  font-style: normal;
}

.my-map__list-empty,
.my-map__empty {
  padding: var(--space-6) var(--space-5) var(--space-8);
  color: var(--gray-500);
  font-size: var(--text-xs);
  text-align: center;
}

.my-map__list-empty[hidden] {
  display: none;
}

.my-map__empty p {
  margin: 0 0 var(--space-4);
}

.my-map__empty-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 0 var(--space-5);
  border-radius: var(--radius-full);
  color: var(--gray-50);
  font-size: var(--text-xs);
  font-weight: var(--weight-strong);
  text-decoration: none;
  background: var(--ink-gradient);
}

/* ── 저장 상태 알약 — 내 지도와 저장 목록이 같이 씁니다 ── */

.favorite-status {
  display: inline-flex;
  height: 28px;
  flex: none;
  align-items: center;
  padding: 0 var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-size: var(--text-2xs);
  font-weight: var(--weight-strong);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.favorite-status.is-wish {
  border-color: var(--brand-pink);
  color: var(--brand-pink-strong);
  background: var(--surface-card);
}

.favorite-status.is-visited {
  color: var(--gray-50);
  background: var(--ink-gradient);
}

/* 카드 본문은 세로로 쌓이는 칸이라 알약이 늘어나지 않게 잡아 둡니다. */
.favorite-card__copy .favorite-status {
  width: fit-content;
  margin-top: var(--space-3);
  align-self: start;
  justify-self: start;
}

/* ── 저장 목록의 상태 필터 (/my/favorites) ─────────── */

.favorites-filter {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-6);
}

.favorites-filter__chip {
  display: inline-flex;
  min-height: 32px;
  gap: var(--space-2);
  align-items: center;
  padding: 0 var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  color: var(--gray-600);
  font-size: var(--text-xs);
  font-weight: var(--weight-strong);
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  white-space: nowrap;
}

.favorites-filter__chip.is-wish {
  border-color: var(--brand-pink);
  color: var(--brand-pink-strong);
}

.favorites-filter__chip.is-active {
  border-color: var(--gray-900);
  color: var(--gray-50);
  background: var(--gray-900);
}

.favorites-filter__dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: var(--radius-full);
}

.favorites-filter__chip.is-wish .favorites-filter__dot {
  background: var(--brand-pink-strong);
}

.favorites-filter__chip.is-visited .favorites-filter__dot {
  background: var(--ink-gradient);
}

.favorites-filter__chip.is-active .favorites-filter__dot {
  background: var(--gray-50);
}

.favorites-page__map-link {
  margin: var(--space-4) 0 0;
  font-size: var(--text-xs);
}

.favorites-page__map-link a {
  color: var(--gray-600);
  font-weight: var(--weight-strong);
  text-underline-offset: 3px;
}
