/**
 * @file
 * Consent dialog styling for Klaro — Messe KOMMUNAL.
 *
 * Design intent: a calm, trustworthy privacy card that looks deliberately
 * made, not like a default cookie box. Light surface, slate ink, a single
 * amber brand accent (#e29f00, shared by both subthemes). The one signature
 * is the amber keyline crowning the card plus crisp brand toggles; everything
 * else stays quiet. Accessibility-first: dark text on amber (white on amber
 * fails contrast), toggles moved to the right, "reject" as prominent as
 * "accept", visible focus, reduced-motion respected.
 *
 * Klaro renders a fixed DOM and colours many properties through CSS custom
 * properties that its "light" theme sets inline; where that would override us
 * we set the property directly (occasionally !important) rather than the var.
 */

.klaro {
  --kk-surface: #ffffff;
  --kk-surface-2: #f7f4ee;       /* expanded service panel / row hover */
  --kk-ink: #25303b;             /* headings */
  --kk-body: #444c55;            /* paragraph + service titles */
  --kk-muted: #79808a;           /* descriptions, captions */
  --kk-accent: #e29f00;          /* brand */
  --kk-accent-strong: #b07f04;   /* hover / pressed */
  --kk-on-accent: #241b05;       /* text on amber — dark for contrast */
  --kk-line: #e8e4da;            /* hairlines */
  --kk-track: #cfcabe;           /* toggle off */
  --kk-backdrop: rgba(20, 25, 31, 0.62);
}

/* ---- Backdrop ---------------------------------------------------------- */
.klaro .cookie-modal .cm-bg {
  background: var(--kk-backdrop);
  backdrop-filter: blur(2px);
}

/* ---- Card -------------------------------------------------------------- */
.klaro .cookie-modal .cm-modal.cm-klaro {
  max-width: 600px;
  max-height: min(90vh, 860px);
  display: flex;
  flex-direction: column;
  background: var(--kk-surface) !important;
  color: var(--kk-body) !important;
  border-radius: 0;
  border-top: 4px solid var(--kk-accent);   /* signature keyline */
  box-shadow: 0 24px 60px -18px rgba(20, 25, 31, 0.45);
  overflow: hidden;
}
.klaro .cookie-modal .cm-modal.cm-klaro,
.klaro .cookie-modal .cm-modal .cm-header,
.klaro .cookie-modal .cm-modal .cm-body,
.klaro .cookie-modal .cm-modal .cm-footer { box-sizing: border-box; }
.klaro .cookie-modal .cm-modal .cm-header,
.klaro .cookie-modal .cm-modal .cm-footer { flex: 0 0 auto; }
.klaro .cookie-modal .cm-modal .cm-body { flex: 1 1 auto; overflow-y: auto; }
/* Fade only — Klaro centres the card with transform: translateY(-50%);
   animating transform here would clobber that and drop the card off-screen. */
@media (prefers-reduced-motion: no-preference) {
  .klaro .cookie-modal .cm-modal.cm-klaro {
    animation: kk-fade 0.28s ease both;
  }
}
@keyframes kk-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---- Header ------------------------------------------------------------ */
.klaro .cookie-modal .cm-modal .cm-header {
  padding: 1.6rem 1.85rem 1.1rem;
  border-bottom: 1px solid var(--kk-line);
}
.klaro .cookie-modal .cm-modal .cm-header h1.title {
  margin: 0;
  padding-right: 1.5rem;
  font-size: 1.4rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--kk-ink);
}
.klaro .cookie-modal .cm-modal .hide svg { stroke: var(--kk-muted); }

