/* NOVVIA Popup – Formate, Teaser, Handy-Gestaltung (P1)
   Das Overlay (.novvia-popup-overlay) behält seine Klasse; data-fmt (vom Skript gesetzt: Desktop- oder Handy-Format)
   bestimmt das Layout. Modal-Popups ohne Handy-Abweichung behalten ihren bisherigen Inline-Style. */

/* ---------- Größen als Variable (Slide-ins, Handy-Größe) ---------- */
.novvia-popup-overlay[data-size="sm"]   { --nvp-w: 400px; }
.novvia-popup-overlay[data-size="md"]   { --nvp-w: 600px; }
.novvia-popup-overlay[data-size="lg"]   { --nvp-w: 800px; }
.novvia-popup-overlay[data-size="xl"]   { --nvp-w: 1000px; }
.novvia-popup-overlay[data-size="full"] { --nvp-w: 95vw; }
.novvia-popup-overlay[data-size-m] .novvia-popup-box { max-width: var(--nvp-w) !important; }

/* ---------- Gemeinsame Basis der flexiblen Formate ---------- */
.novvia-popup-overlay.nvp-flex { position: fixed; z-index: 99999; backdrop-filter: none; }

/* Modal / Seitenlasche (Popup selbst erscheint als Modal) */
.nvp-flex[data-fmt="modal"],
.nvp-flex[data-fmt="sidetab"] {
  inset: 0; background: var(--nvp-ov); align-items: var(--nvp-al);
  justify-content: center; padding: 1rem; overflow-y: auto; backdrop-filter: blur(4px);
}

