/**
 * Open Cookie Consent — Frontend Styles
 * Modern, accessible, WCAG AA compliant.
 */

:root {
  --occ-bg: #ffffff;
  --occ-text: #1f2937;
  --occ-headline: #0f172a;
  --occ-link: #2563eb;
  --occ-primary-bg: #2563eb;
  --occ-primary-text: #ffffff;
  --occ-secondary-bg: #e5e7eb;
  --occ-secondary-text: #111827;
  --occ-radius: 14px;
  --occ-btn-radius: 10px;
  --occ-font-size: 15px;
  --occ-max-width: 640px;
  --occ-overlay-color: rgba(15, 23, 42, 0.55);
  --occ-overlay-blur: 4px;
  --occ-floating-bg: #2563eb;
}

#occ-root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: var(--occ-font-size);
  color: var(--occ-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#occ-root[aria-hidden="true"] {
  display: none;
}

#occ-root[aria-hidden="false"] {
  display: block;
}

/* Keep theme typography from leaking into banner headings and labels. */
#occ-root :where(h2, h3, p, label, button, a) {
  font-family: inherit;
  font-style: normal;
  text-transform: none;
  letter-spacing: normal;
  text-shadow: none;
}

/* Keep theme button typography and fixed dimensions out of the consent UI. */
#occ-root :where(button),
#occ-floating-btn {
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  font-style: normal;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: normal;
  text-indent: 0;
  text-shadow: none;
  box-shadow: none;
  background-image: none;
  float: none;
  width: auto;
  min-width: 0;
  max-width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  margin: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  box-sizing: border-box;
}

/* Overlay */
#occ-root .occ-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--occ-overlay-color);
  backdrop-filter: blur(var(--occ-overlay-blur));
  -webkit-backdrop-filter: blur(var(--occ-overlay-blur));
  z-index: 999998;
  opacity: 0;
  transition: opacity 0.25s ease-out;
}

#occ-root.occ-root.occ-open .occ-overlay {
  opacity: 1;
}

/* Banner Container */
#occ-root .occ-banner {
  position: fixed;
  z-index: 999999;
  box-sizing: border-box;
  background: var(--occ-bg);
  border-radius: var(--occ-radius);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
  width: calc(100% - 32px);
  max-width: var(--occ-max-width);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease-out;
  opacity: 0;
}

/* Positionen */
#occ-root.occ-pos-center .occ-banner {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%) scale(0.97);
}
#occ-root.occ-root.occ-open.occ-pos-center .occ-banner {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

#occ-root.occ-pos-bottom .occ-banner {
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
}
#occ-root.occ-root.occ-open.occ-pos-bottom .occ-banner {
  transform: translate(-50%, 0);
  opacity: 1;
}

#occ-root.occ-pos-bottom-left .occ-banner {
  bottom: 24px;
  left: 24px;
  transform: translateY(20px);
}
#occ-root.occ-root.occ-open.occ-pos-bottom-left .occ-banner {
  transform: translateY(0);
  opacity: 1;
}

#occ-root.occ-pos-bottom-right .occ-banner {
  bottom: 24px;
  right: 24px;
  transform: translateY(20px);
}
#occ-root.occ-root.occ-open.occ-pos-bottom-right .occ-banner {
  transform: translateY(0);
  opacity: 1;
}

/* Leisten-Layout */
#occ-root.occ-layout-bar .occ-banner {
  width: 100%;
  max-width: 100%;
  border-radius: 0;
  bottom: 0;
  left: 0;
  right: 0;
  transform: translateY(100%);
}
#occ-root.occ-root.occ-open.occ-layout-bar .occ-banner {
  transform: translateY(0);
  opacity: 1;
}

/* Innere Elemente */
#occ-root .occ-banner__content {
  padding: var(--occ-padding, 24px);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-sizing: border-box;
}

#occ-root .occ-header {
  margin-bottom: 14px;
}

#occ-root .occ-logo {
  display: block;
  margin-bottom: 12px;
  object-fit: contain;
}

#occ-root .occ-headline {
  margin: 0;
  font-size: 1.35em;
  font-weight: 700;
  color: var(--occ-headline);
  line-height: 1.3;
}

#occ-root .occ-description {
  margin: 0 0 14px 0;
  color: var(--occ-text);
  line-height: 1.55;
}

#occ-root .occ-description a {
  color: var(--occ-link);
  text-decoration: underline;
}

#occ-root .occ-notice {
  font-size: 0.85em;
  padding: 10px 14px;
  border-radius: 8px;
  margin: 10px 0;
  line-height: 1.45;
}

#occ-root .occ-notice--age {
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
  border-left: 3px solid #f59e0b;
}

