/* ==========================================================================
   AL Finanzkonzepte — Consent-Management (Cookie-Banner)
   --------------------------------------------------------------------------
   Eigene Datei, damit css/al-finanz.css unberührt bleibt.
   Muss NACH css/al-finanz.css eingebunden werden.

   Gestaltungsgrundsatz: „Alle ablehnen", „Alle akzeptieren" und
   „Einstellungen" nutzen exakt dieselbe Klasse (.alf-consent-btn--equal) und
   damit identische Größe, Farbe, Kontraste und Typografie. Es gibt bewusst
   keine visuell hervorgehobene Zustimmungs-Schaltfläche (OLG Köln,
   Urt. v. 19.01.2024 – 6 U 80/23).
   ========================================================================== */

.alf-consent-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Schnellkontakt-Leiste ausblenden, solange eine Entscheidung aussteht bzw.
   der Dialog offen ist — verhindert Überlappung (Dock: z-index 900). */
html.alf-consent-blocking .contact-dock {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Zusätzlicher Platz, damit der Seitenfuß trotz Banner erreichbar bleibt.
   Die Fläche liegt exakt hinter dem Banner, ist also nicht sichtbar. */
html.alf-consent-blocking body {
  padding-bottom: var(--alf-consent-offset, 0px);
}

html.alf-consent-locked,
html.alf-consent-locked body {
  overflow: hidden;
}

/* ── Gemeinsame Bausteine ─────────────────────────────────────────────── */

.alf-consent-banner,
.alf-consent-modal {
  font-family: var(--font-family, 'Plus Jakarta Sans', system-ui, sans-serif);
  color: var(--navy, #0D1B2A);
  -webkit-font-smoothing: antialiased;
}

.alf-consent-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-dark, #8f7036);
  margin-bottom: 0.7rem;
}

.alf-consent-eyebrow::before {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  background: var(--gold, #b48f47);
}

.alf-consent-title {
  margin: 0 0 0.65rem;
  font-size: clamp(1.12rem, 2.4vw, 1.4rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--navy, #0D1B2A);
}

.alf-consent-body {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-mid, #445566);
}

.alf-consent-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin: 1rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted, #7A8A99);
}

.alf-consent-links a {
  color: var(--navy, #0D1B2A);
  text-decoration: underline;
  text-decoration-color: rgba(180, 143, 71, 0.55);
  text-underline-offset: 3px;
}

.alf-consent-links a:hover {
  color: var(--gold-dark, #8f7036);
  text-decoration-color: currentColor;
}

/* ── Schaltflächen — bewusst identisch ────────────────────────────────── */

.alf-consent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.85rem 1.35rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  color: var(--navy, #0D1B2A);
  background: var(--white, #fff);
  border: 1px solid var(--navy, #0D1B2A);
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.alf-consent-btn:hover {
  background: var(--navy, #0D1B2A);
  color: var(--cream, #F6F2ED);
  border-color: var(--navy, #0D1B2A);
}

.alf-consent-btn:active {
  background: var(--navy-mid, #162330);
  color: var(--cream, #F6F2ED);
}

.alf-consent-btn:focus-visible {
  outline: 2px solid var(--gold-dark, #8f7036);
  outline-offset: 3px;
}

.alf-consent-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 1.35rem;
}

/* ── Erste Ebene: Banner (nicht modal, kein Cookie-Wall) ──────────────── */

.alf-consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9000;
  display: flex;
  justify-content: center;
  padding: 0 clamp(0.75rem, 3vw, 2rem) calc(clamp(0.75rem, 3vw, 2rem) + env(safe-area-inset-bottom, 0));
  pointer-events: none;
  animation: alf-consent-rise 0.4s ease both;
}

.alf-consent-banner:focus {
  outline: none;
}

.alf-consent-banner--hidden {
  display: none;
}

.alf-consent-banner--static {
  animation: none;
}

@keyframes alf-consent-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alf-consent-card {
  pointer-events: auto;
  width: 100%;
  max-width: 50rem;
  max-height: min(80vh, 40rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(1.25rem, 3vw, 1.9rem) clamp(1.15rem, 3vw, 2.1rem);
  background: var(--cream, #F6F2ED);
  border: 1px solid var(--cream-dark, #EAE3D9);
  border-top: 2px solid var(--gold, #b48f47);
  border-radius: 2px;
  box-shadow: 0 -2px 40px rgba(13, 27, 42, 0.16), 0 18px 48px rgba(13, 27, 42, 0.1);
}

/* ── Zweite Ebene: Einstellungen (modal, mit Fokusfalle) ──────────────── */

.alf-consent-modal {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.5rem, 3vw, 2rem);
}

.alf-consent-scrim {
  position: absolute;
  inset: 0;
  background: rgba(13, 27, 42, 0.62);
  backdrop-filter: blur(2px);
  animation: alf-consent-fade 0.25s ease both;
}

.alf-consent-modal--static .alf-consent-scrim,
.alf-consent-modal--static .alf-consent-panel {
  animation: none;
}

@keyframes alf-consent-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.alf-consent-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 46rem;
  max-height: min(90vh, 52rem);
  background: var(--cream, #F6F2ED);
  border-top: 2px solid var(--gold, #b48f47);
  border-radius: 2px;
  box-shadow: 0 30px 80px rgba(13, 27, 42, 0.4);
  animation: alf-consent-rise 0.32s ease both;
}

.alf-consent-panel__head {
  position: relative;
  flex: 0 0 auto;
  padding: clamp(1.35rem, 3vw, 2rem) clamp(1.15rem, 3vw, 2.1rem) 1.1rem;
  padding-right: clamp(3rem, 6vw, 4rem);
  border-bottom: 1px solid var(--cream-dark, #EAE3D9);
}

.alf-consent-close {
  position: absolute;
  top: clamp(1rem, 2.5vw, 1.5rem);
  right: clamp(0.85rem, 2.5vw, 1.4rem);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--navy, #0D1B2A);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.alf-consent-close:hover {
  background: rgba(180, 143, 71, 0.1);
  border-color: rgba(180, 143, 71, 0.45);
}

.alf-consent-close:focus-visible {
  outline: 2px solid var(--gold-dark, #8f7036);
  outline-offset: 2px;
}

.alf-consent-panel__body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.4rem clamp(1.15rem, 3vw, 2.1rem) 1.25rem;
  -webkit-overflow-scrolling: touch;
}

.alf-consent-panel__foot {
  flex: 0 0 auto;
  padding: 1.1rem clamp(1.15rem, 3vw, 2.1rem) calc(1.35rem + env(safe-area-inset-bottom, 0));
  background: var(--white, #fff);
  border-top: 1px solid var(--cream-dark, #EAE3D9);
}

.alf-consent-panel__foot .alf-consent-actions {
  margin-top: 0;
}

/* ── Kategorien ───────────────────────────────────────────────────────── */

.alf-consent-cat {
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--cream-dark, #EAE3D9);
}

.alf-consent-cat:last-of-type {
  border-bottom: 0;
}

.alf-consent-cat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.alf-consent-cat__badge {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dark, #8f7036);
  white-space: nowrap;
}

.alf-consent-cat__desc {
  margin: 0.6rem 0 0;
  font-size: 0.845rem;
  line-height: 1.7;
  color: var(--text-mid, #445566);
}

/* ── Schalter ─────────────────────────────────────────────────────────── */

.alf-consent-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
  user-select: none;
}

.alf-consent-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  margin: 0;
}

.alf-consent-switch__track {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 26px;
  background: var(--white, #fff);
  border: 1px solid var(--text-muted, #7A8A99);
  border-radius: 13px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.alf-consent-switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--text-mid, #445566);
  border-radius: 50%;
  transition: transform 0.2s ease, background 0.2s ease;
}

.alf-consent-switch input:checked + .alf-consent-switch__track {
  background: var(--navy, #0D1B2A);
  border-color: var(--navy, #0D1B2A);
}

.alf-consent-switch input:checked + .alf-consent-switch__track::after {
  transform: translateX(20px);
  background: var(--gold, #b48f47);
}

.alf-consent-switch input:focus-visible + .alf-consent-switch__track {
  outline: 2px solid var(--gold-dark, #8f7036);
  outline-offset: 3px;
}

.alf-consent-switch input:disabled + .alf-consent-switch__track {
  opacity: 0.75;
  cursor: not-allowed;
}

.alf-consent-switch input:disabled ~ .alf-consent-switch__text {
  cursor: not-allowed;
}

.alf-consent-switch__text {
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--navy, #0D1B2A);
}

/* ── Dienste-Details ──────────────────────────────────────────────────── */

.alf-consent-details {
  margin-top: 0.85rem;
  border-top: 1px solid var(--cream-dark, #EAE3D9);
}

.alf-consent-details > summary {
  padding: 0.7rem 0 0.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-dark, #8f7036);
  cursor: pointer;
  list-style: none;
}

.alf-consent-details > summary::-webkit-details-marker {
  display: none;
}

.alf-consent-details > summary::before {
  content: '+ ';
  font-weight: 700;
}

.alf-consent-details[open] > summary::before {
  content: '– ';
}

.alf-consent-details > summary:focus-visible {
  outline: 2px solid var(--gold-dark, #8f7036);
  outline-offset: 2px;
}

.alf-consent-service {
  margin-top: 0.7rem;
  padding: 0.9rem 1rem;
  background: var(--white, #fff);
  border-top: 2px solid var(--gold, #b48f47);
  border-radius: 2px;
}

.alf-consent-service__name {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--navy, #0D1B2A);
}

.alf-consent-def {
  display: grid;
  grid-template-columns: minmax(9rem, 12rem) 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.65;
}

.alf-consent-def dt {
  font-weight: 600;
  color: var(--navy, #0D1B2A);
}

.alf-consent-def dd {
  margin: 0;
  color: var(--text-mid, #445566);
  overflow-wrap: anywhere;
}

.alf-consent-def a {
  color: var(--gold-dark, #8f7036);
}

.alf-consent-record {
  margin: 1.2rem 0 0;
  padding: 0.8rem 0.95rem;
  font-size: 0.755rem;
  line-height: 1.6;
  color: var(--text-mid, #445566);
  background: rgba(180, 143, 71, 0.07);
  border-left: 2px solid var(--gold, #b48f47);
  border-radius: 2px;
  overflow-wrap: anywhere;
}

/* ── Platzhalter für blockierte Einbettungen ──────────────────────────── */

.alf-consent-embed--blocked {
  display: block;
}

/* Calendly steuert seine Höhe über data-resize per postMessage. Meldet die
   Einbettung eine unbrauchbar kleine Höhe (in Tests: 2px), kollabiert der
   Kalender. Eine Untergrenze fängt das ab; größere gemeldete Höhen gewinnen
   weiterhin, weil height über min-height nicht hinauswirkt. Die bestehende
   Mobil-Regel in al-finanz.css bleibt unberührt. */
@media (min-width: 901px) {
  [data-consent-embed] .calendly-inline-widget {
    min-height: 720px;
  }
}

.alf-consent-embed__box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.3rem, 4vw, 2.25rem);
  background: var(--cream, #F6F2ED);
  border: 1px solid var(--cream-dark, #EAE3D9);
  border-top: 2px solid var(--gold, #b48f47);
  border-radius: 2px;
}

.alf-consent-embed__tag {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-dark, #8f7036);
  margin-bottom: 0.7rem;
}

.alf-consent-embed__tag::before {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  background: var(--gold, #b48f47);
}

.alf-consent-embed__title {
  margin: 0 0 0.6rem;
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--navy, #0D1B2A);
}

.alf-consent-embed__body {
  margin: 0;
  max-width: 44rem;
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--text-mid, #445566);
}

.alf-consent-embed__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.3rem;
}

.alf-consent-embed__actions .alf-consent-btn {
  flex: 1 1 15rem;
}

.alf-consent-embed__hint {
  margin: 0.9rem 0 0;
  font-size: 0.775rem;
  line-height: 1.65;
  color: var(--text-muted, #7A8A99);
}

.alf-consent-embed__hint a {
  color: var(--gold-dark, #8f7036);
}

/* ── Auslöser im Seitenfuß / in Fließtexten ───────────────────────────── */

.footer-consent-link {
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(180, 143, 71, 0.55);
  text-underline-offset: 3px;
}

.footer-consent-link:hover {
  color: var(--gold-light, #c4a35c);
  text-decoration-color: currentColor;
}

.footer-consent-link:focus-visible {
  outline: 2px solid var(--gold, #b48f47);
  outline-offset: 3px;
}

.alf-consent-inline-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0.35rem 0;
  padding: 0.7rem 1.3rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--navy, #0D1B2A);
  background: var(--white, #fff);
  border: 1px solid var(--navy, #0D1B2A);
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.alf-consent-inline-btn:hover {
  background: var(--navy, #0D1B2A);
  color: var(--cream, #F6F2ED);
}

.alf-consent-inline-btn:focus-visible {
  outline: 2px solid var(--gold-dark, #8f7036);
  outline-offset: 3px;
}

/* ── Cookie-Übersicht in der Datenschutzerklärung ─────────────────────── */

.alf-cookie-table-wrap {
  margin: 1rem 0 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.alf-cookie-table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-size: 0.82rem;
  line-height: 1.6;
  background: var(--white, #fff);
  border: 1px solid var(--cream-dark, #EAE3D9);
  border-top: 2px solid var(--gold, #b48f47);
}

.alf-cookie-table caption {
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted, #7A8A99);
  text-align: left;
}

.alf-cookie-table th,
.alf-cookie-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--cream-dark, #EAE3D9);
}

.alf-cookie-table thead th {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-dark, #8f7036);
  background: var(--cream, #F6F2ED);
  white-space: nowrap;
}

.alf-cookie-table tbody th {
  font-weight: 600;
  color: var(--navy, #0D1B2A);
  overflow-wrap: anywhere;
}

.alf-cookie-table td {
  color: var(--text-mid, #445566);
}

.alf-cookie-table tbody tr:last-child th,
.alf-cookie-table tbody tr:last-child td {
  border-bottom: 0;
}

/* ── Mobil ────────────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .alf-consent-banner {
    padding: 0;
  }

  .alf-consent-card {
    max-width: none;
    max-height: 86vh;
    padding: 1.2rem 1.1rem calc(1.2rem + env(safe-area-inset-bottom, 0));
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }

  .alf-consent-actions {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .alf-consent-modal {
    padding: 0;
    align-items: stretch;
  }

  .alf-consent-panel {
    max-width: none;
    max-height: 100%;
    border-radius: 0;
  }

  .alf-consent-def {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  .alf-consent-def dd {
    margin-bottom: 0.45rem;
  }

  .alf-consent-embed__actions .alf-consent-btn {
    flex: 1 1 100%;
  }
}

/* ── Bewegungsreduktion ──────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .alf-consent-banner,
  .alf-consent-panel,
  .alf-consent-scrim {
    animation: none !important;
  }

  .alf-consent-btn,
  .alf-consent-switch__track,
  .alf-consent-switch__track::after,
  .alf-consent-close {
    transition: none !important;
  }
}

/* ── Kontrastvorlieben ───────────────────────────────────────────────── */

@media (prefers-contrast: more) {
  .alf-consent-btn {
    border-width: 2px;
  }

  .alf-consent-body,
  .alf-consent-cat__desc,
  .alf-consent-def dd {
    color: var(--navy, #0D1B2A);
  }
}
