/* Feldmeldung – Frontend. Alles unter .fm, damit das Website-Layout unberührt bleibt.
   Schrift kommt von der Website; Farben über die Variablen unten anpassbar. */
.fm {
  --fm-bg: #f3f5ef;
  --fm-surface: #ffffff;
  --fm-surface-2: #e8ece2;
  --fm-fg: #1c2a1f;
  --fm-muted: #5d6b5f;
  --fm-line: #d3dacb;
  --fm-accent: #2f6b3a;
  --fm-accent-fg: #ffffff;
  --fm-signal: #f08a00;
  --fm-danger: #b3261e;
  --fm-radius: 6px;

  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  color: var(--fm-fg);
  line-height: 1.5;
}
.fm *, .fm *::before, .fm *::after { box-sizing: border-box; }
.fm [hidden] { display: none !important; }
.fm :focus-visible { outline: 3px solid var(--fm-signal); outline-offset: 2px; }

.fm-map-col { position: sticky; top: 16px; min-width: 0; }
.fm-map-wrap { position: relative; height: min(78vh, 760px); min-height: 420px; border-radius: var(--fm-radius); overflow: hidden; background: var(--fm-surface-2); }
.fm-map { position: absolute; inset: 0; }
.fm-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* Handy-Layout: Klasse fm-mobile setzt das Skript (schmaler Bildschirm oder Touch-Telefon) */
.fm.fm-mobile { grid-template-columns: 1fr; }
.fm-mobile .fm-map-col { position: static; }
.fm-mobile .fm-map-wrap { height: 60vh; min-height: 360px; }

.fm-section { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.fm-h { display: flex; align-items: center; margin: 0; font-size: 1.2rem; }
.fm-step {
  display: inline-grid; place-items: center; flex: none;
  width: 1.6rem; height: 1.6rem; margin-right: 8px; border-radius: 50%;
  background: var(--fm-accent); color: var(--fm-accent-fg); font-size: 0.9rem; font-weight: 700;
}
.fm-hint { margin: 0; font-size: 0.9rem; color: var(--fm-muted); }
.fm-eyebrow { margin: 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fm-accent); }

