:root {
  --map-modal-bg: #ffffff;
  --map-modal-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
html.map-modal-open,
body.map-modal-open {
  overflow: hidden !important;
}
.map-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}
.map-modal-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.map-modal-content {
  width: 95%;
  max-width: 900px;
  height: 70vh;
  background: var(--map-modal-bg);
  border-radius: 12px;
  position: relative;
  box-shadow: var(--map-modal-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
@media (min-width: 1200px) {
  .map-modal-content {
    max-width: 1400px;
    height: 85vh;
  }
}
@media (min-width: 1800px) {
  .map-modal-content {
    max-width: 1700px;
    height: 90vh;
  }
}
.map-canvas {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}
.map-modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: #fff;
  color: #000;
  font-size: 16px;
  border: none;
  outline: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 20;
  transition: transform 0.2s ease;
}
.map-modal-close:hover {
  transform: scale(1.1);
}
.map-drag-handle {
  display: none;
}

/* Landscape mobile optimization: hide drag handle, keep only the close button */
@media (max-width: 991px) and (orientation: landscape) {
  #map-drag-handle {
    display: none !important;
  }

  #map-modal-close-btn {
    top: 10px !important;
    right: 10px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important;
    border-radius: 8px !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
}

@media (max-width: 1024px) {
  .map-modal-overlay {
    align-items: flex-end;
  }
  .map-modal-content {
    width: 100%;
    max-width: none;
    height: 100%;
    border-radius: 16px 16px 0 0;
    transform: translate3d(0, 100%, 0);
    will-change: transform;
  }
  .map-modal-content.is-full {
    border-radius: 0;
  }
  .map-drag-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 32px;
    flex-shrink: 0;
    touch-action: none;
    cursor: grab;
  }
  .map-drag-handle .drag-indicator {
    width: 40px;
    height: 4px;
    background: rgba(0, 0, 0, 0.18);
    border-radius: 2px;
  }
  .map-modal-close {
    top: 42px;
    right: 12px;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }
  .map-modal-content .gm-style,
  .map-modal-content .gm-style-mtc {
    transform: translate3d(0, 0, 0) !important;
    backface-visibility: hidden !important;
  }
}
.gm-style-mtc {
  margin-right: 10px !important;
  margin-top: 0 !important;
}
.gm-style-mtc > button,
.gm-style-mtc > div[role="button"] {
  border-radius: 8px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
  font-family: inherit !important;
  font-size: 13px !important;
  min-height: 36px !important;
  line-height: 36px !important;
  padding: 0 14px !important;
  border: none !important;
  overflow: hidden !important;
}
.gm-style-mtc ul {
  border-radius: 8px !important;
  padding: 4px 0 !important;
  margin-top: 6px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  border: none !important;
}
.gm-style-mtc ul li {
  font-family: inherit !important;
  font-size: 12px !important;
  padding: 6px 12px !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  transition: background 0.2s ease;
}
.gm-style-mtc ul li:hover {
  background-color: #f5f5f5 !important;
}

/* Better visibility for map labels */
.map-label-bg {
  background: rgba(0, 0, 0, 0.6);
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: -45px; /* Position text above the pin */
  white-space: nowrap;
}
