/* ==========================================================================
   MAP VIEWER — ดูแผนผังรีสอร์ทแบบซูมได้ในหน้าเดิม (ไม่เด้งไปแท็บใหม่)
   ใช้ร่วมกับ assets/js/map-viewer.js
   ========================================================================== */

#map-viewer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  background: rgba(8, 8, 8, 0.94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.25s;
}

#map-viewer.mv-open {
  opacity: 1;
  visibility: visible;
}

/* ---------- แถบบน: ชื่อ + ปุ่มปิด ---------- */
.mv-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid rgba(197, 168, 112, 0.22);
  background: rgba(0, 0, 0, 0.35);
}

.mv-title {
  font-family: 'Kanit', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: #DFCA9E;
  letter-spacing: normal;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mv-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(197, 168, 112, 0.35);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #DFCA9E;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.mv-btn:hover,
.mv-btn:focus-visible {
  background: rgba(197, 168, 112, 0.18);
  border-color: #C5A870;
  color: #FFF;
}

.mv-btn:active { transform: scale(0.94); }

.mv-btn:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

.mv-btn svg { width: 20px; height: 20px; pointer-events: none; }

/* ---------- พื้นที่รูป ---------- */
.mv-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  touch-action: none;          /* กันเบราว์เซอร์แย่งจัดการ pinch/pan ไปเอง */
  cursor: -webkit-grab;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mv-stage.mv-dragging {
  cursor: -webkit-grabbing;
  cursor: grabbing;
}

.mv-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
  display: block;
}

.mv-img.mv-animate { transition: transform 0.28s cubic-bezier(0.25, 1, 0.5, 1); }

/* ---------- แถบล่าง: ปุ่มซูม ---------- */
.mv-tools {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(197, 168, 112, 0.22);
  background: rgba(0, 0, 0, 0.35);
}

.mv-level {
  min-width: 62px;
  text-align: center;
  font-family: 'Kanit', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: normal;
  font-variant-numeric: tabular-nums;
}

.mv-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: calc(100% - 28px);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.88);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(197, 168, 112, 0.4);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  font-family: 'Kanit', sans-serif;
  font-size: 12px;
  font-weight: 300;
  color: #EFE6D4;
  letter-spacing: normal;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.mv-hint.mv-hide { opacity: 0; }

/* บนหน้าเว็บ: ทำให้แผนที่ดูกดได้จริง */
.resort-map-link { cursor: zoom-in; }

@media (max-width: 600px) {
  .mv-title { font-size: 13px; }
  .mv-tools { gap: 8px; }
  .mv-hint { font-size: 11px; padding: 7px 12px; bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  #map-viewer,
  .mv-img.mv-animate,
  .mv-btn { transition: none; }
}
