/* ═══════════════════════════════════════════════════════════════
   COOKIE BANNER — Ökowert Design
   DSGVO-konform nach § 25 TDDDG
   ═══════════════════════════════════════════════════════════════ */

:root {
  --cb-g:       #4a6840;
  --cb-g-dark:  #3a5332;
  --cb-navy:    #1e3a5f;
  --cb-ink:     #1a1f17;
  --cb-muted:   #6b7a64;
  --cb-cream:   #f5f7f2;
  --cb-border:  #dde3d8;
  --cb-white:   #ffffff;
  --cb-radius:  12px;
  --cb-ease:    cubic-bezier(0.23, 1, 0.32, 1);
}

/* ── Overlay ───────────────────────────────────────────────── */
#cb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s var(--cb-ease);
  pointer-events: none;
}
#cb-overlay.cb-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Banner (erste Ebene — Bottom Bar) ─────────────────────── */
#cb-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--cb-white);
  border-top: 1px solid var(--cb-border);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.12);
  padding: 24px;
  transform: translateY(100%);
  transition: transform 0.4s var(--cb-ease);
}
#cb-banner.cb-visible {
  transform: translateY(0);
}

.cb-banner-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 32px;
}

.cb-banner-text {
  flex: 1;
}

.cb-banner-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 20px;
  font-weight: 400;
  color: var(--cb-ink);
  margin: 0 0 8px;
  line-height: 1.2;
}

.cb-banner-desc {
  font-size: 13px;
  font-weight: 300;
  color: var(--cb-muted);
  line-height: 1.75;
  margin: 0;
}

.cb-banner-desc a {
  color: var(--cb-g);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cb-banner-desc a:hover {
  color: var(--cb-g-dark);
}

.cb-banner-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  min-width: 200px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.cb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  border-radius: 40px;
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all 0.22s var(--cb-ease);
  min-height: 44px;
  white-space: nowrap;
  text-decoration: none;
}
.cb-btn:focus-visible {
  outline: 3px solid var(--cb-g);
  outline-offset: 3px;
}
.cb-btn:active {
  transform: scale(0.97);
}

/* Primär — gleichwertig gestaltet, kein Dark Pattern */
.cb-btn-accept {
  background: var(--cb-g);
  color: var(--cb-white);
  border-color: var(--cb-g);
}
.cb-btn-accept:hover {
  background: var(--cb-g-dark);
  border-color: var(--cb-g-dark);
}

/* Ablehnen — visuell gleichwertig zum Akzeptieren */
.cb-btn-reject {
  background: var(--cb-white);
  color: var(--cb-ink);
  border-color: var(--cb-border);
}
.cb-btn-reject:hover {
  border-color: var(--cb-g);
  color: var(--cb-g);
}

/* Einstellungen — tertiär, dezenter */
.cb-btn-settings {
  background: transparent;
  color: var(--cb-muted);
  border-color: transparent;
  font-size: 11px;
  padding: 8px 20px;
  min-height: 36px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cb-btn-settings:hover {
  color: var(--cb-ink);
}

/* ── Preference Center (zweite Ebene — Modal) ──────────────── */
#cb-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s var(--cb-ease);
}
#cb-modal.cb-visible {
  opacity: 1;
  pointer-events: auto;
}

.cb-modal-box {
  background: var(--cb-white);
  border-radius: var(--cb-radius);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(16px);
  transition: transform 0.35s var(--cb-ease);
}
#cb-modal.cb-visible .cb-modal-box {
  transform: scale(1) translateY(0);
}

.cb-modal-header {
  padding: 28px 28px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.cb-modal-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 24px;
  font-weight: 400;
  color: var(--cb-ink);
  margin: 0;
  line-height: 1.2;
}

.cb-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--cb-muted);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
  flex-shrink: 0;
}
.cb-modal-close:hover { color: var(--cb-ink); }
.cb-modal-close:focus-visible {
  outline: 3px solid var(--cb-g);
  outline-offset: 2px;
}

