/**
 * Cookie Consent Banner – Vollständige Styles
 *
 * Eigenständiges Stylesheet für das WP-Plugin.
 * 4 Layouts + Detail View + Toggles + Buttons + Accessibility
 *
 * WCAG 2.1 AA konform
 */

/* ══════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES
   ══════════════════════════════════════════════════ */

:root {
  --cc-primary: #2563eb;
  --cc-primary-hover: #1d4ed8;
  --cc-primary-text: #ffffff;
  --cc-bg: #ffffff;
  --cc-text: #1e293b;
  --cc-text-muted: #64748b;
  --cc-border: #e2e8f0;
  --cc-border-focus: #2563eb;
  --cc-radius: 12px;
  --cc-radius-sm: 8px;
  --cc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ══════════════════════════════════════════════════
   OVERLAY
   ══════════════════════════════════════════════════ */

.cc-overlay {
  position: fixed;
  inset: 0;
  z-index: 999998;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}

.cc-overlay--visible {
  opacity: 1;
  visibility: visible;
}

/* ══════════════════════════════════════════════════
   BANNER CONTAINER (shared by all layouts)
   ══════════════════════════════════════════════════ */

.cc-banner {
  position: fixed;
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease, transform .3s ease;
}

.cc-banner--visible {
  opacity: 1;
  visibility: visible;
}

/* ══════════════════════════════════════════════════
   CARD (only for cc- mode, NOT bootstrap mode)
   ══════════════════════════════════════════════════ */

.cc-banner__card {
  background: var(--cc-bg);
  color: var(--cc-text);
  font-family: var(--cc-font);
  font-size: 14px;
  line-height: 1.5;
  border-radius: var(--cc-radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  max-height: 90vh;
  overflow-y: auto;
}

/* Bootstrap mode: card class from BS handles visuals,
   but we still need font baseline + scroll */
.cc-bs-mode .card {
  font-family: var(--cc-font);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  max-height: 90vh;
  overflow-y: auto;
}

/* ══════════════════════════════════════════════════
   LAYOUT 1: BOTTOM BAR
   ══════════════════════════════════════════════════ */

.cc-layout-bottom-bar {
  bottom: 0;
  left: 0;
  right: 0;
  transform: translateY(100%);
}

.cc-layout-bottom-bar.cc-banner--visible {
  transform: translateY(0);
}

.cc-layout-bottom-bar .cc-banner__card,
.cc-layout-bottom-bar .card {
  border-radius: 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.1);
}

.cc-layout-bottom-bar .cc-compact__pad {
  padding: 16px 24px;
}

.cc-layout-bottom-bar .cc-compact__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.cc-layout-bottom-bar .cc-compact__text {
  flex: 1 1 300px;
}

.cc-layout-bottom-bar .cc-compact__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.cc-layout-bottom-bar .cc-compact__links {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.cc-layout-bottom-bar .cc-banner__title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
}

.cc-layout-bottom-bar .cc-banner__text {
  font-size: 13px;
  color: var(--cc-text-muted);
  margin: 0;
}

.cc-layout-bottom-bar .cc-banner__card--detail,
.cc-layout-bottom-bar .card.cc-banner__card--detail {
  max-height: 80vh;
  overflow-y: auto;
}

/* ══════════════════════════════════════════════════
   LAYOUT 2: CENTERED MODAL
   ══════════════════════════════════════════════════ */

.cc-layout-centered-modal {
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  transform: scale(0.95);
}

.cc-layout-centered-modal.cc-banner--visible {
  transform: scale(1);
}

.cc-layout-centered-modal .cc-banner__card,
.cc-layout-centered-modal .card {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 16px;
}

.cc-layout-centered-modal .cc-compact__pad {
  padding: 32px 28px 24px;
}

.cc-layout-centered-modal .cc-compact__body {
  text-align: center;
}

.cc-layout-centered-modal .cc-compact__icon {
  margin-bottom: 8px;
}

.cc-layout-centered-modal .cc-compact__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cc-layout-centered-modal .cc-compact__links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--cc-border);
}

.cc-layout-centered-modal .cc-banner__title {
  font-size: 20px;
  font-weight: 700;
  margin: 12px 0 8px;
}

