/* ==========================================================================
   SchreibAtelier – Schlanker Cookie-Consent-Banner
   Eigenbau-Ersatz für Real Cookie Banner
   ==========================================================================
   Alle Marken-Farben stehen zentral als CSS-Variablen hier oben.
   Passe die Hex-Werte an dein Brand Guide an, falls sie nicht exakt
   stimmen – der Rest der Datei muss dafür nicht angefasst werden.
   ========================================================================== */

:root {
  --sa-cc-aubergine-900: #3d1836;   /* dunkelste Akzentfarbe, Titel */
  --sa-cc-aubergine-700: #5c2a52;   /* Primärbutton */
  --sa-cc-aubergine-800: #4a2142;   /* Primärbutton :hover */
  --sa-cc-neutral-100: #ffffff;     /* Ghost-Button-Hintergrund (weiß) */
  --sa-cc-border: #e6dee3;          /* helles Aubergine-Grau für Ränder/Trennlinien, damit sie auf Weiß sichtbar bleiben */
  --sa-cc-text: #2e2430;            /* Fließtext */
  --sa-cc-text-muted: #6e6169;      /* Sekundärtext */
  --sa-cc-white: #ffffff;

  --sa-cc-radius: 18px;
  --sa-cc-radius-sm: 10px;
  --sa-cc-shadow: 0 16px 40px rgba(61, 24, 54, 0.16), 0 2px 8px rgba(61, 24, 54, 0.08);
  --sa-cc-font: inherit; /* übernimmt automatisch die (lokal gehostete) Schrift deiner Seite */
  --sa-cc-z: 999999;
}

/* --------------------------------------------------------------------
   Banner (schlanke Karte)
   -------------------------------------------------------------------- */

.sa-cc {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: center;
  padding: 0 clamp(10px, 4vw, 16px);
  z-index: var(--sa-cc-z);
  font-family: var(--sa-cc-font);
  pointer-events: none; /* Klicks fallen durch, außer auf die Karte selbst */
}

.sa-cc[hidden] {
  display: none;
}

.sa-cc__card {
  pointer-events: auto;
  width: 100%;
  max-width: 440px;
  background: var(--sa-cc-white);
  border-radius: var(--sa-cc-radius);
  box-shadow: var(--sa-cc-shadow);
  padding: clamp(14px, 4vw, 22px) clamp(16px, 5vw, 24px) clamp(12px, 3.5vw, 20px);
  animation: sa-cc-in 0.35s ease-out;
}

@keyframes sa-cc-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sa-cc__card {
    animation: none;
  }
}

.sa-cc__title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 clamp(3px, 1vw, 8px);
  font-size: clamp(14px, 3.8vw, 16px);
  line-height: 1.3;
  font-weight: 700;
  color: var(--sa-cc-aubergine-900);
}

.sa-cc__title svg {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--sa-cc-aubergine-700);
}

.sa-cc__text {
  margin: 0 0 clamp(10px, 3vw, 16px);
  font-size: clamp(12.5px, 3.4vw, 14px);
  line-height: 1.45;
  color: var(--sa-cc-text);
}

.sa-cc__link {
  color: var(--sa-cc-aubergine-700);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sa-cc__link:hover {
  color: var(--sa-cc-aubergine-800);
}

.sa-cc__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------
   Buttons (geteilt zwischen Banner & Einstellungen-Modal)
   -------------------------------------------------------------------- */

.sa-cc__btn {
  appearance: none;
  border: 1.5px solid transparent;
  border-radius: var(--sa-cc-radius-sm);
  padding: clamp(8px, 2.2vw, 10px) clamp(13px, 3.5vw, 18px);
  font-family: inherit;
  font-size: clamp(12px, 3.2vw, 13.5px);
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.sa-cc__btn:active {
  transform: translateY(1px);
}

.sa-cc__btn:focus-visible {
  outline: 2px solid var(--sa-cc-aubergine-700);
  outline-offset: 2px;
}

.sa-cc__btn--ghost {
  background: var(--sa-cc-neutral-100);
  border-color: var(--sa-cc-border);
  color: var(--sa-cc-aubergine-900);
}

.sa-cc__btn--ghost:hover {
  background: var(--sa-cc-border);
}

.sa-cc__btn--solid {
  background: var(--sa-cc-aubergine-700);
  color: var(--sa-cc-white);
}

.sa-cc__btn--solid:hover {
  background: var(--sa-cc-aubergine-800);
}

.sa-cc__btn--text {
  background: transparent;
  border-color: transparent;
  color: var(--sa-cc-text-muted);
  padding: 10px 12px;
}

.sa-cc__btn--text:hover {
  color: var(--sa-cc-aubergine-900);
}

/* --------------------------------------------------------------------
   Einstellungen-Modal
   -------------------------------------------------------------------- */

.sa-cc-modal {
  position: fixed;
  inset: 0;
  z-index: calc(var(--sa-cc-z) + 1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: var(--sa-cc-font);
}

.sa-cc-modal[hidden] {
  display: none;
}

.sa-cc-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(61, 24, 54, 0.45);
  backdrop-filter: blur(2px);
}

.sa-cc-modal__panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--sa-cc-white);
  border-radius: var(--sa-cc-radius);
  box-shadow: var(--sa-cc-shadow);
  padding: clamp(18px, 5vw, 28px) clamp(16px, 4.5vw, 26px) clamp(16px, 4vw, 24px);
  animation: sa-cc-in 0.25s ease-out;
}

.sa-cc-modal__title {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 700;
  color: var(--sa-cc-aubergine-900);
}

.sa-cc-modal__intro {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--sa-cc-text-muted);
}

.sa-cc-category {
  border: 1px solid var(--sa-cc-border);
  border-radius: var(--sa-cc-radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.sa-cc-category__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sa-cc-category__name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--sa-cc-text);
}

.sa-cc-category__badge {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--sa-cc-text-muted);
  margin-top: 1px;
}

.sa-cc-category__desc {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--sa-cc-text-muted);
}

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

.sa-cc-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 24px;
  flex: none;
}

.sa-cc-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.sa-cc-switch__slider {
  position: absolute;
  inset: 0;
  background: var(--sa-cc-border);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.sa-cc-switch__slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: var(--sa-cc-white);
  border-radius: 50%;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.sa-cc-switch input:checked + .sa-cc-switch__slider {
  background: var(--sa-cc-aubergine-700);
}

.sa-cc-switch input:checked + .sa-cc-switch__slider::before {
  transform: translateX(16px);
}

.sa-cc-switch input:focus-visible + .sa-cc-switch__slider {
  outline: 2px solid var(--sa-cc-aubergine-700);
  outline-offset: 2px;
}

.sa-cc-switch--disabled .sa-cc-switch__slider {
  cursor: not-allowed;
  opacity: 0.7;
}

.sa-cc-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

/* --------------------------------------------------------------------
   "Cookie-Einstellungen" Wiederaufruf-Link (z. B. im Footer)
   -------------------------------------------------------------------- */

.sa-cc-reopen-link {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------- */

@media (max-width: 480px) {
  .sa-cc__actions {
    justify-content: stretch;
  }
  .sa-cc__btn {
    flex: 1 1 auto;
    text-align: center;
  }
}

/* Sehr kleine/alte Displays (z. B. iPhone SE 1. Generation, 320px breit):
   Titel und Icon in eine noch kompaktere Zeile zwingen, Card enger */
@media (max-width: 340px) {
  .sa-cc__title {
    font-size: 13px;
  }
  .sa-cc__text {
    font-size: 12px;
  }
}