/* Vollbild */
.nvp-flex[data-fmt="fullscreen"] {
  inset: 0; background: var(--nvp-ov); padding: 0; overflow: hidden;
  align-items: stretch; justify-content: stretch; backdrop-filter: none;
}
.nvp-flex[data-fmt="fullscreen"] .novvia-popup-box {
  width: 100% !important; max-width: none !important; height: 100% !important; max-height: none !important;
  border-radius: 0 !important; box-shadow: none !important;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.nvp-flex[data-fmt="fullscreen"] .novvia-popup-content { padding: 3.5rem 1.5rem 1rem !important; max-width: 820px; width: 100%; box-sizing: border-box; }
.nvp-flex[data-fmt="fullscreen"] .novvia-popup-close:not(.novvia-popup-weiter) { top: 1rem !important; right: 1rem !important; }

.novvia-popup-weiter { display: none; }
.nvp-flex[data-fmt="fullscreen"] .novvia-popup-weiter {
  display: inline-block; margin: 0 auto 2.5rem; padding: .7rem 1.6rem; border-radius: 999px;
  border: 1px solid currentColor; background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer;
}
.nvp-flex[data-fmt="fullscreen"] .novvia-popup-weiter:hover { background: rgba(127,127,127,.15); }

/* Leisten: volle Breite, ohne Abdunklung, Höhe nach Inhalt */
.nvp-flex[data-fmt="bar_top"],
.nvp-flex[data-fmt="bar_bottom"] {
  left: 0; right: 0; padding: 0; background: transparent; pointer-events: none; overflow: visible; align-items: stretch;
}
.nvp-flex[data-fmt="bar_top"]    { top: 0; }
.nvp-flex[data-fmt="bar_bottom"] { bottom: 0; }
body.admin-bar .nvp-flex[data-fmt="bar_top"] { top: 32px; }
@media (max-width: 782px) { body.admin-bar .nvp-flex[data-fmt="bar_top"] { top: 46px; } }
@media (max-width: 600px) { body.admin-bar .nvp-flex[data-fmt="bar_top"] { top: 0; } }
.nvp-flex[data-fmt="bar_top"] .novvia-popup-box,
.nvp-flex[data-fmt="bar_bottom"] .novvia-popup-box {
  pointer-events: auto; width: 100% !important; max-width: none !important; max-height: none !important;
  border-radius: 0 !important; overflow: visible !important; box-shadow: 0 2px 12px rgba(15,23,42,.25) !important;
}
.nvp-flex[data-fmt="bar_top"] .novvia-popup-content,
.nvp-flex[data-fmt="bar_bottom"] .novvia-popup-content {
  padding: .7rem 3.6rem .7rem 1rem !important; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem 1rem; text-align: center;
}
.nvp-flex[data-fmt="bar_top"] .novvia-popup-content > *,
.nvp-flex[data-fmt="bar_bottom"] .novvia-popup-content > * { margin: 0 !important; }
.nvp-flex[data-fmt="bar_top"] .novvia-popup-content p,
.nvp-flex[data-fmt="bar_bottom"] .novvia-popup-content p { margin: 0 !important; }
.nvp-flex[data-fmt="bar_top"] .novvia-popup-content h1,
.nvp-flex[data-fmt="bar_top"] .novvia-popup-content h2,
.nvp-flex[data-fmt="bar_top"] .novvia-popup-content h3,
.nvp-flex[data-fmt="bar_bottom"] .novvia-popup-content h1,
.nvp-flex[data-fmt="bar_bottom"] .novvia-popup-content h2,
.nvp-flex[data-fmt="bar_bottom"] .novvia-popup-content h3 { font-size: 1.05rem; margin: 0 !important; }
.nvp-flex[data-fmt="bar_top"] .novvia-popup-close,
.nvp-flex[data-fmt="bar_bottom"] .novvia-popup-close { top: 50% !important; right: .75rem !important; transform: translateY(-50%); }
.nvp-flex[data-fmt="bar_top"] .novvia-popup-content img,
.nvp-flex[data-fmt="bar_bottom"] .novvia-popup-content img { max-height: 3rem; width: auto !important; }

/* Slide-ins: Breite = Größe, ohne Abdunklung */
.nvp-flex[data-fmt="slidein_br"],
.nvp-flex[data-fmt="slidein_bl"] {
  bottom: 20px; top: auto; padding: 0; background: transparent; pointer-events: none; overflow: visible; align-items: flex-end;
  width: min(var(--nvp-w, 420px), 480px, calc(100vw - 32px));   /* P7: Slide-ins höchstens 480 px breit */
}
.nvp-flex[data-fmt="slidein_br"] { right: 20px; left: auto; }
.nvp-flex[data-fmt="slidein_bl"] { left: 20px; right: auto; }
.nvp-flex[data-fmt="slidein_br"] .novvia-popup-box,
.nvp-flex[data-fmt="slidein_bl"] .novvia-popup-box {
  pointer-events: auto; width: 100% !important; max-width: 100% !important; max-height: 80vh;
  box-shadow: 0 12px 32px rgba(15,23,42,.22), 0 4px 12px rgba(15,23,42,.1) !important;
}
.nvp-flex[data-fmt="slidein_br"] .novvia-popup-content,
.nvp-flex[data-fmt="slidein_bl"] .novvia-popup-content { padding: 1.25rem 1.25rem 1.1rem !important; }

@keyframes nvp-einflug-rechts { from { opacity: 0; transform: translateX(110%); } to { opacity: 1; transform: none; } }
@keyframes nvp-einflug-links  { from { opacity: 0; transform: translateX(-110%); } to { opacity: 1; transform: none; } }

/* ---------- Handy: andere Größe / Position ---------- */
@media (max-width: 767px) {
  .novvia-popup-overlay[data-size-m="sm"]   { --nvp-w: 400px !important; }
  .novvia-popup-overlay[data-size-m="md"]   { --nvp-w: 600px !important; }
  .novvia-popup-overlay[data-size-m="lg"]   { --nvp-w: 800px !important; }
  .novvia-popup-overlay[data-size-m="xl"]   { --nvp-w: 1000px !important; }
  .novvia-popup-overlay[data-size-m="full"] { --nvp-w: 95vw !important; }
  .novvia-popup-inline[data-size-m="sm"]    { --nvp-w: 400px !important; }
  .novvia-popup-inline[data-size-m="md"]    { --nvp-w: 600px !important; }
  .novvia-popup-inline[data-size-m="lg"]    { --nvp-w: 800px !important; }
  .novvia-popup-inline[data-size-m="xl"]    { --nvp-w: 1000px !important; }
  .novvia-popup-inline[data-size-m="full"]  { --nvp-w: 95vw !important; }
  .novvia-popup-overlay[data-pos-m="top"]    { align-items: flex-start !important; }
  .novvia-popup-overlay[data-pos-m="center"] { align-items: center !important; }
  .novvia-popup-overlay[data-pos-m="bottom"] { align-items: flex-end !important; }
  .nvp-flex[data-fmt="slidein_br"], .nvp-flex[data-fmt="slidein_bl"] { bottom: 12px; right: 16px; left: 16px; width: auto; }
}

/* ---------- Eingebettet ---------- */
.novvia-popup-inline { --nvp-w: 600px; margin: 1.5rem 0; }
.novvia-popup-inline[data-size="sm"]   { --nvp-w: 400px; }
.novvia-popup-inline[data-size="lg"]   { --nvp-w: 800px; }
.novvia-popup-inline[data-size="xl"]   { --nvp-w: 1000px; }
.novvia-popup-inline[data-size="full"] { --nvp-w: 100%; }
.novvia-popup-inline[data-size-m] .novvia-popup-box { max-width: var(--nvp-w) !important; }
.novvia-popup-inline .novvia-popup-box {
  margin: 0 auto; max-height: none !important; overflow: visible !important; box-shadow: 0 4px 18px rgba(15,23,42,.12) !important;
}
.novvia-popup-inline .novvia-popup-close { display: none !important; }
.novvia-popup-inline.nvp-leer { min-height: 1px; }

/* ---------- Teaser / Seitenlasche ---------- */
.novvia-popup-teaser {
  position: fixed; bottom: 16px; z-index: 99990; display: inline-flex; align-items: center; gap: .4rem;
  border: 0; border-radius: 999px; padding: .65rem 1.15rem; background: #1e293b; color: #fff;
  font: 600 14px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif; cursor: pointer;
  box-shadow: 0 6px 20px rgba(15,23,42,.3); animation: nvp-teaser-ein .3s ease both;
}
.novvia-popup-teaser[hidden] { display: none !important; }
.novvia-popup-teaser[data-pos="br"] { right: 16px; }
.novvia-popup-teaser[data-pos="bl"] { left: 16px; }
.novvia-popup-teaser:hover { background: #0f172a; }
.novvia-popup-teaser:focus-visible { outline: 3px solid #fbbf24; outline-offset: 2px; }
@keyframes nvp-teaser-ein { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.novvia-popup-sidetab {
  top: 50%; bottom: auto; right: auto; left: auto; border-radius: 10px 10px 0 0; padding: 1rem .6rem;
  writing-mode: vertical-rl; animation: none;
}
.novvia-popup-sidetab[data-pos="rechts"] { right: 0; transform: translateY(-50%); border-radius: 10px 0 0 10px; }
.novvia-popup-sidetab[data-pos="links"]  { left: 0; transform: translateY(-50%) rotate(180deg); border-radius: 0 10px 10px 0; }

/* ---------- Countdown-Baustein ---------- */
.nvp-countdown { font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: .04em; }

/* ---------- Seite schieben (Leiste oben/unten) ---------- */
html.nvp-schiebt { transition: padding .25s ease; }

@media (prefers-reduced-motion: reduce) {
  .novvia-popup-teaser { animation: none; }
  html.nvp-schiebt { transition: none; }
}