.cc-layout-centered-modal .cc-banner__text {
  font-size: 14px;
  color: var(--cc-text-muted);
  margin: 0 0 20px;
}

/* ══════════════════════════════════════════════════
   LAYOUT 3: SIDE DRAWER
   ══════════════════════════════════════════════════ */

.cc-layout-side-drawer {
  bottom: 20px;
  right: 20px;
  max-width: 380px;
  width: calc(100% - 40px);
  transform: translateX(120%);
}

.cc-layout-side-drawer.cc-banner--visible {
  transform: translateX(0);
}

.cc-layout-side-drawer .cc-banner__card,
.cc-layout-side-drawer .card {
  border-radius: 16px;
  max-height: 80vh;
  overflow-y: auto;
}

.cc-layout-side-drawer .cc-compact__pad {
  padding: 20px;
}

.cc-layout-side-drawer .cc-compact__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.cc-layout-side-drawer .cc-compact__links {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.cc-layout-side-drawer .cc-banner__title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 8px;
}

.cc-layout-side-drawer .cc-banner__text {
  font-size: 13px;
  color: var(--cc-text-muted);
  margin: 0;
}

/* ══════════════════════════════════════════════════
   LAYOUT 4: FULL-WIDTH BANNER (top)
   ══════════════════════════════════════════════════ */

.cc-layout-full-width {
  top: 0;
  left: 0;
  right: 0;
  transform: translateY(-100%);
}

.cc-layout-full-width.cc-banner--visible {
  transform: translateY(0);
}

.cc-layout-full-width .cc-banner__card,
.cc-layout-full-width .card {
  border-radius: 0;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

.cc-layout-full-width .cc-compact__pad {
  padding: 24px;
}

.cc-layout-full-width .cc-compact__inner {
  max-width: 1200px;
  margin: 0 auto;
}

.cc-layout-full-width .cc-compact__text {
  margin-bottom: 16px;
}

.cc-layout-full-width .cc-compact__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.cc-layout-full-width .cc-compact__links-inline {
  display: flex;
  gap: 12px;
  margin-left: auto;
}

.cc-layout-full-width .cc-banner__title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
}

.cc-layout-full-width .cc-banner__text {
  font-size: 14px;
  color: var(--cc-text-muted);
  margin: 0;
}

.cc-layout-full-width .cc-banner__card--detail,
.cc-layout-full-width .card.cc-banner__card--detail {
  max-height: 80vh;
  overflow-y: auto;
}

/* ══════════════════════════════════════════════════
   BUTTONS (cc- mode only, NOT used in BS mode)
   ══════════════════════════════════════════════════ */

.cc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-family: var(--cc-font);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  border-radius: var(--cc-radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
  white-space: nowrap;
  min-height: 44px;
  text-decoration: none;
}

.cc-btn:active {
  transform: scale(0.98);
}

.cc-btn:focus-visible {
  outline: 3px solid var(--cc-border-focus);
  outline-offset: 2px;
}

.cc-btn--primary {
  background: var(--cc-primary);
  color: var(--cc-primary-text);
}

