/* =====================================================
   Content Map Overlay - Full Screen Map Display
   ===================================================== */

/* Full-screen overlay */
.rd-content-map-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for mobile */
  background: rgba(30, 41, 59, 0.98);
  z-index: 999998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Hidden state - use visibility instead of display so map can initialize with proper dimensions */
.rd-content-map-overlay.rd-content-map-hidden {
  visibility: hidden;
  pointer-events: none;
}

.rd-content-map-overlay.rd-inline-mode .rd-content-map-header {
  padding: 0.75rem 1rem;
}

/* Inner container */
.rd-content-map-overlay-inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* =====================================================
   Header
   ===================================================== */
.rd-content-map-header {
  flex-shrink: 0;
  padding: 1rem 1.5rem;
  background: rgb(82, 197, 255);
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rd-content-map-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
}

/* =====================================================
   Close Button
   ===================================================== */
.rd-content-map-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  cursor: pointer;
  padding: 0.75rem;
  color: #fff;
  border-radius: 50%;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rd-content-map-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.rd-content-map-close svg {
  width: 24px;
  height: 24px;
  display: block;
}

/* =====================================================
   Map Container
   ===================================================== */
.rd-content-map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  /* Clip all content including markers that might overflow */
  clip-path: inset(0);
}

/* Make the map fill the container */
.rd-content-map-container .rd-dynamic-map-wrapper {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

.rd-content-map-container .rd-dynamic-map {
  width: 100% !important;
  height: 100% !important;
}

/* Ensure Mapbox canvas and markers are clipped */
.rd-content-map-container .mapboxgl-map {
  overflow: hidden !important;
}

.rd-content-map-container .mapboxgl-canvas-container {
  overflow: hidden !important;
}

/* =====================================================
   Loading State
   ===================================================== */
.rd-content-map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
}

.rd-content-map-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rd-map-spin 0.8s linear infinite;
}

@keyframes rd-map-spin {
  to {
    transform: rotate(360deg);
  }
}

/* =====================================================
   Error State
   ===================================================== */
.rd-content-map-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff6b6b;
  font-size: 1rem;
  padding: 2rem;
  text-align: center;
}

/* =====================================================
   Map Icon Trigger (for menu items)
   ===================================================== */
.rd-content-map-icon-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rd-content-map-icon-trigger svg {
  width: 1.2em;
  height: 1.2em;
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 768px) {
  .rd-content-map-header {
    padding: 0.75rem 1rem;
  }

  .rd-content-map-title {
    font-size: 1rem;
  }

  .rd-content-map-close {
    padding: 0.5rem;
  }

  .rd-content-map-close svg {
    width: 20px;
    height: 20px;
  }
}

/* =====================================================
   Shortcode Button [content_map_button]
   ===================================================== */
.rd-content-map-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.5em 1em;
  background: rgb(82, 197, 255);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
  transition: background 0.2s;
  margin-right: 10px;
  border-radius: 50% !important;
}

.rd-content-map-button:hover {
  background: rgb(62, 177, 235);
}

.rd-content-map-button svg {
  width: 1.2em;
  height: 1.2em;
  flex-shrink: 0;
}

.rd-content-map-button-title {
  white-space: nowrap;
}

/* =====================================================
   Hide static map fallback in overlay (we want dynamic only)
   ===================================================== */
.rd-content-map-container .rd-static-map-wrapper {
  display: none !important;
}

.rd-content-map-container .rd-dynamic-map-wrapper {
  display: block !important;
}