/* ---- Body & intro ------------------------------------------------------ */
.klaro .cookie-modal .cm-modal .cm-body { padding: 1.25rem 1.85rem 0.5rem; }
.klaro .cookie-modal .cm-modal .cm-body > p {
  margin: 0 0 1.25rem;
  font-size: 0.94rem;
  line-height: 1.62;
  color: var(--kk-body);
}
.klaro .cookie-modal .cm-modal .cm-body a,
.klaro .cookie-modal .cm-modal .cm-footer a {
  color: var(--kk-accent-strong);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---- Purpose / service rows: toggle on the right ----------------------- */
.klaro .cookie-modal .cm-modal .cm-body ul.cm-purposes,
.klaro .cookie-modal .cm-modal .cm-body ul.cm-services { margin: 0; padding: 0; }

/* Klaro pins these rows with a 60px LEFT gutter for its left-side toggle and,
   at higher specificity than a plain .cm-body li selector, would also win the
   `position`. Match its specificity (include ul.cm-purposes/ul.cm-services) so
   we reliably: reset the left gutter, reserve room on the RIGHT, and make the
   row itself the positioning context — otherwise the absolutely placed switch
   escapes to the card and is clipped at its right edge. */
.klaro .cookie-modal .cm-modal .cm-body ul.cm-purposes li.cm-purpose,
.klaro .cookie-modal .cm-modal .cm-body ul.cm-services li.cm-service {
  position: relative;
  padding: 1rem 80px 1rem 0;
  min-height: 0;
  line-height: 1.45;
  border-top: 1px solid var(--kk-line);
}
.klaro .cookie-modal .cm-modal .cm-body ul.cm-purposes > li.cm-purpose:first-child {
  border-top: 0;
}
/* Move the switch + its invisible input from the left gutter to the right.
   Use a descendant match: in service rows Klaro wraps the input in an extra
   <div>, so a child (>) combinator would miss it. */
.klaro .cookie-modal .cm-modal .cm-body .cm-list-input,
.klaro .cookie-modal .cm-modal .cm-body .cm-list-label .cm-switch {
  left: auto;
  right: 2.5rem;
  top: 1rem;
}

.klaro .cookie-modal .cm-modal .cm-body .cm-list-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--kk-ink);
}
.klaro .cookie-modal .cm-modal .cm-body li.cm-service .cm-list-title {
  font-weight: 600;
  color: var(--kk-body);
}
.klaro .cookie-modal .cm-modal .cm-body .cm-list-description {
  margin-top: 0.2rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--kk-muted);
}

/* "N Dienste" disclosure + expanded panel */
.klaro .cookie-modal .cm-modal .cm-body li.cm-purpose .cm-services {
  display: block;
  margin-top: 0.55rem;
}
.klaro .cookie-modal .cm-modal .cm-body li.cm-purpose .cm-services .cm-caret a {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--kk-accent-strong);
  text-decoration: none;
}
.klaro .cookie-modal .cm-modal .cm-body li.cm-purpose .cm-services .cm-caret a:hover {
  text-decoration: underline;
}
.klaro .cookie-modal .cm-modal .cm-body li.cm-purpose .cm-services .cm-content.expanded {
  margin: 0.65rem -48px 0 0;  /* partially offset .cm-purpose padding-right to push nested toggles right of the description */
  padding: 0.25rem 0;
}
.klaro .cookie-modal .cm-modal .cm-body .cm-content li.cm-service {
  padding-top: 0.85rem;
  padding-right: 6rem;
  padding-bottom: 0.85rem;
}
.klaro .cookie-modal .cm-modal .cm-body .cm-content li.cm-service:first-child { border-top: 0; }

/* Hide the global "toggle all services" row — the footer buttons do this. */
.klaro .cookie-modal .cm-modal .cm-body li.cm-purpose.cm-toggle-all { display: none; }