.cb-modal-desc {
  padding: 12px 28px 20px;
  font-size: 13px;
  font-weight: 300;
  color: var(--cb-muted);
  line-height: 1.75;
  border-bottom: 1px solid var(--cb-border);
  margin: 0;
}
.cb-modal-desc a {
  color: var(--cb-g);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Kategorien ────────────────────────────────────────────── */
.cb-categories {
  padding: 0 28px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cb-category {
  padding: 18px 0;
  border-bottom: 1px solid var(--cb-border);
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.cb-category:last-child {
  border-bottom: none;
}

.cb-category-info {
  flex: 1;
}

.cb-category-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--cb-ink);
  margin: 0 0 4px;
}

.cb-category-desc {
  font-size: 12px;
  font-weight: 300;
  color: var(--cb-muted);
  line-height: 1.6;
  margin: 0;
}

/* Toggle Switch */
.cb-toggle-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 2px;
}

.cb-toggle {
  position: relative;
  width: 44px;
  height: 24px;
}

.cb-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.cb-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--cb-border);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.25s var(--cb-ease);
}
.cb-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: var(--cb-white);
  border-radius: 50%;
  transition: transform 0.25s var(--cb-ease);
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}

.cb-toggle input:checked + .cb-toggle-slider {
  background: var(--cb-g);
}
.cb-toggle input:checked + .cb-toggle-slider::before {
  transform: translateX(20px);
}
.cb-toggle input:focus-visible + .cb-toggle-slider {
  outline: 3px solid var(--cb-g);
  outline-offset: 2px;
}

/* Notwendig — immer aktiv, nicht abwählbar */
.cb-toggle input:disabled + .cb-toggle-slider {
  background: var(--cb-g);
  opacity: 0.6;
  cursor: not-allowed;
}
.cb-toggle input:disabled + .cb-toggle-slider::before {
  transform: translateX(20px);
}

.cb-always-active {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cb-g);
}

/* ── Modal Footer ──────────────────────────────────────────── */
.cb-modal-footer {
  padding: 20px 28px 28px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cb-modal-footer .cb-btn {
  flex: 1;
  min-width: 120px;
}

/* ── Floating Button (Widerruf / Einstellungen öffnen) ─────── */
#cb-floating {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9997;
  display: none;
}
#cb-floating.cb-visible {
  display: block;
}

.cb-floating-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--cb-white);
  color: var(--cb-muted);
  border: 1px solid var(--cb-border);
  border-radius: 40px;
  padding: 8px 14px 8px 10px;
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,.1);
  transition: all 0.2s var(--cb-ease);
}
.cb-floating-btn:hover {
  border-color: var(--cb-g);
  color: var(--cb-g);
  box-shadow: 0 4px 16px rgba(0,0,0,.14);
}
.cb-floating-btn:focus-visible {
  outline: 3px solid var(--cb-g);
  outline-offset: 2px;
}
.cb-floating-btn svg {
  flex-shrink: 0;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  #cb-banner {
    padding: 20px 16px;
  }
  .cb-banner-inner {
    flex-direction: column;
    gap: 20px;
  }
  .cb-banner-actions {
    flex-direction: row;
    flex-wrap: wrap;
    min-width: unset;
    width: 100%;
  }
  .cb-btn-accept,
  .cb-btn-reject {
    flex: 1;
    min-width: 120px;
  }
  .cb-btn-settings {
    width: 100%;
    text-align: center;
  }
  .cb-modal-box {
    max-height: 95vh;
  }
  .cb-modal-header,
  .cb-modal-desc,
  .cb-categories,
  .cb-modal-footer {
    padding-left: 20px;
    padding-right: 20px;
  }
  .cb-modal-footer {
    flex-direction: column;
  }
  #cb-floating {
    bottom: 16px;
    left: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #cb-banner,
  #cb-overlay,
  #cb-modal,
  .cb-modal-box,
  .cb-toggle-slider,
  .cb-toggle-slider::before {
    transition: none;
  }
}
