/* ==========================================================
   JS-MODULE: Cookie Banner
   Funktionaler Consent-Banner mit Kategorien und Script-Freigabe
   ========================================================== */

.cookie-banner {
  position: fixed;
  right: var(--site-gutter, 1rem);
  bottom: var(--site-gutter, 1rem);
  left: var(--site-gutter, 1rem);
  z-index: 5000;
  display: none;
  max-width: 1120px;
  margin: 0 auto;
  color: #1f2933;
  background: #fff;
  border: 1px solid rgba(31, 41, 51, 0.18);
  border-radius: var(--radius-xl, 18px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.cookie-banner[hidden] {
  display: none !important;
}

html.cookie-banner-needed .cookie-banner,
.cookie-banner.cookie-banner-visible {
  display: block;
}

.cookie-banner-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
}

.cookie-banner-copy {
  min-width: 0;
}

.cookie-banner-copy strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  line-height: 1.25;
}

.cookie-banner p,
.cookie-category p,
.cookie-category small {
  margin: 0;
  color: #4b5563;
  font-size: 0.95rem;
  line-height: 1.5;
}

.cookie-banner a {
  color: #0b63ce;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.cookie-buttons,
.cookie-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.cookie-btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-medium, 10px);
  padding: 0.7rem 1rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.1;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.cookie-btn:hover {
  transform: translateY(-1px);
}

.cookie-btn:focus-visible,
.cookie-category input:focus-visible {
  outline: 3px solid rgba(11, 99, 206, 0.35);
  outline-offset: 3px;
}

.cookie-btn-primary {
  color: #fff;
  background: #2f7d32;
  box-shadow: 0 8px 18px rgba(47, 125, 50, 0.25);
}

.cookie-btn-primary:hover {
  background: #286d2c;
}

.cookie-btn-secondary {
  color: #fff;
  background: #5f6b7a;
}

.cookie-btn-secondary:hover {
  background: #4d5966;
}

.cookie-btn-ghost {
  color: #1f2933;
  background: #f3f5f7;
  border-color: rgba(31, 41, 51, 0.12);
}

.cookie-btn-ghost:hover {
  background: #e8ecef;
}

.cookie-settings {
  border-top: 1px solid rgba(31, 41, 51, 0.12);
  background: #f7f9fb;
}

.cookie-settings-inner {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
}

.cookie-category {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem;
  color: #1f2933;
  background: #fff;
  border: 1px solid rgba(31, 41, 51, 0.12);
  border-radius: var(--radius-medium, 12px);
}

.cookie-category strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 1rem;
}

.cookie-category input {
  width: 1.35rem;
  height: 1.35rem;
  margin: 0;
  accent-color: #2f7d32;
  cursor: pointer;
}

.cookie-category-locked {
  background: #eef7ef;
}

.cookie-required-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 7rem;
  padding: 0.35rem 0.6rem;
  color: #245927;
  background: rgba(47, 125, 50, 0.12);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  white-space: nowrap;
}

.cookie-banner {
  max-height: calc(100dvh - (var(--site-gutter, 1rem) * 2));
  overflow: auto;
  overscroll-behavior: contain;
}

@media (max-width: 820px) {
  .cookie-banner-inner {
    grid-template-columns: 1fr;
  }

  .cookie-buttons,
  .cookie-settings-actions {
    justify-content: stretch;
  }

  .cookie-buttons .cookie-btn,
  .cookie-settings-actions .cookie-btn {
    flex: 1 1 12rem;
  }
}

@media (max-width: 560px) {
  .cookie-banner {
    right: 0.7rem;
    bottom: 0.7rem;
    left: 0.7rem;
    max-height: calc(100vh - 1.4rem);
    overflow: auto;
  }

  .cookie-banner-inner,
  .cookie-settings-inner {
    padding: 0.85rem;
  }

  .cookie-category {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .cookie-category input {
    justify-self: start;
  }

  .cookie-required-label {
    justify-self: start;
  }
}
