/*
 * PS Datenschutzhinweis – Frontend
 *
 * Bewusst ohne Webfonts: Es werden ausschließlich Systemschriften
 * verwendet, damit dieses Plugin selbst keine Verbindung zu einem
 * Schriftarten-Anbieter aufbaut.
 */

.psdzh-notice,
.psdzh-toggle {
  --psdzh-accent: #0d3c78;
  --psdzh-accent-dark: #092b56;
  --psdzh-text: #16213a;
  --psdzh-muted: #5a6779;
  --psdzh-line: rgba(13, 60, 120, 0.16);
  --psdzh-surface: #ffffff;
  --psdzh-shadow: 0 18px 48px rgba(11, 34, 66, 0.18);

  box-sizing: border-box;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--psdzh-text);
  text-align: left;
  -webkit-font-smoothing: antialiased;
}

.psdzh-notice *,
.psdzh-notice *::before,
.psdzh-notice *::after,
.psdzh-toggle *,
.psdzh-toggle *::before,
.psdzh-toggle *::after {
  box-sizing: border-box;
}

/* Ohne JavaScript bleibt der Hinweis statisch sichtbar. */
.psdzh-notice[hidden],
.psdzh-toggle[hidden] {
  display: none !important;
}

.psdzh-notice {
  position: fixed;
  z-index: 2147483000;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 16px;
  right: 16px;
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin-inline: auto;
  opacity: 1;
  transform: none;
  transition: opacity 220ms ease, transform 480ms cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

/*
 * Nur wenn JavaScript läuft, startet der Hinweis unterhalb des Viewports
 * und fährt anschließend hoch. Ohne JavaScript bleibt er sofort lesbar.
 */
html.psdzh-js .psdzh-notice {
  opacity: 0;
  transform: translateY(calc(100% + 40px));
}

.psdzh-notice--left {
  margin-left: 0;
  margin-right: auto;
}

.psdzh-notice--right {
  margin-left: auto;
  margin-right: 0;
}

html.psdzh-js .psdzh-notice.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/*
 * Ohne JavaScript wird der Hinweis zu einem normalen Textblock am Seitenende.
 * So bleibt die Information lesbar, ohne dass ein nicht schließbares Fenster
 * den halben Bildschirm verdeckt.
 */
html:not(.psdzh-js) .psdzh-notice {
  position: static;
  width: auto;
  max-height: none;
  margin: 32px auto;
  padding: 0 16px;
  opacity: 1;
  transform: none;
}

html:not(.psdzh-js) .psdzh-notice__card {
  max-width: 920px;
  max-height: none;
  margin-inline: auto;
}

html:not(.psdzh-js) .psdzh-notice__actions {
  display: none;
}

.psdzh-notice__card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-height: calc(100dvh - 32px);
  padding: 20px 24px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--psdzh-surface);
  border: 1px solid var(--psdzh-line);
  border-radius: 16px;
  box-shadow: var(--psdzh-shadow);
}

.psdzh-notice__body {
  min-width: 0;
}

.psdzh-notice__title {
  margin: 0 0 8px;
  padding: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--psdzh-accent);
  letter-spacing: -0.01em;
}

.psdzh-notice__text {
  margin: 0 0 10px;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--psdzh-text);
}

.psdzh-notice__meta {
  margin: 0 0 4px;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--psdzh-muted);
}

.psdzh-notice__meta--note {
  margin-bottom: 0;
  font-weight: 600;
  color: var(--psdzh-accent);
}

.psdzh-notice__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.psdzh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.psdzh-button--primary {
  background: var(--psdzh-accent);
  border-color: var(--psdzh-accent);
  color: #ffffff;
}

.psdzh-button--primary:hover,
.psdzh-button--primary:focus {
  background: var(--psdzh-accent-dark);
  border-color: var(--psdzh-accent-dark);
  color: #ffffff;
}

.psdzh-button--ghost {
  background: #ffffff;
  border-color: var(--psdzh-line);
  color: var(--psdzh-accent);
}

.psdzh-button--ghost:hover,
.psdzh-button--ghost:focus {
  background: #f4f7fc;
  border-color: var(--psdzh-accent);
  color: var(--psdzh-accent-dark);
}

.psdzh-button:focus-visible,
.psdzh-toggle:focus-visible,
.psdzh-notice:focus-visible {
  outline: 2px solid var(--psdzh-accent);
  outline-offset: 3px;
}

/* Wiederöffnen */
.psdzh-toggle {
  position: fixed;
  z-index: 2147483000;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  background: #ffffff;
  border: 1px solid var(--psdzh-line);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(11, 34, 66, 0.14);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--psdzh-accent);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 260ms ease, background-color 160ms ease;
}

.psdzh-toggle.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.psdzh-toggle:hover {
  background: #f4f7fc;
}

.psdzh-toggle__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--psdzh-accent);
  flex-shrink: 0;
}

@media (max-width: 767px) {
  .psdzh-notice {
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: calc(100vw - 24px);
  }

  .psdzh-notice__card {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 16px 16px 14px;
    border-radius: 14px;
  }

  .psdzh-notice__actions {
    flex-direction: column;
    gap: 8px;
  }

  .psdzh-button {
    width: 100%;
    min-height: 40px;
    padding: 9px 16px;
  }

  .psdzh-toggle {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .psdzh-notice__title {
    margin-bottom: 6px;
    font-size: 1rem;
  }

  .psdzh-notice__text {
    margin-bottom: 8px;
    font-size: 0.875rem;
    line-height: 1.5;
  }

  .psdzh-notice__meta {
    font-size: 0.75rem;
    line-height: 1.45;
  }
}

@media (prefers-reduced-motion: reduce) {
  .psdzh-notice,
  .psdzh-toggle {
    transition: opacity 120ms linear;
  }

  .psdzh-notice {
    transform: none;
  }

  .psdzh-toggle {
    transform: none;
  }
}

@media print {
  .psdzh-notice,
  .psdzh-toggle {
    display: none !important;
  }
}