.cc-btn--primary:hover {
  background: var(--cc-primary-hover);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.cc-btn--secondary {
  background: transparent;
  color: var(--cc-text);
  border-color: var(--cc-border);
}

.cc-btn--secondary:hover {
  background: #f8fafc;
  border-color: var(--cc-primary);
}

.cc-btn--link {
  background: transparent;
  border: none;
  color: var(--cc-text-muted);
  padding: 8px 12px;
  font-weight: 500;
  font-size: 13px;
  min-height: auto;
}

.cc-btn--link:hover {
  color: var(--cc-primary);
}

/* ══════════════════════════════════════════════════
   LINKS (cc- mode only)
   ══════════════════════════════════════════════════ */

.cc-banner__link {
  font-size: 12px;
  color: var(--cc-text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-family: var(--cc-font);
  padding: 4px;
}

.cc-banner__link:hover {
  color: var(--cc-primary);
}

.cc-banner__link:focus-visible {
  outline: 3px solid var(--cc-border-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ══════════════════════════════════════════════════
   DETAIL VIEW
   ══════════════════════════════════════════════════ */

.cc-detail {
  display: none;
}

.cc-detail--visible {
  display: flex;
  flex-direction: column;
}

/* cc- mode detail header */
.cc-detail__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--cc-border);
  gap: 12px;
}

.cc-detail__title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  min-width: 0;
  flex: 1;
}

.cc-detail__back {
  background: none;
  border: 1px solid var(--cc-border);
  color: var(--cc-text);
  padding: 6px 14px;
  border-radius: 6px;
  font-family: var(--cc-font);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s ease;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cc-detail__back:hover {
  border-color: var(--cc-primary);
  background: #f8fafc;
}

.cc-detail__back:focus-visible {
  outline: 3px solid var(--cc-border-focus);
  outline-offset: 2px;
}

/* cc- mode categories container */
.cc-detail__categories {
  padding: 0 24px;
}

/* cc- mode actions */
.cc-detail__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 24px 24px;
  border-top: 1px solid var(--cc-border);
}

.cc-detail__actions .cc-btn {
  flex: 1;
}

/* ══════════════════════════════════════════════════
   CATEGORY (cc- mode)
   ══════════════════════════════════════════════════ */

.cc-category {
  border-bottom: 1px solid var(--cc-border);
  padding: 16px 0;
}

.cc-category:last-child {
  border-bottom: none;
}

.cc-category__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cc-category__info {
  flex: 1;
  min-width: 0;
}

.cc-category__name {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 2px;
  color: var(--cc-text);
}

.cc-category__desc {
  font-size: 13px;
  color: var(--cc-text-muted);
  margin: 0 0 4px;
}

.cc-category__toggle-details {
  background: none;
  border: none;
  color: var(--cc-primary);
  font-family: var(--cc-font);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cc-category__toggle-details:hover {
  text-decoration: underline;
}

.cc-category__toggle-details:focus-visible {
  outline: 3px solid var(--cc-border-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.cc-category__details {
  display: none;
  margin-top: 12px;
  background: #f8fafc;
  border-radius: var(--cc-radius-sm);
  padding: 12px;
}

.cc-category__details--open {
  display: block;
}

/* ══════════════════════════════════════════════════
   TOGGLE SWITCH (cc- mode only)
   ══════════════════════════════════════════════════ */

.cc-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}

.cc-toggle__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.cc-toggle__slider {
  width: 44px;
  height: 24px;
  background: #cbd5e1;
  border-radius: 12px;
  cursor: pointer;
  transition: background .2s ease;
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

.cc-toggle__slider::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform .2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.cc-toggle__input:checked + .cc-toggle__slider {
  background: var(--cc-primary);
}

.cc-toggle__input:checked + .cc-toggle__slider::after {
  transform: translateX(20px);
}

.cc-toggle__input:focus-visible + .cc-toggle__slider {
  outline: 3px solid var(--cc-border-focus);
  outline-offset: 2px;
}

.cc-toggle__input:disabled + .cc-toggle__slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.cc-toggle__label {
  position: absolute;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════
   SERVICE DETAILS (cc- mode)
   ══════════════════════════════════════════════════ */

.cc-service {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--cc-border);
}

.cc-service:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.cc-service__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--cc-text);
  margin: 0 0 2px;
}

.cc-service__provider {
  font-size: 12px;
  color: var(--cc-text-muted);
  margin: 0 0 4px;
}

.cc-service__cookies {
  font-size: 12px;
  color: var(--cc-text-muted);
  margin: 4px 0;
  padding-left: 16px;
  list-style: none;
}

.cc-service__cookies li {
  padding: 2px 0;
}

.cc-service__privacy {
  font-size: 12px;
  color: var(--cc-primary);
  text-decoration: underline;
}

/* ══════════════════════════════════════════════════
   SETTINGS TRIGGER BUTTON
   ══════════════════════════════════════════════════ */

.cc-settings-trigger {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 999990;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--cc-bg);
  border: 2px solid var(--cc-border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: box-shadow .2s ease, transform .2s ease;
}

.cc-settings-trigger:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transform: scale(1.05);
}

.cc-settings-trigger:focus-visible {
  outline: 3px solid var(--cc-border-focus);
  outline-offset: 2px;
}

.cc-settings-trigger svg {
  width: 20px;
  height: 20px;
  color: var(--cc-text-muted);
}

/* ══════════════════════════════════════════════════
   BLOCKED CONTENT PLACEHOLDER
   ══════════════════════════════════════════════════ */

.cc-blocked-content {
  background: #f1f5f9;
  border: 2px dashed var(--cc-border);
  border-radius: var(--cc-radius);
  padding: 32px 24px;
  text-align: center;
  font-family: var(--cc-font);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cc-blocked-content__inner {
  max-width: 360px;
}

.cc-blocked-content__text {
  font-size: 14px;
  color: var(--cc-text-muted);
  margin: 0 0 16px;
  line-height: 1.5;
}

.cc-blocked-content__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: var(--cc-primary);
  color: var(--cc-primary-text);
  border: none;
  border-radius: var(--cc-radius-sm);
  font-family: var(--cc-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: background .15s ease;
}

.cc-blocked-content__btn:hover {
  background: var(--cc-primary-hover);
}

/* ══════════════════════════════════════════════════
   BOOTSTRAP MODE – minimal overrides
   Only layout/positioning, BS handles all visuals
   ══════════════════════════════════════════════════ */

.cc-bs-mode .cc-category__details {
  background: transparent;
  padding: 0 12px 12px;
  margin-top: 0;
  border-radius: 0;
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* Bottom Bar: stack */
  .cc-layout-bottom-bar .cc-compact__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .cc-layout-bottom-bar .cc-compact__actions {
    flex-direction: column;
  }

  .cc-layout-bottom-bar .cc-compact__links {
    justify-content: center;
  }

  /* Centered Modal: bottom sheet */
  .cc-layout-centered-modal {
    padding: 0;
    align-items: flex-end;
  }

  .cc-layout-centered-modal .cc-banner__card,
  .cc-layout-centered-modal .card {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
  }

  /* Side Drawer: full-width bottom sheet */
  .cc-layout-side-drawer {
    bottom: 0;
    right: 0;
    left: 0;
    max-width: 100%;
    width: 100%;
    transform: translateY(100%);
  }

  .cc-layout-side-drawer.cc-banner--visible {
    transform: translateY(0);
  }

  .cc-layout-side-drawer .cc-banner__card,
  .cc-layout-side-drawer .card {
    border-radius: 16px 16px 0 0;
    max-height: 85vh;
  }

  /* Full-Width: compact */
  .cc-layout-full-width .cc-compact__pad {
    padding: 16px;
  }

  .cc-layout-full-width .cc-compact__actions {
    flex-direction: column;
  }

  .cc-layout-full-width .cc-compact__links-inline {
    margin-left: 0;
    margin-top: 8px;
  }

  /* Detail: narrower */
  .cc-detail__header {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 12px 16px;
  }

  .cc-detail__title {
    font-size: 14px;
  }

  .cc-detail__categories {
    padding: 0 16px;
  }

  .cc-detail__actions {
    padding: 12px 16px 16px;
    flex-direction: column;
  }

  .cc-category__header {
    flex-direction: column;
    gap: 8px;
  }

  .cc-category__desc {
    font-size: 12px;
  }
}

@media (max-width: 400px) {
  .cc-btn {
    padding: 10px 16px;
    font-size: 13px;
    width: 100%;
  }
}

/* ══════════════════════════════════════════════════
   ACCESSIBILITY
   ══════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .cc-banner,
  .cc-overlay,
  .cc-toggle__slider,
  .cc-toggle__slider::after,
  .cc-btn,
  .cc-settings-trigger,
  .cc-blocked-content__btn {
    transition: none !important;
  }
}

@media (forced-colors: active) {
  .cc-toggle__slider {
    border: 2px solid ButtonText;
  }

  .cc-toggle__input:checked + .cc-toggle__slider {
    background: Highlight;
  }

  .cc-btn {
    border: 2px solid ButtonText;
  }
}

@media print {
  .cc-banner,
  .cc-overlay,
  .cc-settings-trigger,
  .cc-blocked-content {
    display: none !important;
  }
}
