/* ColourClean Cookie Consent — eigener DSGVO-konformer Banner.
   Prinzipien:
   - "Akzeptieren" und "Nur notwendige" gleichberechtigt (DSK 2022)
   - Keine vorausgewählten Checkboxen für nicht-notwendige Kategorien
   - Granular wählbare Service-Kategorien (Notwendig/Statistik/Marketing)
   - Re-Open via Floating-Button (Withdrawable Consent)
   - Mobile-first, Fokus-trap im Settings-Modal
*/

/* #cc-root ist nur ein Container, KEIN Vollbild-Overlay.
   Banner und Modal sind jeweils selbst position:fixed und tragen ihren z-index. */
#cc-root {
  /* keine position, kein inset, kein pointer-events Block */
}

/* ───── BANNER (Bottom Sheet) ───── */
#cc-banner {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translate(-50%, 140%);
  width: min(680px, calc(100vw - 32px));
  background: #ffffff;
  border: 1px solid color-mix(in oklch, #000 12%, transparent);
  border-radius: 18px;
  box-shadow: 0 24px 60px -16px rgba(0,0,0,0.28),
              0 4px 16px -4px rgba(0,0,0,0.12);
  padding: 24px 26px 22px;
  opacity: 0;
  pointer-events: none;
  z-index: 99999;
  transition: transform 0.55s cubic-bezier(0.22,1,0.36,1),
              opacity 0.4s ease;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #0d0f17;
}
#cc-banner.cc-visible {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
#cc-banner h2 {
  margin: 0 0 8px;
  padding-right: 32px;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #0d0f17;
}
.cc-banner-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #7c8294;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.cc-banner-close:hover { background: #f3eee5; color: #0d0f17; }
.cc-banner-close:focus-visible { outline: 2px solid #e8753a; outline-offset: 2px; }
.cc-banner-close svg { width: 16px; height: 16px; }
#cc-banner { position: fixed; } /* sicherheitshalber für absolute close */
#cc-banner p {
  margin: 0 0 18px;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #4a4f5c;
}
.cc-banner-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: stretch;
}
.cc-banner-actions .cc-btn-primary {
  background: #e8753a;
  color: #ffffff;
  font-size: 1rem;
  min-height: 52px;
  font-weight: 700;
  box-shadow: 0 6px 16px -8px rgba(232, 117, 58, 0.6);
}
.cc-banner-actions .cc-btn-primary:hover { background: #d6651f; }
.cc-banner-actions .cc-banner-secondary-link {
  font-size: 0.82rem;
  color: #7c8294;
  padding: 6px 12px;
  min-height: 32px;
}
.cc-banner-actions .cc-banner-secondary-link:hover { color: #0d0f17; }
.cc-btn {
  padding: 13px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.93rem;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}
.cc-btn:hover { transform: translateY(-1px); }
.cc-btn:active { transform: translateY(0); }
.cc-btn:focus-visible { outline: 2px solid #e8753a; outline-offset: 2px; }
.cc-btn-primary {
  background: #0d0f17;
  color: #ffffff;
}
.cc-btn-primary:hover { background: #000; }
.cc-btn-secondary {
  background: #f3eee5;
  color: #0d0f17;
  border-color: color-mix(in oklch, #000 10%, transparent);
}
.cc-btn-secondary:hover { background: #ece7dc; }
.cc-btn-link {
  background: transparent;
  color: #4a4f5c;
  border: none;
  padding: 8px 12px;
  min-height: 36px;
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.cc-btn-link:hover { color: #0d0f17; }
.cc-link {
  display: block;
  margin-top: 14px;
  font-size: 0.78rem;
  color: #7c8294;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.cc-link:hover { color: #0d0f17; }

/* ───── MODAL (Einstellungen) ───── */
#cc-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(13, 15, 23, 0.6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 100000;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
#cc-modal[hidden] { display: none; }
#cc-modal.cc-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.cc-modal-inner {
  background: #ffffff;
  border-radius: 18px;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 28px 24px;
  font-family: 'Inter', system-ui, sans-serif;
  color: #0d0f17;
  box-shadow: 0 24px 60px -16px rgba(0,0,0,0.4);
}
.cc-modal-inner h2 {
  margin: 0 0 6px;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.cc-modal-inner > p {
  margin: 0 0 22px;
  font-size: 0.9rem;
  color: #4a4f5c;
  line-height: 1.55;
}
.cc-category {
  border-top: 1px solid #e6e3dc;
  padding: 16px 0;
}
.cc-category:first-of-type { border-top: none; padding-top: 6px; }
.cc-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}
.cc-category-title {
  font-weight: 600;
  font-size: 0.98rem;
  color: #0d0f17;
}
.cc-category-desc {
  font-size: 0.85rem;
  color: #4a4f5c;
  line-height: 1.55;
  margin: 0;
}
.cc-category-services {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.78rem;
  color: #7c8294;
}
.cc-category-services li { display: inline; }
.cc-category-services li::after { content: ' · '; }
.cc-category-services li:last-child::after { content: ''; }

/* Toggle Switch */
.cc-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.cc-toggle input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}
.cc-toggle-slider {
  position: absolute;
  inset: 0;
  background: #d6d2c7;
  border-radius: 26px;
  transition: background 0.2s ease;
  cursor: pointer;
}
.cc-toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.cc-toggle input:checked + .cc-toggle-slider { background: #e8753a; }
.cc-toggle input:checked + .cc-toggle-slider::before { transform: translateX(18px); }
.cc-toggle input:disabled + .cc-toggle-slider {
  background: #b8b3a6;
  cursor: not-allowed;
}
.cc-toggle input:disabled + .cc-toggle-slider::before { background: #f0ede5; }
.cc-toggle input:focus-visible + .cc-toggle-slider { outline: 2px solid #e8753a; outline-offset: 2px; }

.cc-modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #e6e3dc;
}
.cc-modal-footer .cc-btn { flex: 1 1 calc(50% - 10px); }

/* Collision-Prevention entfernt — Banner trägt eigenen z-index (99999) und
   ist nur sichtbar/klickbar wenn .cc-visible. Floating-CTA bleibt immer klickbar. */

/* ───── REOPEN BUTTON ───── */
#cc-reopen {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid color-mix(in oklch, #000 12%, transparent);
  background: #ffffff;
  color: #4a4f5c;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  box-shadow: 0 8px 24px -10px rgba(0,0,0,0.25);
  transition: transform 0.2s ease, color 0.2s ease;
  z-index: 100;
}
#cc-reopen:hover { transform: scale(1.06); color: #e8753a; }
#cc-reopen svg { width: 20px; height: 20px; }
#cc-reopen:focus-visible { outline: 2px solid #e8753a; outline-offset: 3px; }
@media (max-width: 600px) {
  #cc-reopen { width: 40px; height: 40px; left: 12px; bottom: 12px; }
  #cc-reopen svg { width: 18px; height: 18px; }
}

/* ───── BLOCKED CONTENT PLACEHOLDERS ───── */
.cc-blocked-placeholder {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 24px;
  background: linear-gradient(135deg, #f3eee5, #ece7dc);
  border: 1px dashed color-mix(in oklch, #000 18%, transparent);
  border-radius: 14px;
  text-align: center;
  min-height: 200px;
  font-family: 'Inter', system-ui, sans-serif;
  color: #4a4f5c;
}
.cc-blocked-placeholder svg { width: 32px; height: 32px; color: #7c8294; }
.cc-blocked-placeholder p {
  margin: 0;
  font-size: 0.92rem;
  max-width: 36ch;
  line-height: 1.5;
}
.cc-blocked-placeholder p strong { color: #0d0f17; font-weight: 600; }
.cc-blocked-placeholder .cc-btn-primary { padding: 10px 18px; font-size: 0.88rem; min-height: 40px; }

/* ───── RESPONSIVE ───── */
@media (max-width: 600px) {
  #cc-banner {
    bottom: 8px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    transform: translate(0, 140%);
    padding: 16px 16px 14px;
    border-radius: 14px;
  }
  #cc-banner.cc-visible { transform: translate(0, 0); }
  #cc-banner h2 { font-size: 1rem; margin-bottom: 6px; }
  #cc-banner p { font-size: 0.82rem; margin-bottom: 10px; }
  .cc-banner-actions { grid-template-columns: 1fr; gap: 6px; }
  .cc-banner-actions .cc-btn-primary { min-height: 48px; font-size: 0.95rem; }
  .cc-banner-actions .cc-banner-secondary-link { min-height: 30px; font-size: 0.78rem; }
  .cc-modal-inner { padding: 22px 20px 20px; }
  .cc-modal-footer .cc-btn { flex: 1 1 100%; }
}

/* ───── REDUCED MOTION ───── */
@media (prefers-reduced-motion: reduce) {
  #cc-banner, #cc-modal, .cc-toggle-slider::before, #cc-reopen {
    transition: opacity 0.15s ease, visibility 0.15s ease;
  }
  #cc-banner { transition: opacity 0.15s ease; transform: none; }
  #cc-banner.cc-visible { transform: none; }
}
