/* ============================================================
   Wunschbaby Infoabend-Popup – eigenständiges Einbaupaket (Typo3)
   Bewirbt den gratis Kinderwunsch-Infoabend, 2-spaltig (Foto | Inhalt).
   Erscheint pro Besucher max. 1× alle 3 Tage (Logik in infoabend-popup.js).
   Self-contained: keine Abhängigkeit vom Typo3-Theme, eigene Farben/Radien.
   ============================================================ */

.ia-popup {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  padding: 20px;
  box-sizing: border-box;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  /* Sicherheitsnetz: passt die Karte nicht in den Viewport, scrollt das Overlay.
     margin:auto an der Karte zentriert bei Platz und rückt sie sonst nach oben. */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.ia-popup[hidden] { display: none; }
.ia-popup *, .ia-popup *::before, .ia-popup *::after { box-sizing: border-box; }

.ia-popup__backdrop {
  /* fixed statt absolute: deckt den Viewport auch beim Scrollen des Overlays */
  position: fixed;
  inset: 0;
  background: rgba(16, 42, 48, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.ia-popup.is-open .ia-popup__backdrop { opacity: 1; }

.ia-popup__card {
  position: relative;
  margin: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, 1fr); /* Zeile darf schrumpfen -> Body kann scrollen */
  width: 860px;
  max-width: 100%;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow: hidden;
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 30px 70px rgba(16, 42, 48, 0.22);
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
.ia-popup.is-open .ia-popup__card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Foto-Spalte */
.ia-popup__media {
  position: relative;
  min-height: 420px;
  background-size: cover;
  background-position: center;
  background-color: #eef7f9;
}
.ia-popup__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(16, 42, 48, 0) 55%, rgba(16, 42, 48, 0.34) 100%);
}

.ia-popup__badge {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, #00a2b8 0%, #00606e 100%);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 8px 15px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(16, 42, 48, 0.22);
}
.ia-popup__badge svg { width: 15px; height: 15px; flex: none; }

/* Inhalt-Spalte */
.ia-popup__body {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0; /* sonst verhindert min-height:auto das Scrollen im Grid */
  padding: 40px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ia-popup__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: #f4f6f5;
  color: #4a6470;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.ia-popup__close:hover { background: #e4ecef; color: #15303a; }
.ia-popup__close svg { width: 18px; height: 18px; }

.ia-popup__title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.18;
  color: #15303a;
  margin: 0 0 12px;
  padding: 0 26px 0 0; /* rechts Platz fuer den Schliessen-Button */
}

.ia-popup__text {
  color: #4a6470;
  font-size: 16px;
  line-height: 1.6;
  margin: 0 0 20px;
  padding: 0;
}
.ia-popup__text strong { color: #15303a; font-weight: 700; }

.ia-popup__list {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
}
.ia-popup__list li {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 15px;
  line-height: 1.4;
  color: #23261f;
  margin: 0 0 11px;
  padding: 0;
}
.ia-popup__list li:last-child { margin-bottom: 0; }
.ia-popup__list li svg { width: 19px; height: 19px; flex: none; color: #00a2b8; }

/* Nächste Termine (per JS befüllt) */
.ia-popup__dates { margin: 0 0 22px; }
.ia-popup__dates[hidden] { display: none; }
.ia-popup__dates-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7a8e97;
  margin: 0 0 9px;
  padding: 0;
}
.ia-popup__dates-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
}
.ia-popup__dates-list li {
  background: #f7fbfc;
  border: 1px solid #eff4f6;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  color: #4a6470;
}
.ia-popup__dates-list strong { color: #00606e; font-weight: 700; }

.ia-popup__actions {
  margin-top: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
}

/* Eigenständiger Button (unabhängig vom Typo3-Theme) */
.ia-popup__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 30px;
  background: linear-gradient(135deg, #00a2b8 0%, #00606e 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0, 162, 184, 0.26);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.ia-popup__btn:hover {
  color: #fff;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(0, 162, 184, 0.32);
}

.ia-popup__later {
  border: 0;
  background: none;
  color: #7a8e97;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
}
.ia-popup__later:hover { color: #4a6470; text-decoration: underline; }

/* Scroll-Lock solange offen */
.ia-popup-lock, .ia-popup-lock body { overflow: hidden; }

/* Mobil: gestapelt, kompaktere Typo/Abstände; die Karte darf wachsen –
   gescrollt wird dann das Overlay (siehe .ia-popup overflow-y). */
@media (max-width: 720px) {
  .ia-popup { padding: 10px; }

  .ia-popup__card {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    max-height: none;
  }
  .ia-popup__body { overflow: visible; padding: 20px 18px 22px; }

  .ia-popup__media { min-height: 132px; }
  .ia-popup__badge { font-size: 11px; padding: 6px 12px; gap: 6px; top: 14px; left: 14px; }
  .ia-popup__badge svg { width: 13px; height: 13px; }

  .ia-popup__close { width: 34px; height: 34px; top: 12px; right: 12px; background: rgba(255, 255, 255, 0.9); box-shadow: 0 2px 8px rgba(16, 42, 48, 0.18); }
  .ia-popup__close svg { width: 16px; height: 16px; }

  .ia-popup__title { font-size: 21px; margin-bottom: 8px; padding-right: 40px; }
  .ia-popup__text { font-size: 14px; line-height: 1.5; margin-bottom: 13px; }

  .ia-popup__list { margin-bottom: 14px; }
  .ia-popup__list li { font-size: 13px; gap: 9px; margin-bottom: 8px; }
  .ia-popup__list li svg { width: 17px; height: 17px; }

  .ia-popup__dates { margin-bottom: 14px; }
  .ia-popup__dates-label { font-size: 11px; margin-bottom: 6px; }
  .ia-popup__dates-list { gap: 6px; }
  .ia-popup__dates-list li { font-size: 11px; padding: 5px 11px; }

  .ia-popup__actions { gap: 8px 12px; }
  .ia-popup__btn { width: 100%; height: 46px; font-size: 14px; padding: 0 20px; }
  .ia-popup__later { font-size: 12px; }
}

/* Sehr niedrige Viewports (Landscape-Handy): Foto weiter reduzieren */
@media (max-width: 720px) and (max-height: 520px) {
  .ia-popup__media { min-height: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  .ia-popup__backdrop, .ia-popup__card { transition: none; }
  .ia-popup__btn { transition: none; }
}
