/* static/providers/css/location_map.css
 *
 * Lightweight styling for the provider "Location map" block.
 * Designed to be neutral and to blend with the existing provider wizards.
 *
 * Works both for:
 *   - Simple map-only preview (current location_map_block.html)
 *   - Richer layouts with inputs + map side by side (future use)
 */

/* Root container */
.location-map-block {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 12px;
  background: #ffffff;
  font-size: 13px;
  color: var(--ink, #0b1220);
  box-sizing: border-box;
}

/* Spacing helper for when the block is used in tight forms */
.location-map-block + .location-map-block {
  margin-top: 12px;
}

/* Header */
.location-map-block__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.location-map-block__title {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink, #0b1220);
}

.location-map-block__hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted, #6b7280);
}

/* Small pill / badge (optional, e.g. "Optional") */
.location-map-block__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: #eef2ff;
  color: #3730a3;
  white-space: nowrap;
}

/* Main body: inputs + map side by side (optional) */
.location-map-block__body {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr);
  gap: 12px;
}

/* Left side – coordinate + address fields (optional) */
.location-map-block__inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.location-map-block__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.location-map-block__field label {
  font-size: 12px;
  color: var(--muted, #6b7280);
}

.location-map-block__field input[type="text"],
.location-map-block__field input[type="number"],
.location-map-block__field select {
  border-radius: 8px;
  border: 1px solid #d1d5db;
  padding: 7px 9px;
  font: inherit;
  background: #ffffff;
  box-sizing: border-box;
}

/* Small, side-by-side coordinate row */
.location-map-block__coords-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

/* Right side – map wrapper */
.location-map-block__map-wrapper {
  position: relative;
  min-height: 180px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border, #e5e7eb);
  background: #f3f4f6;
}

/* Main map container – anything with data-location-map will get these styles.
 * This intentionally overlaps with inline styles from the template, but
 * keeps them compatible (width/height 100%). */
.location-map-block__map,
[data-location-map] {
  width: 100%;
  height: 100%;
  display: block;
}

/* Ensure common map canvases fill the wrapper nicely */
.location-map-block__map canvas,
[data-location-map] canvas {
  width: 100%;
  height: 100%;
}

/* Placeholder state before JS engine loads the map (used by template) */
.location-map-block__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--muted, #6b7280);
  pointer-events: none;
}

/* Fallback text (when map provider/token missing; optional hook for JS) */
.location-map-block__fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--muted, #6b7280);
}

/* Optional status line under the map (e.g. "Click the map to update coordinates") */
.location-map-block__meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted, #6b7280);
}

/* Error / warning messages */
.location-map-block__error {
  margin-top: 4px;
  font-size: 12px;
  color: #b91c1c;
}

.location-map-block__message {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted, #6b7280);
}

/* Loading state – when JS adds .is-loading to the wrapper */
.location-map-block__map-wrapper.is-loading::after {
  content: "Loading map…";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--muted, #6b7280);
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.85),
    rgba(248, 250, 252, 0.9)
  );
}

/* Disabled / read-only appearance */
.location-map-block--readonly .location-map-block__map-wrapper {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Compact variant (if template adds .location-map-block--compact) */
.location-map-block--compact {
  padding: 10px;
  border-radius: 10px;
}

/* Compact: slightly smaller title */
.location-map-block--compact .location-map-block__title {
  font-size: 13px;
}

/* Focus states, to play nicely with keyboard users */
.location-map-block__map-wrapper:focus-within {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .location-map-block__body {
    grid-template-columns: minmax(0, 1fr);
  }

  .location-map-block__map-wrapper {
    min-height: 200px;
  }
}

@media (max-width: 640px) {
  .location-map-block {
    padding: 10px;
  }

  .location-map-block__header {
    flex-direction: column;
    align-items: flex-start;
  }
}
