/*!
 * ci-template-webseite – Cookie-Banner / Einwilligungsverwaltung
 * Wird nur geladen, wenn Config\Consent aktiv ist (.env consent.enabled).
 * Banner und Dialog haben feste Farben (unabhängig von den Kontrastmodi), Platzhalter nutzen die Design-Tokens.
 */

/* ---------- Banner ---------- */
.consent-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
  max-height: 80vh; overflow-y: auto;
  color: #1a1a2e; background: #fff;
  border-top: 3px solid var(--ui-primary); box-shadow: 0 -10px 40px rgb(0 0 0 / 18%);
  font-size: 15px; line-height: 1.55;
}
.consent-banner[hidden] { display: none; }
body.menu-open .consent-banner { display: none; }
/* Platz am Seitenende, damit der Banner den Fußbereich nicht dauerhaft verdeckt */
body.consent-open { padding-bottom: var(--consent-offset, 0px); }
.consent-banner__inner {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 40px; align-items: center;
  max-width: var(--container, 1180px); margin: 0 auto; padding: 20px var(--gutter, 24px);
}
.consent-banner__title { margin: 0 0 6px; color: #1a1a2e; font-size: 18px; font-weight: 700; line-height: 1.3; }
.consent-banner p { margin: 0 0 8px; color: #333a48; }
.consent-banner__links { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0; font-size: 14px; }
.consent-banner a, .consent-dialog a { color: #a8362a; text-decoration: underline; text-underline-offset: 3px; }
.consent-banner :is(strong, b, code), .consent-dialog :is(strong, b, code) { color: inherit; }
.consent-banner__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

@media (max-width: 900px) {
  .consent-banner__inner { grid-template-columns: minmax(0, 1fr); padding-block: 16px; }
  .consent-banner__actions { justify-content: stretch; }
  .consent-banner__actions .consent-btn { flex: 1 1 160px; }
}

/* ---------- Buttons ---------- */
.consent-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; margin: 0;
  color: var(--ui-primary); background: #fff; border: 2px solid var(--ui-primary); border-radius: 10px;
  font-family: inherit; font-size: 15px; font-weight: 700; line-height: 1.2; text-align: center; cursor: pointer;
}
.consent-btn:hover { background: #eef1f6; }
.consent-btn--solid { color: #fff; background: var(--ui-primary); }
.consent-btn--solid:hover { background: #1a2232; }
.consent-btn:focus-visible, .consent-icon-btn:focus-visible, .consent-switch:focus-visible, .consent-details summary:focus-visible,
.consent-banner a:focus-visible, .consent-dialog a:focus-visible { outline: 3px solid var(--ui-focus); outline-offset: 2px; }

/* ---------- Dialog ---------- */
.consent-dialog {
  width: min(660px, calc(100% - 24px)); max-width: 100%; max-height: min(92vh, 960px);
  margin: auto; padding: 0; border: 0; border-radius: 16px; overflow: hidden;
  color: #1a1a2e; background: #fff; box-shadow: 0 20px 60px rgb(0 0 0 / 35%);
  font: 400 15.5px/1.55 "Lato", "Helvetica Neue", Arial, sans-serif; text-align: left; letter-spacing: normal;
}
.consent-dialog[open] { display: flex; flex-direction: column; }
.consent-dialog::backdrop { background: rgb(15 20 30 / 55%); }
.consent-dialog .icon { flex: none; width: 20px; height: 20px; }
.consent-dialog__head { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 16px 20px; color: #fff; background: var(--ui-primary); }
.consent-dialog__title { margin: 0; color: #fff; font-size: 20px; font-weight: 700; line-height: 1.3; }
.consent-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0;
  color: #fff; background: transparent; border: 1px solid rgb(255 255 255 / 55%); border-radius: 10px; cursor: pointer;
}
.consent-icon-btn:hover { background: rgb(255 255 255 / 12%); }
.consent-dialog__head :focus-visible { outline-color: #ff8478; }
.consent-dialog__body { flex: 1; overflow-y: auto; padding: 18px 20px 8px; overscroll-behavior: contain; }
.consent-dialog__body > p { margin: 0 0 16px; }
.consent-dialog__foot { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; padding: 14px 20px 16px; background: #f5f6f8; border-top: 1px solid #d5d9e1; }

.consent-group { margin: 0 0 16px; padding: 14px 16px; background: #f5f6f8; border: 1px solid #d5d9e1; border-radius: 12px; }
.consent-group__head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.consent-group h3 { margin: 0; color: #1a1a2e; font-size: 16px; font-weight: 700; line-height: 1.3; }
.consent-group p { margin: 0 0 10px; color: #333a48; font-size: 14.5px; }
.consent-badge { padding: 3px 10px; color: #00594d; background: #dff1ed; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.consent-list { margin: 0; padding-left: 1.2em; color: #333a48; font-size: 14px; }
.consent-list li { margin-bottom: 4px; }

.consent-service { margin-top: 10px; padding: 12px 14px; background: #fff; border: 1px solid #d5d9e1; border-radius: 10px; }
.consent-service__head { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.consent-service__name { display: inline-flex; gap: 8px; align-items: center; color: #1a1a2e; font-weight: 700; cursor: pointer; }
.consent-service__name .icon { color: var(--ui-primary); }
.consent-service__purpose { margin: 6px 0 4px !important; }

.consent-switch {
  appearance: none; -webkit-appearance: none; position: relative; flex: none;
  width: 52px; height: 30px; margin: 0; background: #fff; border: 2px solid #4b5263; border-radius: 999px; cursor: pointer;
}
.consent-switch::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  background: #4b5263; border-radius: 50%; transition: transform .15s;
}
.consent-switch:checked { background: #00695c; border-color: #00695c; }
.consent-switch:checked::before { background: #fff; transform: translateX(22px); }

.consent-details summary { display: inline-block; margin-top: 2px; color: var(--ui-primary); font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.consent-details dl { display: grid; grid-template-columns: minmax(0, 11em) minmax(0, 1fr); gap: 6px 14px; margin: 10px 0 4px; font-size: 13.5px; }
.consent-details dt { color: #4b5263; font-weight: 700; }
.consent-details dd { margin: 0; color: #333a48; }
.consent-meta { margin: 6px 0 12px; color: #4b5263; font-size: 13px; }
.consent-meta code { font-size: 12.5px; overflow-wrap: anywhere; }

@media (max-width: 560px) {
  .consent-dialog { width: 100%; max-height: 100%; height: 100%; border-radius: 0; }
  .consent-dialog__foot .consent-btn { flex: 1 1 100%; }
  .consent-details dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .consent-details dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .consent-switch::before { transition: none; }
}

/* ---------- Footer-Link ---------- */
.consent-footer-btn { padding: 0; color: inherit; background: none; border: 0; font: inherit; text-decoration: none; cursor: pointer; }
.consent-footer-btn:hover { text-decoration: underline; }
.consent-footer-btn[hidden] { display: none; }
.site-footer .consent-footer-btn { color: rgb(var(--on-dark-rgb, 255 255 255) / 88%); }

/* ---------- Platzhalter für externe Inhalte (Seiteninhalt, nutzt die Design-Tokens) ---------- */
.embed { overflow: hidden; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; }
.embed__placeholder { display: grid; justify-items: start; gap: 10px; padding: 20px; color: var(--muted); font-size: .9rem; }
.embed__placeholder p { margin: 0; }
.embed__icon { width: 28px; height: 28px; color: var(--teal-strong); }
.embed__heading { color: var(--ink); font-size: 1.05rem; font-weight: 700; }
.embed__actions { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.embed__actions[hidden] { display: none; }
.embed__always { display: inline-flex; gap: 8px; align-items: center; color: var(--text); }
.embed__always input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-strong); }
.embed iframe { display: block; width: 100%; border: 0; }
.embed--map iframe { height: 300px; }
.embed--video.is-loaded { aspect-ratio: 16 / 9; }
.embed--video.is-loaded iframe { height: 100%; }

@media print {
  .consent-banner, .consent-dialog { display: none !important; }
}