.fm label { display: flex; flex-direction: column; gap: 4px; margin: 0; font-weight: 600; font-size: 0.95rem; }
.fm-opt { color: var(--fm-muted); font-weight: 400; }
.fm input[type="text"], .fm input[type="tel"], .fm input[type="email"], .fm input[type="date"], .fm input[type="search"], .fm textarea {
  width: 100%; min-width: 0; margin: 0;
  font: inherit; font-weight: 400; color: var(--fm-fg);
  background: var(--fm-surface); border: 1px solid var(--fm-line); border-radius: var(--fm-radius);
  padding: 9px 11px; box-shadow: none;
}
.fm textarea { min-height: 84px; resize: vertical; }
.fm-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .fm-row-2 { grid-template-columns: 1fr; } }
.fm label.fm-check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; font-size: 0.9rem; }
.fm-check input { width: 18px; height: 18px; margin-top: 3px; flex: none; accent-color: var(--fm-accent); }
.fm-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.fm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  margin: 0; padding: 9px 14px;
  font: inherit; font-weight: 600; line-height: 1.2; color: var(--fm-fg); text-decoration: none;
  background: var(--fm-surface); border: 1px solid var(--fm-line); border-radius: var(--fm-radius);
  cursor: pointer;
}
.fm-btn:hover { background: var(--fm-surface-2); }
.fm-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.fm-btn-primary { background: var(--fm-accent); border-color: var(--fm-accent); color: var(--fm-accent-fg); }
.fm-btn-primary:hover { background: var(--fm-accent); filter: brightness(1.1); }
.fm-btn-signal { background: var(--fm-signal); border-color: var(--fm-signal); color: #1c1200; }
.fm-btn-signal:hover { background: var(--fm-signal); filter: brightness(1.06); }
.fm-btn-ghost { background: transparent; border-color: transparent; color: var(--fm-muted); }
.fm-btn-danger { color: var(--fm-danger); }
.fm-btn-sm { padding: 5px 10px; font-size: 0.9rem; }
.fm-btn-block { width: 100%; padding: 12px 16px; font-size: 1.05rem; }

.fm-msg { padding: 10px 12px; border-radius: var(--fm-radius); font-size: 0.95rem; }
.fm-msg-error { background: #fbe9e7; color: var(--fm-danger); }

.fm-field-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.fm-field-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 8px;
  margin: 0; padding: 6px 8px; border: 1px solid var(--fm-line); border-radius: var(--fm-radius); background: var(--fm-bg);
}
.fm-field-item.is-selected { border-color: var(--fm-signal); box-shadow: 0 0 0 1px var(--fm-signal); }
.fm-field-item input[type="text"] { padding: 5px 8px; }
.fm-swatch { display: block; width: 14px; height: 14px; border: 2px solid var(--fm-signal); background: rgb(240 138 0 / 0.3); border-radius: 2px; }
.fm-area { white-space: nowrap; font-size: 0.9rem; color: var(--fm-muted); font-variant-numeric: tabular-nums; }
.fm-empty { padding: 14px; border: 1px dashed var(--fm-line); border-radius: var(--fm-radius); color: var(--fm-muted); font-size: 0.92rem; }
.fm-total { display: flex; justify-content: space-between; font-size: 0.95rem; font-variant-numeric: tabular-nums; }

.fm-map-tools {
  position: absolute; z-index: 500; top: 12px; left: 56px; right: 12px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; pointer-events: none;
}
.fm-map-tools > * { pointer-events: auto; }
.fm-search { position: relative; flex: 1 1 240px; max-width: 380px; }
.fm-search input[type="search"] { border-color: transparent; box-shadow: 0 1px 4px rgb(0 0 0 / 0.25); }
.fm-map-tools .fm-btn { border-color: transparent; box-shadow: 0 1px 4px rgb(0 0 0 / 0.25); }
.fm-search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; max-height: 260px; overflow-y: auto;
  margin: 0; padding: 4px; list-style: none;
  background: var(--fm-surface); border-radius: var(--fm-radius); box-shadow: 0 4px 14px rgb(0 0 0 / 0.25);
}
.fm-search-results li { margin: 0; }
.fm-search-results button {
  display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 4px;
  background: transparent; color: var(--fm-fg); font: inherit; font-size: 0.92rem; text-align: left; cursor: pointer;
}
.fm-search-results button:hover, .fm-search-results button:focus-visible { background: var(--fm-surface-2); }
.fm-search-results .fm-hint { padding: 8px 10px; }

.fm-draw-bar {
  position: absolute; z-index: 500; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
  width: max-content; max-width: calc(100% - 32px); padding: 10px 12px;
  background: var(--fm-surface); border-radius: 10px; box-shadow: 0 4px 18px rgb(0 0 0 / 0.3);
}
.fm-draw-info { padding: 0 6px; font-size: 0.92rem; }