/* ---- Toggle switch ----------------------------------------------------- */
.klaro .cookie-modal .cm-modal .cm-list-label .slider {
  background: var(--kk-track) !important;
  box-shadow: none;
}
.klaro .cookie-modal .cm-modal .cm-list-label .slider::before {
  background: #ffffff !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}
.klaro .cookie-modal .cm-modal .cm-list-input:checked + .cm-list-label .slider {
  background: var(--kk-accent) !important;
  opacity: 1;
}
/* Required / always-on services: amber but visibly locked. */
.klaro .cookie-modal .cm-modal .cm-list-input.only-required + .cm-list-label .slider,
.klaro .cookie-modal .cm-modal .cm-list-input.required:checked + .cm-list-label .slider {
  background: var(--kk-accent) !important;
  opacity: 0.45;
}
.klaro .cookie-modal .cm-modal .cm-list-input:focus-visible + .cm-list-label .slider {
  outline: 2px solid var(--kk-accent-strong);
  outline-offset: 2px;
  box-shadow: none;
}

/* ---- Footer & buttons -------------------------------------------------- */
.klaro .cookie-modal .cm-modal .cm-footer {
  padding: 1.2rem 1.85rem 1.4rem;
  border-top: 1px solid var(--kk-line);
}
.klaro .cookie-modal .cm-modal .cm-footer-buttons {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}
.klaro .cookie-modal .cm-modal .cm-btn {
  margin: 0;
  padding: 0.62rem 1.25rem;
  border-radius: 0;
  border: 1.5px solid transparent;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-shadow: none;
  box-shadow: none;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

/* Klaro shares .cm-btn-success between "accept all" and "save", so target the
   unambiguous semantic classes (accept-all / accept / decline) instead. */

/* Accept all — filled amber, dark text (contrast). */
.klaro .cookie-modal .cm-modal .cm-btn.cm-btn-accept-all {
  background: var(--kk-accent) !important;
  border: 1.5px solid!important;
  border-color: var(--kk-accent);
  color: var(--kk-on-accent) !important;
}
.klaro .cookie-modal .cm-modal .cm-btn.cm-btn-accept-all:hover {
  background: var(--kk-accent-strong) !important;
  border: 1.5px solid!important;
  border-color: var(--kk-accent-strong);
}

/* Reject all — equally available outline (slate). */
.klaro .cookie-modal .cm-modal .cm-btn.cm-btn-decline {
  margin-right: auto;          /* pin to the left of the row */
  background: transparent !important;
  border-color: #c7ccd2!important;
  border: 1.5px solid!important;
  color: var(--kk-ink) !important;
}
.klaro .cookie-modal .cm-modal .cm-btn.cm-btn-decline:hover {
  background: #f1f0ec !important;
  border-color: var(--kk-ink);
}

/* Save selection — quiet tertiary option (also carries .cm-btn-info). */
.klaro .cookie-modal .cm-modal .cm-btn.cm-btn-accept {
  background: transparent !important;
  border: 1.5px solid transparent !important;
  color: var(--kk-accent-strong) !important;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.klaro .cookie-modal .cm-modal .cm-btn.cm-btn-accept:hover {
  border: 1.5px solid transparent !important;
  color: var(--kk-ink) !important;
}

/* ---- Focus (keyboard) -------------------------------------------------- */
.klaro .cookie-modal .cm-modal .cm-btn:focus-visible,
.klaro .cookie-modal .cm-modal a:focus-visible {
  outline: 2px solid var(--kk-accent-strong);
  outline-offset: 2px;
}

/* ---- Floating "privacy settings" reopen button ------------------------- */
.klaro_toggle_dialog {
  border: 1px solid var(--kk-line);
  box-shadow: 0 6px 16px rgba(20, 25, 31, 0.18);
}

/* ---- Mobile: bottom sheet, stacked buttons ----------------------------- */
@media (max-width: 640px) {
  /* Pin the card to the viewport as a bottom sheet; left/right/bottom kill
     the desktop centering that otherwise overflows a narrow screen. */
  .klaro .cookie-modal .cm-modal.cm-klaro {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: auto;
    max-width: 100%;
    margin: 0;
    transform: none;
    max-height: 90vh;
  }
  .klaro .cookie-modal .cm-modal .cm-header,
  .klaro .cookie-modal .cm-modal .cm-body,
  .klaro .cookie-modal .cm-modal .cm-footer { padding-left: 1.25rem; padding-right: 1.25rem; }
  .klaro .cookie-modal .cm-modal .cm-body li.cm-purpose,
  .klaro .cookie-modal .cm-modal .cm-body li.cm-service { padding-right: 70px; }
  .klaro .cookie-modal .cm-modal .cm-body .cm-list-input,
  .klaro .cookie-modal .cm-modal .cm-body .cm-list-label .cm-switch { right: 1.75rem; }
  .klaro .cookie-modal .cm-modal .cm-footer-buttons { flex-direction: column-reverse; }
  .klaro .cookie-modal .cm-modal .cm-btn { width: 100%; text-align: center; }
  .klaro .cookie-modal .cm-modal .cm-btn.cm-btn-decline { margin-right: 0; }
}
