/* ==========================================================================
   Ofira.app — Consent-Banner & Einstellungs-Dialog
   Reine Klassen + Tokens (CSP style-src 'self', keine Inline-Styles).
   ========================================================================== */

.consent[hidden] { display: none; }

.consent__backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(7, 11, 22, 0.55);
}
.consent__backdrop[hidden] { display: none; }

/* Grundform der beiden Ebenen (Banner + Dialog) */
.consent__box {
  position: fixed;
  z-index: 1001;
  background: var(--color-surface);
  color: var(--color-text-default);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-lg);
  width: min(560px, calc(100vw - 2 * var(--gutter-mobile)));
}
.consent__box[hidden] { display: none; }

/* Erste Ebene: ruhiges Sheet unten links */
.consent__banner {
  left: var(--gutter);
  bottom: var(--gutter);
}

/* Zweite Ebene: zentrierter Dialog */
.consent__dialog {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-height: calc(100vh - 2 * var(--gutter));
  overflow-y: auto;
}

.consent__title {
  font-size: var(--fs-h3);
  line-height: var(--lh-h3);
  letter-spacing: var(--ws-h3);
  color: var(--color-text-strong);
  margin: 0 0 var(--space-sm);
}

.consent__text {
  font-size: var(--fs-note);
  line-height: var(--lh-note);
  color: var(--color-text-default);
  margin: 0 0 var(--space-md);
}
.consent__text a { color: var(--color-link); }
.consent__text a:hover { color: var(--color-link-hover); }

/* --- Aktionen ------------------------------------------------------------ */
.consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: flex-end;
  align-items: center;
}

/* Buttons nutzen die globalen .btn-Klassen (btn--primary/--secondary),
   damit sie identisch zur übrigen Website dargestellt werden.
   „Alle akzeptieren"/„Alle ablehnen" sind beide btn--primary (Gleichwertigkeit). */

/* „Einstellungen" nach links schieben; die Entscheidungen bleiben rechts gruppiert */
.consent__more { margin-right: auto; }

/* Fokus liegt beim Öffnen auf dem Dialog-Container (Screenreader-Ansage),
   ohne sichtbaren Fokusrahmen. */
.consent__banner:focus,
.consent__dialog:focus { outline: none; }

.consent__text a:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* --- Kategorien (Einstellungs-Dialog) ------------------------------------ */
.consent__cat {
  border-top: 1px solid var(--color-border);
  padding: var(--space-md) 0;
}
.consent__cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}
.consent__cat-name {
  font-weight: var(--fw-bold);
  color: var(--color-text-strong);
}
.consent__cat-desc {
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  color: var(--color-text-muted);
  margin: var(--space-xs) 0 0;
}

/* Schalter (rein visuell; die Checkbox bleibt bedienbar) */
.consent__switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
}
.consent__switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.consent__switch-track {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: var(--navy-300);
  transition: background-color var(--motion-fast) var(--easing);
}
.consent__switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
  transition: transform var(--motion-fast) var(--easing);
}
.consent__switch input:checked + .consent__switch-track { background: var(--color-action); }
.consent__switch input:checked + .consent__switch-track::after { transform: translateX(18px); }
.consent__switch input:disabled + .consent__switch-track { background: var(--navy-200); }
.consent__switch input:focus-visible + .consent__switch-track {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
.consent__cat-state {
  font-size: var(--fs-small);
  color: var(--color-text-muted);
}

/* --- Footer-Link (Cookie-Einstellungen erneut öffnen) --------------------
   Übernimmt exakt die Typografie der übrigen Footer-Links (.footer li a). */
.footer__linkbtn {
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
  font-size: var(--fs-small);
  line-height: var(--lh-note);
  color: var(--navy-200);
  cursor: pointer;
  text-align: left;
}
.footer__linkbtn:hover { color: var(--color-on-dark); }

/* --- Einblenden ---------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .consent__box {
    animation: consent-in var(--motion-medium) var(--easing) both;
  }
  @keyframes consent-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .consent__dialog {
    animation: consent-dialog-in var(--motion-medium) var(--easing) both;
  }
  @keyframes consent-dialog-in {
    from { opacity: 0; transform: translate(-50%, calc(-50% + 8px)); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
  }
}

@media (max-width: 576px) {
  .consent__banner {
    left: var(--gutter-mobile);
    right: var(--gutter-mobile);
    bottom: var(--gutter-mobile);
    width: auto;
  }
  .consent__actions .btn { flex: 1 1 auto; }
  .consent__more { margin-right: 0; flex-basis: 100%; }
}
