/* =========================================================================
   Einwilligungs-Banner und Einstellungen – Bayerische Liegenschaften
   Markenkonform (Bayern-Blau, Cormorant/Inter). Alle Schaltflächen sind
   gleichrangig gestaltet; Kontraste nach WCAG 2.1 AA.
   ========================================================================= */

/* ----- Banner (unten fixiert) ----- */
.cookie-banner {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-width: 880px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  margin: 0 auto;
  background: #FFFFFF;
  border: 1px solid #6B7280;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  padding: 24px 28px;
  z-index: 9999;
  font-family: "Inter", "Inter Fallback", "Helvetica Neue", Arial, sans-serif;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.cookie-banner.is-active {
  opacity: 1;
  transform: translateY(0);
}

.cookie-banner__title {
  font-family: "Cormorant Garamond", "Cormorant Garamond Fallback", "Times New Roman", Times, serif;
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 10px;
  color: #1A1A1A;
  line-height: 1.2;
}

.cookie-banner__body {
  font-size: 14px;
  line-height: 1.55;
  color: #4A4A4A;
  margin: 0 0 18px;
}
.cookie-banner__body a {
  color: #00478B;
  text-decoration: underline;
}
.cookie-banner__body a:focus-visible {
  outline: 2px solid #00478B;
  outline-offset: 2px;
}

.cookie-banner__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ----- Schaltflächen (alle gleichrangig) ----- */
.cookie-btn {
  padding: 11px 20px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.3;
  background: #FFFFFF;
  color: #00478B;
  border: 1px solid #00478B;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s ease, color 0.2s ease;
}
.cookie-btn:hover {
  background: #00478B;
  color: #FFFFFF;
}
.cookie-btn:focus-visible {
  outline: 2px solid #00478B;
  outline-offset: 2px;
}

/* ----- Einstellungen (Dialog) ----- */
.cookie-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(26, 26, 26, 0.7);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overscroll-behavior: contain;
}
.cookie-modal.is-active {
  display: flex;
}
.cookie-modal__inner {
  background: #FFFFFF;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 36px;
  border: 1px solid #6B7280;
  font-family: "Inter", "Inter Fallback", "Helvetica Neue", Arial, sans-serif;
}
.cookie-modal__title {
  font-family: "Cormorant Garamond", "Cormorant Garamond Fallback", "Times New Roman", Times, serif;
  font-size: 28px;
  font-weight: 500;
  margin: 0 0 14px;
  color: #1A1A1A;
  line-height: 1.15;
}
/* Programmatischer Fokus beim Öffnen; die Überschrift ist kein Bedienelement. */
.cookie-modal__title:focus {
  outline: none;
}
.cookie-modal__intro {
  font-size: 14px;
  line-height: 1.6;
  color: #4A4A4A;
  margin: 0 0 24px;
}

/* ----- Kategorien (Schalterliste) ----- */
.cookie-category {
  border-top: 1px solid #D1D5DB;
  padding: 18px 0;
}
.cookie-category:last-of-type {
  border-bottom: 1px solid #D1D5DB;
}
.cookie-category__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.cookie-category__title {
  font-weight: 600;
  font-size: 14px;
  color: #1A1A1A;
  flex: 1;
  letter-spacing: 0.01em;
}
.cookie-category__desc {
  font-size: 13px;
  line-height: 1.6;
  color: #4A4A4A;
  margin: 8px 0 0;
}
.cookie-category__note {
  font-size: 12px;
  font-style: italic;
  color: #4A4A4A;
  margin-top: 6px;
}

/* ----- Schalter (echtes Button-Element mit role="switch") ----- */
.cookie-toggle {
  width: 44px;
  height: 24px;
  background: #6B7280;
  border: 0;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.2s ease;
}
.cookie-toggle::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #FFFFFF;
  border-radius: 50%;
  transition: transform 0.2s ease;
}
.cookie-toggle[aria-checked="true"] {
  background: #00478B;
}
.cookie-toggle[aria-checked="true"]::before {
  transform: translateX(20px);
}
.cookie-toggle[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.6;
}
.cookie-toggle:focus-visible {
  outline: 2px solid #00478B;
  outline-offset: 3px;
}

/* ----- Aktionen im Dialog ----- */
.cookie-modal__actions {
  display: flex;
  gap: 10px;
  margin-top: 28px;
  flex-wrap: wrap;
}

/* ----- Fokusziel nach dem Schließen: Hauptinhalt (programmatischer Fokus,
   kein Bedienelement, daher ohne Rahmen um den ganzen Inhalt) ----- */
main[tabindex="-1"]:focus {
  outline: none;
}

/* ----- Footer-Link „Cookie-Einstellungen“ wie die übrigen Rechtslinks ----- */
.js-cookie-settings {
  cursor: pointer;
}

/* ----- Mobil ----- */
@media (max-width: 600px) {
  .cookie-banner {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 85vh;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 20px 16px;
    max-width: 100%;
  }
  .cookie-banner__actions,
  .cookie-modal__actions {
    flex-direction: column;
  }
  .cookie-btn {
    width: 100%;
    padding: 13px 20px;
  }
  .cookie-modal__inner {
    padding: 24px 20px;
  }
}

/* ----- Reduzierte Bewegung ----- */
@media (prefers-reduced-motion: reduce) {
  .cookie-banner,
  .cookie-btn,
  .cookie-toggle,
  .cookie-toggle::before {
    transition: none;
  }
  .cookie-banner {
    transform: none;
  }
}

/* ----- Erzwungene Farben (z. B. Kontrastmodus von Windows) ----- */
@media (forced-colors: active) {
  .cookie-toggle {
    forced-color-adjust: none;
    background: Canvas;
    border: 1px solid ButtonText;
  }
  .cookie-toggle::before {
    top: 1px;
    left: 1px;
    background: ButtonText;
  }
  .cookie-toggle[aria-checked="true"] {
    background: Highlight;
    border-color: Highlight;
  }
  .cookie-toggle[aria-checked="true"]::before {
    background: HighlightText;
  }
  .cookie-toggle:focus-visible {
    outline-color: Highlight;
  }
}

/* ----- Druck: Banner und Dialog nicht drucken ----- */
@media print {
  .cookie-banner,
  .cookie-modal {
    display: none !important;
  }
}
