/* ============================================================
 * Tendre Consent — Banner und Einstellungsdialog
 * ------------------------------------------------------------
 * Uebernommen aus dem Novella-Projekt (eigener Banner, ersetzt
 * Cookiebot), Farben und Schrift auf Tendre umgestellt.
 * ============================================================ */

.nv-consent {
  --nvc-flaeche:  #FFFFFF;
  --nvc-text:     var(--neutral--800, #0f0c09);
  --nvc-gedimmt:  var(--neutral--700, #4d4845);
  --nvc-rand:     rgba(15, 12, 9, 0.08);
  --nvc-linie:    var(--neutral--400, #cfcfce);
  --nvc-gruen:    var(--accent--primary-1, #0f0c09);
  --nvc-radius:   12px;

  font-family: "General Sans", system-ui, -apple-system, sans-serif;
  color: var(--nvc-text);
}

/* Hintergrund nicht mitscrollen lassen, solange der Dialog offen ist. */
html.nv-consent-locked,
html.nv-consent-locked body {
  overflow: hidden;
}

/* ============================================================
 * 1) Banner unten
 * ============================================================ */
.nv-consent-notice {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 9999;

  max-width: 1024px;
  margin: 0 auto;
  padding: 20px 24px;

  background: var(--nvc-flaeche);
  border: 1px solid var(--nvc-rand);
  border-radius: var(--nvc-radius);
  box-shadow: 0 12px 48px rgba(15, 12, 9, 0.16),
              0 2px 6px rgba(15, 12, 9, 0.08);

  display: none;
}

.nv-consent-notice.is-open {
  display: block;
  animation: nv-consent-auf 260ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes nv-consent-auf {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.nv-consent-notice-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--nvc-text);
}

.nv-consent-notice-text {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--nvc-text);
}

.nv-consent-notice-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* Der Einstellungen-Link steht links, die zwei Entscheidungen rechts. */
.nv-consent-notice-actions .nv-consent-btn-link {
  margin-right: auto;
}

/* ============================================================
 * 2) Knoepfe
 * ============================================================ */
.nv-consent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 16px;

  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;

  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 160ms ease-out,
              border-color 160ms ease-out,
              color 160ms ease-out;
}

.nv-consent-btn-primary {
  background: var(--nvc-gruen);
  border-color: var(--nvc-gruen);
  color: #FFFFFF;
}

.nv-consent-btn-primary:hover {
  background: #4d4845;
  border-color: #4d4845;
}

.nv-consent-btn-outline {
  background: transparent;
  border-color: var(--nvc-linie);
  color: var(--nvc-text);
}

.nv-consent-btn-outline:hover {
  border-color: var(--nvc-text);
}

.nv-consent-btn-link {
  background: transparent;
  border-color: transparent;
  color: var(--nvc-gedimmt);
  padding-left: 0;
  padding-right: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.nv-consent-btn-link:hover {
  color: var(--nvc-text);
}

.nv-consent-link {
  color: var(--nvc-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============================================================
 * 3) Einstellungsdialog
 * ============================================================ */
.nv-consent-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 12, 9, 0.45);

  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.nv-consent-overlay.is-open {
  display: flex;
  animation: nv-consent-blende 180ms ease-out;
}

@keyframes nv-consent-blende {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.nv-consent-modal {
  width: 100%;
  max-width: 640px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;

  background: var(--nvc-flaeche);
  border: 1px solid var(--nvc-rand);
  border-radius: var(--nvc-radius);
  box-shadow: 0 24px 64px rgba(15, 12, 9, 0.24);
  padding: 24px;
}

.nv-consent-modal:focus {
  outline: none;
}

.nv-consent-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.nv-consent-modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}

.nv-consent-close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: -4px -4px 0 0;
  padding: 0;

  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--nvc-gedimmt);
  cursor: pointer;
}

.nv-consent-close:hover {
  color: var(--nvc-text);
  background: rgba(15, 12, 9, 0.06);
}

.nv-consent-modal-text {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--nvc-gedimmt);
}

/* ---------------- Zwecke und Dienste ---------------- */
.nv-consent-purpose {
  padding: 16px 0;
  border-top: 1px solid var(--nvc-rand);
}

.nv-consent-purpose-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.nv-consent-purpose-text {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--nvc-gedimmt);
}

.nv-consent-service {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
}

.nv-consent-service-title {
  display: block;
  font-size: 14px;
  font-weight: 500;
}

.nv-consent-service-desc,
.nv-consent-service-cookies {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--nvc-gedimmt);
}

.nv-consent-service-cookies {
  font-size: 12px;
  opacity: 0.85;
}

/* ---------------- Schalter ---------------- */
.nv-consent-switch {
  flex: none;
  position: relative;
  display: inline-block;
  width: 40px;
  height: 24px;
  margin-top: 2px;
  cursor: pointer;
}

/* Die echte Checkbox bleibt bedienbar und fuer Screenreader da,
   liegt aber unsichtbar ueber der Spur. */
.nv-consent-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.nv-consent-switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--nvc-linie);
  transition: background-color 160ms ease-out;
  pointer-events: none;
}

.nv-consent-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(15, 12, 9, 0.24);
  transition: transform 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

.nv-consent-switch input:checked + .nv-consent-switch-track {
  background: var(--nvc-gruen);
}

.nv-consent-switch input:checked + .nv-consent-switch-track::after {
  transform: translateX(16px);
}

.nv-consent-switch input:disabled + .nv-consent-switch-track {
  opacity: 0.5;
}

.nv-consent-switch input:disabled {
  cursor: not-allowed;
}

.nv-consent-switch input:focus-visible + .nv-consent-switch-track {
  outline: 2px solid var(--nvc-gruen);
  outline-offset: 2px;
}

/* ---------------- Fussleiste des Dialogs ---------------- */
.nv-consent-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--nvc-rand);
}

.nv-consent-modal-actions .nv-consent-btn {
  flex: 1 1 auto;
}

/* ============================================================
 * 4) Schmale Bildschirme
 * ============================================================ */
@media (max-width: 599px) {
  .nv-consent-notice {
    padding: 18px 18px 16px;
  }

  .nv-consent-notice-actions {
    flex-direction: column;
    align-items: stretch;
  }

  /* Reihenfolge am Handy: erst die Entscheidungen, der Link zuletzt. */
  .nv-consent-notice-actions .nv-consent-btn-link {
    order: 3;
    margin-right: 0;
    margin-top: 2px;
  }

  .nv-consent-modal {
    padding: 20px 18px;
  }

  .nv-consent-modal-actions {
    flex-direction: column;
  }
}

/* ============================================================
 * 5) Reduzierte Bewegung
 * ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .nv-consent-notice.is-open,
  .nv-consent-overlay.is-open {
    animation: none;
  }

  .nv-consent-btn,
  .nv-consent-switch-track,
  .nv-consent-switch-track::after {
    transition: none;
  }
}