#occ-root .occ-notice--third-country {
  background: rgba(239, 68, 68, 0.1);
  color: #991b1b;
  border-left: 3px solid #ef4444;
}

/* Gruppen Übersicht in Ebene 1 */
#occ-root .occ-groups-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
  padding: 10px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
}

#occ-root .occ-group-summary-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9em;
  cursor: pointer;
}

/* Aktionen / Buttons */
#occ-root .occ-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--occ-button-gap, 10px);
  margin-top: 18px;
  align-items: center;
}

/* Layout: Gleiche Breite */
#occ-root .occ-actions--layout-equal .occ-btn:not(.occ-btn--link),
#occ-root .occ-actions--equal .occ-btn:not(.occ-btn--link) {
  flex: 1 1 160px;
  text-align: center;
}

/* Layout: Gestapelt (Vertikal) */
#occ-root .occ-actions--layout-column {
  flex-direction: column;
  align-items: stretch;
}
#occ-root .occ-actions--layout-column .occ-btn:not(.occ-btn--link) {
  flex: 0 0 auto;
  width: 100%;
  text-align: center;
}

/* Ausrichtung */
#occ-root .occ-actions--align-center {
  justify-content: center;
}
#occ-root .occ-actions--align-right {
  justify-content: flex-end;
}
#occ-root .occ-actions--align-left {
  justify-content: flex-start;
}

/* Dezent platzierter Link unter den Buttons */
#occ-root .occ-actions-sublink {
  margin-top: 8px;
  text-align: center;
}
#occ-root .occ-actions-sublink .occ-btn--link {
  font-size: 0.88em;
  padding: 4px 8px;
}


#occ-root .occ-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  font-size: 0.95em;
  font-weight: 600;
  line-height: 1.4;
  border-radius: var(--occ-btn-radius);
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.15s ease-in-out;
  box-sizing: border-box;
}

#occ-root .occ-btn:focus-visible {
  outline: 3px solid var(--occ-link);
  outline-offset: 2px;
}

#occ-root .occ-btn--primary {
  background: var(--occ-primary-bg);
  color: var(--occ-primary-text);
}

#occ-root .occ-btn--primary:hover {
  filter: brightness(1.08);
}

#occ-root .occ-btn--secondary {
  background: var(--occ-secondary-bg);
  color: var(--occ-secondary-text);
}

#occ-root .occ-btn--secondary:hover {
  filter: brightness(0.95);
}

#occ-root .occ-btn--link {
  background: transparent;
  color: var(--occ-link);
  padding: 11px 12px;
  font-weight: 500;
  text-decoration: underline;
}

#occ-root .occ-btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 4px 8px;
  margin-bottom: 8px;
  color: var(--occ-link);
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
}

#occ-root .occ-footer {
  display: flex;
  gap: 16px;
  margin-top: 14px;
  font-size: 0.82em;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

#occ-root .occ-legal-link {
  color: var(--occ-text);
  opacity: 0.75;
  text-decoration: none;
}
#occ-root .occ-legal-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Zweite Ebene: Accordion & Cards */
#occ-root .occ-body--scrollable {
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 4px;
}

#occ-root .occ-group-card {
  border: 1px solid rgba(0, 0, 0, 0.09);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  background: rgba(0, 0, 0, 0.02);
}

#occ-root .occ-group-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

#occ-root .occ-group-card__title {
  margin: 0;
  font-size: 1.05em;
  font-weight: 600;
  color: var(--occ-headline);
}

#occ-root .occ-group-card__desc {
  margin: 0 0 10px 0;
  font-size: 0.85em;
  color: var(--occ-text);
  opacity: 0.85;
}

#occ-root .occ-services-list {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 8px;
  margin-top: 8px;
}

#occ-root .occ-service-item {
  padding: 6px 0;
}

#occ-root .occ-service-item__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#occ-root .occ-service-item__name {
  font-weight: 500;
  font-size: 0.9em;
}

#occ-root .occ-service-item__purpose {
  font-size: 0.8em;
  color: var(--occ-text);
  opacity: 0.75;
  margin-top: 2px;
}

/* Badges */
#occ-root .occ-badge {
  display: inline-block;
  padding: 2px 7px;
  font-size: 0.72em;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
}

#occ-root .occ-badge--essential {
  background: #e0f2fe;
  color: #0369a1;
}

/* Accessible Switch */
#occ-root .occ-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

#occ-root .occ-switch--sm {
  width: 36px;
  height: 20px;
}

#occ-root .occ-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

#occ-root .occ-switch__slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.2s;
  border-radius: 34px;
}

#occ-root .occ-switch__slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

#occ-root .occ-switch--sm .occ-switch__slider:before {
  height: 14px;
  width: 14px;
}

#occ-root .occ-switch input:checked + .occ-switch__slider {
  background-color: var(--occ-primary-bg);
}

