/* Cookie-Consent-Banner + Einstellungen-Dialog -- Figma "ATZ 2026 - Zukunft".
   Markup:   web/templates/web/partials/_cookie_banner.html
   Verhalten: web/static/web/js/cookie-consent.js

   Mobile first: die Basis-Styles beschreiben die zentrierte Karte, die
   Media-Query (>=768px) baut daraus die Bottom-Bar. Sichtbar wird der Banner
   erst durch die Klasse --visible, die das JS setzt. */

:root {
  --cc-shaded: #F5F5F5;
  --cc-red-dark: #9C0720;
  --cc-red-tint: #FCEAED;
  --cc-switch-off: #D2D2D2;
}

/* ------------------------------------------------------- gemeinsame Teile */

.atz-cookie-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--cc-red-tint);
  color: var(--atz-red);
}

.atz-cookie-icon svg {
  width: 22px;
  height: 22px;
}

.atz-cookie-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 6px;
  background-color: transparent;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.atz-cookie-btn--primary {
  background-color: var(--atz-red);
  color: #fff;
}

.atz-cookie-btn--primary:hover {
  background-color: var(--cc-red-dark);
}

.atz-cookie-btn--outline {
  background-color: #fff;
  border-color: var(--atz-light-gray);
  color: var(--atz-dark);
}

.atz-cookie-btn--outline:hover {
  border-color: var(--atz-dark);
}

/* "Einstellungen" im Banner -- im Figma ohne Rahmen, nur grauer Text. */
.atz-cookie-btn--text {
  color: var(--atz-gray);
}

.atz-cookie-btn--text:hover {
  color: var(--atz-dark);
}

/* Ein Button, der wie ein Link aussieht ("Cookie-Details"): er öffnet den
   Dialog, führt also nirgendwohin -- darum <button> statt <a>. */
.atz-cookie-linkbtn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--atz-red);
  text-decoration: underline;
  cursor: pointer;
}

.atz-cookie-linkbtn:hover {
  color: var(--cc-red-dark);
}

.atz-cookie-btn:focus-visible,
.atz-cookie-linkbtn:focus-visible,
.atz-cookie-footerbtn:focus-visible,
.atz-cookie-dialog__close:focus-visible {
  outline: 2px solid var(--atz-red);
  outline-offset: 2px;
}

/* Widerrufs-Link im Copyright-Footer -- sieht aus wie die Links daneben. */
.atz-cookie-footerbtn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--atz-gray);
  cursor: pointer;
}

.atz-cookie-footerbtn:hover {
  color: var(--atz-dark);
}

/* ------------------------------------------------------------------ Banner */

.atz-cookie-banner {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1060;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background-color: rgba(61, 60, 63, 0.45);
}

.atz-cookie-banner--visible {
  display: flex;
}

.atz-cookie-banner__card {
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 24px;
  border-radius: 14px;
  background-color: #fff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.atz-cookie-banner__body {
  margin-top: 16px;
}

.atz-cookie-banner__title {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--atz-dark);
}

.atz-cookie-banner__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--atz-gray);
}

.atz-cookie-banner__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 14px 0 0;
  font-size: 14px;
}

.atz-cookie-banner__links a {
  font-weight: 600;
  color: var(--atz-red);
  text-decoration: underline;
}

.atz-cookie-banner__links a:hover {
  color: var(--cc-red-dark);
}

.atz-cookie-banner__sep {
  color: var(--atz-light-gray);
}

.atz-cookie-banner__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

/* ------------------------------------------------------------------ Dialog */

.atz-cookie-dialog {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 1070;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* Das JS schaltet den Dialog über das hidden-Attribut; ohne diese Regel
   würde das display: flex von oben es aushebeln. */
.atz-cookie-dialog[hidden] {
  display: none;
}

.atz-cookie-dialog__backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(61, 60, 63, 0.5);
}

.atz-cookie-dialog__panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 20px;
  border-radius: 16px;
  background-color: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

/* Griff-Andeutung wie im Figma-Mobile-Entwurf, auf Desktop ausgeblendet. */
.atz-cookie-dialog__grabber {
  display: block;
  width: 40px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background-color: var(--atz-light-gray);
}

.atz-cookie-dialog__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Auf Mobil zeigt das Figma nur den Titel, das Icon erst ab Desktop. */
.atz-cookie-dialog__head .atz-cookie-icon {
  display: none;
}