.fm-vertex-hit { display: grid; place-items: center; background: transparent; }
.fm-vertex { display: block; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--fm-signal); box-shadow: 0 0 0 1px rgb(0 0 0 / 0.4); }
.fm-vertex-first { width: 22px; height: 22px; background: var(--fm-signal); border-color: #fff; }
.fm-vertex-edit { cursor: grab; }
.fm .leaflet-container { font: inherit; }
.fm .leaflet-container.fm-drawing { cursor: crosshair; }
.fm-field-label {
  padding: 2px 6px; border: 0; border-radius: 4px; box-shadow: none;
  background: rgb(20 26 21 / 0.78); color: #fff; font-size: 0.82rem; font-weight: 600;
}
.fm-field-label::before { display: none; }

/* --- Handy: Vorschau-Karte + Vollbild zum Einzeichnen ----------------------- */
.fm-map-cover, .fm-close-map, .fm-fs-bar { display: none; }

/* Handy-Layout: Klasse fm-mobile setzt das Skript (schmaler Bildschirm oder Touch-Telefon) */
.fm-mobile .fm-map-wrap { height: 42vh; min-height: 260px; }
.fm-mobile .fm-map-cover {
    position: absolute; inset: 0; z-index: 800;
    display: flex; align-items: center; justify-content: center;
    margin: 0; padding: 16px; border: 0; background: rgb(0 0 0 / 0.12); cursor: pointer;
  }
/* In der Vorschau sind Zoom, Ebenen und Maßstab nicht bedienbar – erst im Vollbild zeigen */
.fm-mobile .fm-map-wrap:not(.is-fullscreen) .leaflet-control-zoom,
.fm-mobile .fm-map-wrap:not(.is-fullscreen) .leaflet-control-layers,
.fm-mobile .fm-map-wrap:not(.is-fullscreen) .leaflet-control-scale { display: none; }
.fm-mobile .fm-map-wrap:not(.is-fullscreen) .leaflet-control-attribution { font-size: 10px; }
.fm-mobile .fm-map-cover .fm-btn { box-shadow: 0 2px 10px rgb(0 0 0 / 0.35); pointer-events: none; }
.fm-mobile .fm-map-wrap:not(.is-fullscreen) .fm-map-tools { display: none; }
.fm-mobile .fm-map-wrap.is-fullscreen {
    position: fixed; inset: 0; z-index: 2147483000;
    height: auto; min-height: 0; border-radius: 0;
  }
.fm-mobile .is-fullscreen .fm-map-cover { display: none; }
.fm-mobile .is-fullscreen .fm-map-tools { top: calc(10px + env(safe-area-inset-top, 0px)); left: 10px; right: 10px; padding-left: 46px; }
.fm-mobile .is-fullscreen .fm-search { flex-basis: 100%; max-width: none; order: -1; }
.fm-mobile .is-fullscreen .fm-close-map { display: inline-flex; margin-left: auto; }
.fm-mobile .is-fullscreen .fm-search-results { max-height: 45vh; }
.fm-mobile .is-fullscreen .fm-fs-bar:not([hidden]) { display: flex; }
.fm-mobile .is-fullscreen .fm-fs-bar,
.fm-mobile .is-fullscreen .fm-draw-bar {
    position: absolute; z-index: 900; left: 0; right: 0; bottom: 0; transform: none;
    flex-wrap: wrap; gap: 8px; align-items: center; justify-content: stretch;
    width: auto; max-width: none; margin: 0;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--fm-surface); border-radius: 14px 14px 0 0; box-shadow: 0 -4px 18px rgb(0 0 0 / 0.25);
  }
.fm-mobile .is-fullscreen .fm-draw-info { flex-basis: 100%; padding: 0 2px 2px; font-size: 0.95rem; }
.fm-mobile .is-fullscreen .fm-fs-bar .fm-btn,
.fm-mobile .is-fullscreen .fm-draw-bar .fm-btn { flex: 1 1 0; min-width: 0; }
.fm-mobile .is-fullscreen .leaflet-bottom { bottom: 150px; }
.fm-mobile .is-fullscreen .leaflet-control-attribution { font-size: 10px; }
/* Fingerfreundliche Größen; 16 px verhindert das Auto-Zoomen von iOS beim Tippen in Felder */
.fm-mobile .fm-btn { min-height: 44px; }
.fm.fm-mobile input[type="text"],
.fm.fm-mobile input[type="tel"],
.fm.fm-mobile input[type="email"],
.fm.fm-mobile input[type="date"],
.fm.fm-mobile input[type="search"],
.fm.fm-mobile textarea { font-size: 16px; min-height: 44px; }
.fm-mobile .fm-check input { width: 22px; height: 22px; margin-top: 1px; }
.fm.fm-mobile .leaflet-touch .leaflet-bar a { width: 40px; height: 40px; line-height: 40px; }
.fm-mobile .fm-field-item { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "sw name name" "sw area del"; row-gap: 2px; }
.fm-mobile .fm-field-item > :nth-child(1) { grid-area: sw; }
.fm-mobile .fm-field-item > :nth-child(2) { grid-area: name; }
.fm-mobile .fm-field-item > :nth-child(3) { grid-area: area; padding-left: 2px; }
.fm-mobile .fm-field-item > :nth-child(4) { grid-area: del; }
html.fm-noscroll, html.fm-noscroll body { overflow: hidden; }
.fm.fm-portal { display: block; }

.fm-success { display: flex; flex-direction: column; gap: 12px; }
.fm-success p { margin: 0; }
.fm-big { font-size: 2rem; font-weight: 700; color: var(--fm-accent); }

@media (prefers-reduced-motion: reduce) { .fm * { transition: none !important; animation: none !important; } }