#occ-root .occ-switch input:focus-visible + .occ-switch__slider {
  outline: 2px solid var(--occ-link);
  outline-offset: 2px;
}

#occ-root .occ-switch input:checked + .occ-switch__slider:before {
  transform: translateX(20px);
}

#occ-root .occ-switch--sm input:checked + .occ-switch__slider:before {
  transform: translateX(16px);
}

#occ-root .occ-switch input:disabled + .occ-switch__slider {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Schwebender Button */
#occ-floating-btn.occ-floating-btn[hidden] { display: none !important; }
#occ-floating-btn.occ-floating-btn {
  position: fixed;
  bottom: 24px;
  z-index: 999990;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--occ-floating-bg);
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
}

#occ-floating-btn.occ-floating-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
}

#occ-floating-btn.occ-floating-btn:focus-visible {
  outline: 3px solid var(--occ-link);
  outline-offset: 3px;
}

#occ-floating-btn.occ-floating-btn--left {
  left: 24px;
}

#occ-floating-btn.occ-floating-btn--right {
  right: 24px;
}

/* Content Blocker Card */
.occ-blocker {
  position: relative;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  color: #334155;
  margin: 1.5rem 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

.occ-blocker__inner {
  max-width: 480px;
  margin: 0 auto;
}

.occ-blocker__icon {
  margin-bottom: 12px;
  color: #64748b;
  display: flex;
  justify-content: center;
}

.occ-blocker__headline {
  margin: 0 0 8px 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

.occ-blocker__text {
  margin: 0 0 16px 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #475569;
}

.occ-blocker__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-bottom: 12px;
}

.occ-blocker__btn {
  background: var(--occ-primary-bg, #2563eb);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
}

.occ-blocker__btn:hover {
  filter: brightness(1.08);
}

.occ-blocker__btn-link {
  background: transparent;
  border: none;
  color: #2563eb;
  cursor: pointer;
  font-size: 0.88rem;
  text-decoration: underline;
  padding: 8px 12px;
}

.occ-blocker__footer {
  font-size: 0.8rem;
}

.occ-blocker__privacy-link {
  color: #64748b;
  text-decoration: none;
}
.occ-blocker__privacy-link:hover {
  text-decoration: underline;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  #occ-root .occ-banner {
    width: calc(100% - 16px);
    bottom: 8px;
    left: 8px;
    right: 8px;
    transform: translateY(20px);
  }
  #occ-root .occ-banner__content {
    padding: min(var(--occ-padding, 24px), 18px);
  }
  #occ-root .occ-actions {
    flex-direction: column;
    align-items: stretch;
  }
  #occ-root .occ-actions .occ-btn:not(.occ-btn--link) {
    flex: 0 0 auto;
    width: 100%;
  }
}

/* Saved design controls apply equally in the site and admin preview. */
#occ-root.occ-no-shadow .occ-banner { box-shadow: none; }
#occ-root.occ-pos-top .occ-banner { top:24px; bottom:auto; left:50%; transform:translate(-50%,-20px); }
#occ-root.occ-root.occ-open.occ-pos-top .occ-banner { transform:translate(-50%,0); opacity:1; }
#occ-root.occ-layout-bar.occ-pos-top .occ-banner { top:0; bottom:auto; left:0; transform:translateY(-100%); }
#occ-root.occ-root.occ-open.occ-layout-bar.occ-pos-top .occ-banner { transform:translateY(0); }
#occ-root .occ-btn { white-space:normal; overflow-wrap:anywhere; min-width:0; }
@media (max-width:640px) {
  #occ-root.occ-root.occ-pos-center .occ-banner { top:50%; bottom:auto; left:50%; right:auto; }
  #occ-root.occ-root.occ-pos-bottom .occ-banner { top:auto; bottom:8px; left:50%; right:auto; }
  #occ-root.occ-root.occ-pos-bottom-left .occ-banner { top:auto; bottom:8px; left:8px; right:auto; }
  #occ-root.occ-root.occ-pos-bottom-right .occ-banner { top:auto; bottom:8px; right:8px; left:auto; }
  #occ-root.occ-root.occ-pos-top .occ-banner { top:8px; bottom:auto; left:50%; right:auto; }
  #occ-root.occ-root.occ-layout-bar .occ-banner { width:100%; max-width:100%; left:0; right:0; bottom:0; top:auto; }
  #occ-root.occ-root.occ-layout-bar.occ-pos-top .occ-banner { top:0; bottom:auto; }
}

#occ-root .occ-save-error { margin:16px 0; padding:12px 14px; border-left:3px solid #b91c1c; border-radius:6px; background:#fef2f2; color:#991b1b; font-size:.9em; line-height:1.5; }