.atz-cookie-dialog__title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--atz-dark);
}

.atz-cookie-dialog__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--atz-gray);
  cursor: pointer;
}

.atz-cookie-dialog__close:hover {
  background-color: var(--cc-shaded);
  color: var(--atz-dark);
}

.atz-cookie-dialog__close svg {
  width: 18px;
  height: 18px;
}

.atz-cookie-dialog__desc {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--atz-gray);
}

.atz-cookie-dialog__meta {
  margin: 16px 0 0;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  color: var(--atz-gray);
}

.atz-cookie-dialog__meta a {
  color: var(--atz-gray);
  text-decoration: underline;
}

.atz-cookie-dialog__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

/* ------------------------------------------------------------- Kategorien */

.atz-cookie-cats {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.atz-cookie-cat {
  padding: 14px 16px;
  border-radius: 10px;
  background-color: var(--cc-shaded);
}

.atz-cookie-cat + .atz-cookie-cat {
  margin-top: 10px;
}

.atz-cookie-cat__head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.atz-cookie-cat__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--atz-dark);
}

.atz-cookie-cat__badge {
  padding: 3px 8px;
  border-radius: 999px;
  background-color: #E4F4E9;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--atz-green-dark);
}

.atz-cookie-cat__text {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--atz-gray);
}

/* --------------------------------------------------------- Toggle-Switch */

/* Natives <input type="checkbox"> mit eigener Optik: die Checkbox liegt
   unsichtbar über dem Schalter, behält aber Tastaturbedienung, Fokus und
   den Zustand für Screenreader. */
.atz-cookie-switch {
  position: relative;
  display: inline-flex;
  flex: none;
  margin-left: auto;
}

.atz-cookie-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.atz-cookie-switch__track {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background-color: var(--cc-switch-off);
  transition: background-color 0.15s ease-in-out;
  /* Ohne das faengt der Track (steht im DOM nach der Checkbox, liegt also
     optisch oben) Klicks ab, bevor sie die eigentliche Checkbox erreichen --
     das Toggle liess sich dadurch nicht bedienen. */
  pointer-events: none;
}

.atz-cookie-switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease-in-out;
}

.atz-cookie-switch input:checked + .atz-cookie-switch__track {
  background-color: var(--atz-green);
}

.atz-cookie-switch input:checked + .atz-cookie-switch__track::after {
  transform: translateX(20px);
}

.atz-cookie-switch input:focus-visible + .atz-cookie-switch__track {
  outline: 2px solid var(--atz-red);
  outline-offset: 2px;
}

/* "Notwendig": an, aber nicht abschaltbar -- darum grau statt grün. */
.atz-cookie-switch--locked input {
  cursor: not-allowed;
}

.atz-cookie-switch--locked input:checked + .atz-cookie-switch__track {
  background-color: #BFBFBF;
}

/* Auf Papier haben Einwilligungs-Overlays nichts zu suchen (wie .modal in
   base.css). */
@media print {
  .atz-cookie-banner,
  .atz-cookie-dialog {
    display: none !important;
  }
}

/* ------------------------------------------------------- Desktop (>=768px) */

@media (min-width: 768px) {
  .atz-cookie-banner {
    inset: auto 0 0 0;
    padding: 0;
    background-color: transparent;
  }

  .atz-cookie-banner__card {
    display: flex;
    align-items: center;
    gap: 24px;
    max-width: none;
    max-height: none;
    overflow: visible;
    padding: 20px 32px;
    border-top: 1px solid var(--atz-light-gray);
    border-radius: 0;
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.1);
  }

  .atz-cookie-banner__body {
    flex: 1 1 auto;
    margin-top: 0;
  }

  .atz-cookie-banner__links {
    margin-top: 10px;
  }

  .atz-cookie-banner__actions {
    flex-direction: row-reverse;
    align-items: center;
    gap: 12px;
    margin-top: 0;
  }

  .atz-cookie-dialog__grabber {
    display: none;
  }

  .atz-cookie-dialog__head .atz-cookie-icon {
    display: inline-flex;
  }

  .atz-cookie-dialog__panel {
    max-width: 640px;
    padding: 28px;
  }

  .atz-cookie-dialog__actions {
    flex-direction: row-reverse;
    justify-content: flex-start;
  }
}
