/* =========================================================
   Locator Block — Placeholder + Modal + Redirect Overlay
   Fresh drop-in consolidated stylesheet
   ========================================================= */

/* =========================
   Locator placeholder styles
   ========================= */

.locator-map-container {
  width: 100%;
  margin: 1rem 0;
  position: relative;
  min-height: 220px;
}

/* Frontend placeholder box (inserted by frontend.js) */
.locator-placeholder {
  padding: 16px;
  border: 2px dashed rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.03);
  font: 14px/1.4 system-ui;
}

.locator-placeholder strong {
  display: block;
  font-size: 16px;
  margin-bottom: 4px;
}

.locator-placeholder p {
  margin: 6px 0 0;
  font-size: 13px;
  opacity: 0.8;
}

/* Editor placeholder (from index.js) */
.joppa-locator-placeholder {
  border: 2px dashed rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 20px;
  background: #f9f9f9;
  text-align: center;
}

.joppa-locator-placeholder__title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.joppa-locator-placeholder__body {
  font-size: 13px;
  color: #555;
}

.joppa-locator-placeholder__hint {
  margin-top: 8px;
  font-size: 12px;
  opacity: 0.7;
}

/* =========================
   Modal (Country Card Popup)
   ========================= */

/*
  Modal overlay layer.
  - uses flex centering so the panel stays inside the viewport
  - no visual backdrop, but blocks clicks behind it
*/
.joppa-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;

  /* layout */
  align-items: flex-start;
  justify-content: center;

  /* breathing room so nothing can run off-screen */
  padding: 24px 16px;

  /* containment */
  overflow-x: hidden;
  overflow-y: auto;

  /* no dimming, but still blocks interaction */
  background: transparent;
}

.joppa-modal.is-open {
  display: flex;
}

/* Explicitly disable any backdrop dimming element */
.joppa-modal__backdrop {
  display: none !important;
}

/*
  Panel wrapper.
  This is the positioning context for the close button.
  The actual card is injected inside #joppa-country-modal-body.
*/
.joppa-modal__panel {
  position: relative;

  /* width clamp: never exceed viewport */
  width: min(900px, 100%);
  max-width: 900px;

  /* allow close button shadow etc without causing horizontal overflow */
  overflow: visible;

  /* panel itself is visually "empty" because the card provides the UI */
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin-top: var(--joppa-modal-anchor-top, 0px);

  /* keep above page content */
  z-index: 1;
}

/* Body wrapper */
.joppa-modal__body {
  padding: 0;
}

/*
  Injected body content.
  Ensures the injected .country-card is centered and clamped.
*/
#joppa-country-modal-body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* Clamp the injected card so it cannot exceed the viewport */
#joppa-country-modal-body .country-card {
  width: 100%;
  max-width: 900px;
  box-sizing: border-box;

  /* safety for long strings */
  overflow-wrap: anywhere;
}

/* =========================
   Close button (always inside)
   ========================= */

.joppa-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;

  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;

  background: rgba(255, 255, 255, 0.92);
  color: #111;

  cursor: pointer;
  z-index: 3;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);

  /* makes SVG or glyph centered */
  display: flex;
  align-items: center;
  justify-content: center;
}

.joppa-modal__close:hover {
  background: #fff;
}

/* If you still use &times; inside the button */
.joppa-modal__close {
  font-size: 20px;
  line-height: 1;
}

/* =========================
   Mobile refinements
   ========================= */

@media (max-width: 700px) {
  .joppa-modal {
    padding: 16px 12px;
  }

  .joppa-modal__panel {
    width: 100%;
    max-width: 100%;
    margin-top: var(--joppa-modal-anchor-top, 0px);
  }

  /* keep the close button inside and away from rounded corners */
  .joppa-modal__close {
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
  }

  /* stronger clamp for any fixed-width card styles */
  #joppa-country-modal-body .country-card {
    max-width: calc(100vw - 24px);
  }
}

/* Prevent body scroll when modal is open */
body.joppa-modal-open {
  overflow: hidden;
}

/* =========================
   Redirect overlay (auto-geo)
   (blocks interaction during redirect only)
   ========================= */

.locator-redirect-overlay {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 99998;
  pointer-events: all;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(2px);
}

.locator-redirect-overlay.is-active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.locator-redirect-overlay__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font: 14px/1.2 system-ui;
}

.locator-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: rgba(255, 255, 255, 0.95);
  animation: locatorSpin 0.8s linear infinite;
}

@keyframes locatorSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Optional: prevent scroll gestures inside container while redirecting */
.locator-map-container.locator-is-redirecting {
  touch-action: none;
}

/* Future UI row under the map */
.locator-pan-toggle {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.locator-pan-toggle__label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,0.04);
  font: 14px/1.2 system-ui;
}

.locator-pan-toggle__input {
  width: 16px;
  height: 16px;
}

