/* cookie-banner.css — Eigenbau-Cookie-Banner (Plan 06-05, LEGAL-04, Redesign 2026-07-13).
 *
 * TDDDG § 25 Abs. 1 konform:
 *   - Reject + Accept gleichwertig styled (gleiche Grösse, gleiche Prominenz)
 *   - Kein Dark-Pattern (kein "Accept" als grosser Primary, "Reject" als Link)
 *   - Granulare Kategorien-Wahl (Notwendig / Analyse / Marketing)
 *   - "Widerruf so einfach wie Zustimmung" via Footer-Button (Art. 7 Abs. 3 DSGVO)
 *
 * UX-Redesign 2026-07-13:
 *   - Zentrierte Card (max-width 640px kompakt / 720px Details) unten mittig
 *   - Klarer Titel, kurzer Fliesstext, 3 gleichwertige Buttons
 *   - Details-View: 3 Kategorien mit Toggle-Switch statt Checkbox (moderner Look)
 *   - Mobile: Card wird zur Bottom-Sheet, volle Breite mit Padding
 */

#cookie-banner {
  position: fixed;
  left: 50%;
  bottom: clamp(1rem, 3vw, 2rem);
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  max-width: 640px;
  background: var(--brand-bg-white, #ffffff);
  color: var(--brand-text-main, #0A0A0A);
  padding: clamp(1.25rem, 3vw, 1.75rem) clamp(1.25rem, 3vw, 2rem);
  border-radius: clamp(16px, 2vw, 20px);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(0, 0, 0, 0.04);
  z-index: 9999;
  font-family: inherit;
  animation: cb-slide-in var(--dur-slow, 0.4s) var(--ease-out, ease-out) both;
}

#cookie-banner.is-details-open {
  max-width: 720px;
}

@keyframes cb-slide-in {
  from { opacity: 0; transform: translate(-50%, 30px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  #cookie-banner { animation: none; }
}

/* ─── Kompakt-Ansicht ─────────────────────────────────────────────────── */

#cookie-banner .cb-title {
  margin: 0 0 0.4rem 0;
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--brand-text-main, #0A0A0A);
}

#cookie-banner .cb-intro {
  margin: 0 0 1.25rem 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--brand-text-light, #4a4a4a);
  max-width: none;
}

#cookie-banner .cb-intro a {
  color: var(--brand-accent, #C5A572);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
}

#cookie-banner .cb-intro a:hover {
  color: var(--brand-accent-strong, #a68b58);
}

/* Actions-Row: 3 Buttons nebeneinander (Desktop) / gestapelt (Mobile).
   TDDDG-konform: alle drei gleiche Prominenz (nicht "Accept fett, Reject Link"). */
#cookie-banner .cb-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

@media (min-width: 520px) {
  #cookie-banner .cb-actions {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* Buttons — alle drei gleiche Basis */
#cookie-banner .cb-btn {
  min-height: 44px;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--brand-text-main, #0A0A0A);
  background: transparent;
  color: var(--brand-text-main, #0A0A0A);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition:
    background-color var(--dur-fast, 0.15s) var(--ease-out, ease-out),
    color var(--dur-fast, 0.15s) var(--ease-out, ease-out),
    transform var(--dur-fast, 0.15s) var(--ease-out, ease-out);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

#cookie-banner .cb-btn:hover {
  background: var(--brand-bg-light, #F5F0E4);
  transform: translateY(-1px);
}

#cookie-banner .cb-btn--primary {
  background: var(--brand-text-main, #0A0A0A);
  color: var(--brand-bg-white, #ffffff);
  border-color: var(--brand-text-main, #0A0A0A);
}

#cookie-banner .cb-btn--primary:hover {
  background: var(--brand-accent, #C5A572);
  border-color: var(--brand-accent, #C5A572);
  color: var(--brand-text-main, #0A0A0A);
}

#cookie-banner .cb-btn:focus-visible {
  outline: 2px solid var(--brand-accent, #C5A572);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  #cookie-banner .cb-btn,
  #cookie-banner .cb-btn:hover {
    transition: none;
    transform: none;
  }
}

/* ─── Details-Ansicht ─────────────────────────────────────────────────── */

#cookie-banner .cb-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

#cookie-banner .cb-cat {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: var(--brand-bg-light, #F5F0E4);
  border: 1px solid transparent;
  transition: border-color var(--dur-fast, 0.15s) var(--ease-out, ease-out);
}

#cookie-banner .cb-cat:has(input:checked) {
  border-color: color-mix(in srgb, var(--brand-accent, #C5A572) 40%, transparent);
}

#cookie-banner .cb-cat__txt {
  min-width: 0;
}

#cookie-banner .cb-cat__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--brand-text-main, #0A0A0A);
  margin-bottom: 0.2rem;
}

#cookie-banner .cb-cat__pill {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-accent, #C5A572) 25%, transparent);
  color: var(--brand-accent-strong, #a68b58);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#cookie-banner .cb-cat__desc {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--brand-text-light, #4a4a4a);
  margin: 0;
}

/* Toggle-Switch statt Checkbox — modernes Look-and-Feel */
#cookie-banner .cb-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

#cookie-banner .cb-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

#cookie-banner .cb-switch__slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 26px;
  transition: background-color var(--dur-fast, 0.15s) var(--ease-out, ease-out);
}

#cookie-banner .cb-switch__slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform var(--dur-fast, 0.15s) var(--ease-out, ease-out);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#cookie-banner .cb-switch input:checked + .cb-switch__slider {
  background: var(--brand-accent, #C5A572);
}

#cookie-banner .cb-switch input:checked + .cb-switch__slider::before {
  transform: translateX(20px);
}

#cookie-banner .cb-switch input:disabled + .cb-switch__slider {
  background: var(--brand-accent, #C5A572);
  cursor: not-allowed;
  opacity: 0.75;
}

#cookie-banner .cb-switch input:focus-visible + .cb-switch__slider {
  outline: 2px solid var(--brand-accent, #C5A572);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  #cookie-banner .cb-switch__slider,
  #cookie-banner .cb-switch__slider::before {
    transition: none;
  }
}

/* Details-Actions: 2 Buttons unten, "Zurück" links, "Speichern" rechts */
#cookie-banner .cb-details-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

#cookie-banner .cb-details-actions .cb-btn {
  flex: 0 0 auto;
  min-width: 130px;
}

@media (max-width: 480px) {
  #cookie-banner .cb-details-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  #cookie-banner .cb-details-actions .cb-btn {
    width: 100%;
  }
}
