/* FFN Eiswagen-Karte – Widget-Styles. Prefix .ffnk- gegen Kollisionen (WordPress). */

.ffnk-root {
  --ffnk-accent: #004c9e; /* FFN-Blau */
  --ffnk-accent-dark: #003a78;
  --ffnk-yellow: #ffd400; /* FFN-Gelb */
  position: relative;
  display: inline-block;
  max-width: 100%;
  width: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.3;
  color: #1a1a1a;
}

.ffnk-stage {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
}

.ffnk-map {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

/* Overlay-Ebene deckt exakt das Bild ab; Kinder werden in % positioniert.
   z-index 3 > Stände-Ebene (2), bleibt aber pointer-events:none -> Klicks gehen
   zu den darunterliegenden Ständen durch, Marker liegt aber optisch darüber. */
.ffnk-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

/* Marker & Pfeil sind klickbar (Eiswagen-Popup), obwohl die Overlay-Ebene es nicht ist. */
.ffnk-marker, .ffnk-arrow { pointer-events: auto; cursor: pointer; }

/* Unsichtbarer Scroll-Anker: wird an eine Zielposition gesetzt und in die Mitte gescrollt. */
.ffnk-scroll-anchor {
  position: absolute;
  width: 1px;
  height: 1px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* --- Marker (innerhalb der Karte) ---
   --ffnk-mbase: Basis-Durchmesser (px). Default 26px; das Widget setzt ihn per
   ResizeObserver proportional zur gerenderten Kartenbreite (in Grenzen), damit
   der Marker relativ zu den Ständen gleich groß wirkt – egal ob Handy oder Desktop.
   --ffnk-mscale (Default 1) ist der zusätzliche Nutzer-Faktor (markerScale-Setting). */
.ffnk-marker {
  --ffnk-mbase: 26px;
  --ffnk-mscale: 1;
  position: absolute;
  transform: translate(-50%, -50%);
  display: none;
  z-index: 3;
}
.ffnk-marker__dot {
  width: calc(var(--ffnk-mbase) * var(--ffnk-mscale));
  height: calc(var(--ffnk-mbase) * var(--ffnk-mscale));
  border-radius: 50%;
  background: var(--ffnk-mfill, var(--ffnk-accent));
  border: calc(var(--ffnk-mringw, 3px) * var(--ffnk-mscale)) solid var(--ffnk-mring, var(--ffnk-accent));
  box-shadow: 0 0 0 calc(var(--ffnk-mhalow, 2px) * var(--ffnk-mscale)) var(--ffnk-mhalo, #fff), 0 1px 4px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Emoji-Größe = Kreisdurchmesser * Icon-Verhältnis (Fallback 0.58 ~ alter Wert). */
  font-size: calc(var(--ffnk-mbase) * var(--ffnk-mscale) * var(--ffnk-iconratio, 0.58));
  line-height: 1;
  overflow: hidden;
}
.ffnk-marker__dot img {
  /* Bild-Größe relativ zum Kreis (Fallback 1 = füllt den Kreis wie bisher). */
  width: calc(var(--ffnk-iconratio, 1) * 100%);
  height: calc(var(--ffnk-iconratio, 1) * 100%);
  border-radius: 50%;
  object-fit: cover;
}
/* Puls-Ring nur im Live-Zustand */
.ffnk-marker__pulse {
  position: absolute;
  inset: calc(var(--ffnk-mbase) * var(--ffnk-mscale) * -0.23);
  border-radius: 50%;
  border: calc(2px * var(--ffnk-mscale)) solid var(--ffnk-mring, var(--ffnk-accent));
  opacity: 0;
}
.ffnk-root[data-state="live"] .ffnk-marker__pulse {
  animation: ffnk-pulse 1.8s ease-out infinite;
}
@keyframes ffnk-pulse {
  0% { transform: scale(0.6); opacity: 0.7; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* --- Richtungsindikator (im Puffer außerhalb der Karte) --- */
.ffnk-arrow {
  position: absolute;
  transform: translate(-50%, -50%);
  display: none;
  z-index: 3;
  align-items: center;
  flex-direction: column;
}
/* Schmal & lang -> eindeutige Spitze (gleichschenklig, nicht gleichseitig). */
.ffnk-arrow__chevron {
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 30px solid var(--ffnk-accent);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}
.ffnk-arrow__label {
  margin-top: 2px;
  background: rgba(255, 255, 255, 0.9);
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* --- Besucher-Standort ("Du bist hier") + Locate-Button --- */
.ffnk-me {
  position: absolute;
  transform: translate(-50%, -50%);
  display: none;
  z-index: 3;
  pointer-events: none;
}
.ffnk-me__dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1a73e8;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.35), 0 1px 4px rgba(0, 0, 0, 0.4);
}
.ffnk-locate {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 5;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #fff;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.ffnk-locate.active { background: #e7f0fe; }

/* --- Nicht-blockierender Hinweis-Banner (Eiswagen nicht da) --- */
.ffnk-banner {
  position: absolute;
  left: 0; right: 0; top: 0;
  z-index: 4;
  display: none;
  pointer-events: none;
  background: rgba(20, 20, 30, 0.82);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 7px 12px;
  line-height: 1.25;
}
.ffnk-banner.show { display: block; }

/* --- Klickbare Stände (SVG-Polygone, unsichtbar bis Hover) --- */
.ffnk-stands {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none; /* nur die Polygone sind klickbar */
}
.ffnk-stand {
  fill: #000;
  fill-opacity: 0;        /* unsichtbar -> keine Overlays auf der echten Karte */
  stroke: none;
  pointer-events: all;    /* gesamte Fläche klickbar trotz fill-opacity 0 */
  cursor: pointer;
  transition: fill-opacity 0.12s ease;
}
/* Kein rechteckiger UA-Fokusrahmen (Bounding-Box) beim Klick. */
.ffnk-stand:focus { outline: none; }
.ffnk-stand:hover,
.ffnk-stand:focus-visible {
  fill: #ffffff;
  fill-opacity: 0.2;      /* dezentes Feedback (polygon-förmig), kein Rechteck */
}

/* --- Stand-Popup (responsives Modal / Bottom-Sheet) --- */
.ffnk-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.ffnk-modal.open { opacity: 1; visibility: visible; }
.ffnk-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 15, 25, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.ffnk-modal__card {
  position: relative;
  background: #fff;
  border-radius: 18px;
  width: calc(100% - 32px);
  max-width: 440px;
  max-height: 88vh;
  overflow: hidden auto;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  transform: translateY(14px) scale(0.97);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.ffnk-modal.open .ffnk-modal__card { transform: none; }

/* Griff-Strich – nur im Bottom-Sheet (mobil) sichtbar. */
.ffnk-modal__grab { display: none; }

/* Hero (Bild oder generiertes Default). */
.ffnk-modal__hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #f0f0f2;
  overflow: hidden;
}
.ffnk-modal__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ffnk-modal__fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #004c9e, #003a78);
}
.ffnk-modal__fallback-emoji {
  font-size: 64px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
  opacity: 0.95;
}
/* Sanfter Verlauf am unteren Bildrand -> Übergang zum weißen Textbereich. */
.ffnk-modal__scrim {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 40%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.18), transparent);
  pointer-events: none;
}
.ffnk-modal__close {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  border: none; border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 22px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: background 0.15s ease;
}
.ffnk-modal__close:hover { background: rgba(0, 0, 0, 0.6); }

.ffnk-modal__body { padding: 16px 20px 22px; }
.ffnk-modal__title { margin: 0 0 8px; font-size: 1.35rem; font-weight: 700; }
.ffnk-modal__cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ffnk-modal__cat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px; font-weight: 600;
  padding: 4px 11px; border-radius: 999px;
}
.ffnk-modal__cat-emoji { font-size: 13px; line-height: 1; }
.ffnk-modal__dist {
  display: none;
  align-items: center;
  gap: 5px;
  font-size: 13px; font-weight: 600;
  color: #2f9e44;
  margin-bottom: 12px;
}
.ffnk-modal__desc { white-space: pre-wrap; line-height: 1.5; color: #333; }

@media (max-width: 600px) {
  .ffnk-modal { align-items: flex-end; }
  .ffnk-modal__card {
    width: 100%;
    max-width: none;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }
  .ffnk-modal.open .ffnk-modal__card { transform: none; }
  .ffnk-modal__grab {
    display: block;
    position: absolute;
    top: 8px; left: 50%;
    transform: translateX(-50%);
    width: 40px; height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    z-index: 2;
  }
  .ffnk-modal__body { padding-bottom: 28px; }
}

/* --- Status-Badge --- */
.ffnk-status {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 5;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.ffnk-status__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #9aa0a6;
  flex: 0 0 auto;
}
.ffnk-root[data-state="live"] .ffnk-status__dot { background: #1aa64b; }
.ffnk-root[data-state="stale"] .ffnk-status__dot { background: #f5a623; }

/* --- Stale: alles ausgegraut --- */
.ffnk-root[data-state="stale"] .ffnk-marker,
.ffnk-root[data-state="stale"] .ffnk-arrow {
  filter: grayscale(1) opacity(0.65);
}

/* --- Stand-Liste unter der Karte (optional) --- */
.ffnk-list {
  margin-top: 16px;
  text-align: left;
}
.ffnk-list__item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid #e4e6ea;
  border-radius: 14px;
  padding: 16px 22px;
  margin-bottom: 12px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.ffnk-list__item:hover,
.ffnk-list__item:focus-visible {
  border-color: var(--ffnk-accent);
  background: #f5f8fc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  outline: none;
}
.ffnk-list__num {
  flex: 0 0 auto;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: 9px;
  background: var(--ffnk-accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Ohne Nummer: gleiches blaues Feld wie die Ziffern, nur leer (Basisstil genügt). */
.ffnk-list__num--empty {
  background: var(--ffnk-accent);
}
/* Eiswagen: blaues Feld wie die anderen, mit 🍦 statt Ziffer. */
.ffnk-list__num--ice {
  font-size: 18px;
}
.ffnk-list__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 1px;
}
.ffnk-list__name {
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.35;
}
.ffnk-list__desc {
  font-size: 0.875rem;
  color: #5f6368;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Sehr dezent ausgegraut: Einträge, die nicht zur gewählten Kategorie gehören. */
.ffnk-list__item--dim {
  opacity: 0.62;
  filter: saturate(0.8);
}
.ffnk-list__item--dim:hover,
.ffnk-list__item--dim:focus-visible {
  opacity: 1;
  filter: none;
}

/* Vollständige Beschreibung (nicht auf 2 Zeilen kürzen). */
.ffnk-list__desc--full {
  display: block;
  -webkit-line-clamp: none;
  overflow: visible;
  white-space: pre-wrap;
}

/* --- Kategorien-Zeile unter der Karte (optional) --- */
.ffnk-catbar {
  margin: 14px 0 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.ffnk-cat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 9px 16px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.1;
  transition: box-shadow 0.12s ease, transform 0.06s ease;
}
.ffnk-cat__emoji { font-size: 1rem; line-height: 1; }
.ffnk-cat:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); }
.ffnk-cat:active { transform: scale(0.97); }
.ffnk-cat--active { box-shadow: 0 0 0 2px currentColor inset; }

/* Highlight beim Klick auf einen Listeneintrag – bleibt bis zum nächsten Tap/Auswahl.
   Default: rote Puls-Animation. Diese Regeln sind der Fallback; sie werden vom
   im Admin editierbaren Highlight-CSS (Setting highlightCss) überschrieben. */
.ffnk-stand--hl {
  fill: #ff2020;
  stroke: #ff2020;
  stroke-width: 4;
  animation: ffnk-hl 1s ease-in-out infinite;
}
@keyframes ffnk-hl {
  0%, 100% { fill-opacity: 0.12; filter: drop-shadow(0 0 1px rgba(255, 0, 0, 0.5)); }
  50% { fill-opacity: 0.55; filter: drop-shadow(0 0 7px rgba(255, 0, 0, 0.95)); }
}
.ffnk-marker--hl .ffnk-marker__dot {
  animation: ffnk-hl-marker 1s ease-in-out infinite;
}
@keyframes ffnk-hl-marker {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.35); }
}
