/* CCM - Styling (Standalone, keine Shopware-Variablen) */
:root {
  /* Markenfarbe der Shops; --bs-primary kommt aus dem Theme (pro Domain anpassbar) */
  --td-primary: var(--bs-primary, #0042a0);
  --td-ink: #2b3136;
  --td-btn-bg: var(--td-primary);
  --td-btn-fg: #fff;
  --td-white: #fff;
  --td-link: var(--bs-primary, #0042a0);
  --td-gray-100: #f5f5f5;
  --td-gray-200: #e2e5e8;
  --td-gray-300: #cfd4d9;
  --td-gray-500: #6f7780;
  --td-gray-700: #474a57;
  --td-bg: #fff;
  --td-surface: #fff;
  --td-text: #2b3136;
  --td-border: #2b3136;
}

@media (prefers-color-scheme: dark) {
  :root {
    --td-primary: #3d6fc4;
    --td-ink: #e8eaed;
    --td-btn-bg: var(--td-primary);
    --td-btn-fg: #fff;
    --td-white: #1d2227;
    --td-link: #7da7e8;
    --td-gray-100: #262b31;
    --td-gray-200: #343a41;
    --td-gray-300: #454c54;
    --td-gray-500: #8b939c;
    --td-gray-700: #c2c8cf;
    --td-bg: #1d2227;
    --td-surface: #262b31;
    --td-text: #e8eaed;
    --td-border: #e8eaed;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cmp-btn, .cmp-expand, .cmp-switch__track, .cmp-modal__dialog { transition: none !important; animation: none !important; }
  .cmp-btn:hover { transform: none !important; }
}

/* Mobile: Banner-Buttons stacken ab <= 640px, Touch-Targets 44px */
@media (max-width: 640px) {
  .cmp-banner { padding: 16px 14px; }
  .cmp-banner__inner { gap: 12px; }
  .cmp-banner__actions { display: flex; flex-direction: column; gap: 8px; width: 100%; }
  .cmp-banner__actions .cmp-btn { width: 100%; min-height: 44px; }
  /* Dialog am Layout-Viewport verankern — robust gegen Firefox-Android-
     Adressleiste/Zoom (kein vh/dvh-Rechnen, das dort unzuverlaessig ist).
     position:fixed bezieht sich auf den sichtbaren Layout-Viewport. */
  .cmp-modal__dialog {
    position: fixed; inset: 8px; width: auto; max-width: none;
    max-height: none; height: auto; margin: 0;
  }
  .cmp-modal__footer { position: sticky; bottom: 0; }
  .cmp-modal__actions { flex-direction: column; gap: 8px; }
  .cmp-modal__actions .cmp-btn { width: 100%; min-height: 44px; }
}

.cmp-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
  background: var(--td-white); border-top: 3px solid var(--td-primary);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  padding: 20px; font-family: inherit;
}
.cmp-banner[hidden] { display: none; }
.cmp-banner__inner { max-width: 1200px; margin: 0 auto; display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.cmp-banner__content { flex: 1; min-width: 280px; }
.cmp-banner__title { font-weight: 900; font-size: 14px; letter-spacing: 1px; display: block; margin-bottom: 6px; color: var(--td-ink); }
.cmp-banner__text { font-size: 13px; line-height: 1.55; color: var(--td-gray-700); margin: 0 0 8px; }
.cmp-banner__links { font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.cmp-banner__links a { color: var(--td-link); text-decoration: underline; }
.cmp-banner__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.cmp-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 22px; border-radius: 0; border: 1px solid var(--td-ink);
  font-family: inherit; font-weight: 700; font-size: 12px; letter-spacing: 0.5px;
  text-transform: uppercase; cursor: pointer; background: var(--td-white); color: var(--td-ink);
  transition: transform 0.1s ease;
}
.cmp-btn:hover { transform: translateY(-1px); }
.cmp-btn--primary { background: var(--td-btn-bg); color: var(--td-btn-fg); border-color: var(--td-btn-bg); }
.cmp-btn--ghost { background: transparent; }
/* DSGVO-Equal-Choice: "Ablehnen" + "Akzeptieren" identisch prominent (DSK-konform). */
.cmp-btn--equal { background: var(--td-btn-bg); color: var(--td-btn-fg); border-color: var(--td-btn-bg); }
.cmp-btn--equal:hover, .cmp-btn--primary:hover { filter: brightness(0.88); }

.cmp-modal { position: fixed; inset: 0; z-index: 10000; font-family: inherit; }
.cmp-modal[hidden] { display: none; }
.cmp-modal__overlay { position: absolute; inset: 0; background: rgba(17,17,17,0.55); }
.cmp-modal__dialog {
  position: relative; max-width: 680px; width: calc(100% - 40px);
  max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); margin: 20px auto;
  background: var(--td-white); border: 1px solid var(--td-gray-200);
  border-radius: 0; box-shadow: 0 12px 48px rgba(0,0,0,0.28);
  display: flex; flex-direction: column; overflow: hidden;
}
.cmp-modal__close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 40px; height: 40px; border-radius: 0; border: 0;
  background: transparent; cursor: pointer; font-weight: 700; font-size: 20px;
  color: var(--td-ink); line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.cmp-modal__header { padding: 24px 24px 0; border-bottom: 1px solid var(--td-gray-200); flex-shrink: 0; }
.cmp-modal__title { font-weight: 900; font-size: 22px; margin: 0 0 10px; color: var(--td-ink); }
.cmp-modal__intro { font-size: 13px; color: var(--td-gray-700); line-height: 1.5; margin: 0 0 10px; }
.cmp-modal__links { font-size: 12px; margin-bottom: 16px; }
.cmp-modal__links a { color: var(--td-link); text-decoration: underline; margin-right: 12px; }
.cmp-modal__tabs { display: flex; gap: 0; border-bottom: 0; margin: 0 -24px; padding: 0 24px; }
.cmp-tab {
  flex: 1; padding: 14px 8px; background: none; border: 0; border-bottom: 3px solid transparent;
  font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--td-gray-500);
}
.cmp-tab.is-active { color: var(--td-primary); border-bottom-color: var(--td-primary); }

.cmp-modal__body { padding: 20px 24px; overflow-y: auto; flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; }
.cmp-tabpanel { display: none; }
.cmp-tabpanel.is-active { display: block; }

.cmp-cat, .cmp-service {
  border: 1px solid var(--td-gray-200); border-radius: 0;
  padding: 14px 16px; margin-bottom: 10px; transition: border-color 0.15s;
}
.cmp-cat:hover, .cmp-service:hover { border-color: var(--td-gray-300); }
.cmp-cat__head, .cmp-service__head { display: flex; align-items: flex-start; gap: 16px; }
.cmp-cat__meta, .cmp-service__meta { flex: 1; min-width: 0; }
.cmp-cat__name, .cmp-service__name { font-weight: 900; font-size: 14px; display: block; margin-bottom: 4px; color: var(--td-ink); }
.cmp-cat__desc { font-size: 12px; color: var(--td-gray-700); line-height: 1.5; margin: 0; }
.cmp-service__cat { font-size: 11px; color: var(--td-gray-500); }
.cmp-cat__controls, .cmp-service__controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.cmp-cat__services { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--td-gray-200); display: flex; flex-direction: column; gap: 8px; }
.cmp-cat__services[hidden], .cmp-service__detail[hidden] { display: none !important; }
.cmp-cat-service { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }

.cmp-switch { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; }
.cmp-switch--sm { width: 34px; height: 20px; }
.cmp-switch input { position: absolute; opacity: 0; pointer-events: none; }
.cmp-switch__track {
  position: absolute; inset: 0; background: var(--td-gray-300); border-radius: 22px; transition: background 0.2s;
}
.cmp-switch__track::before {
  content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  background: var(--td-white); border-radius: 50%; transition: transform 0.2s;
}
.cmp-switch--sm .cmp-switch__track::before { width: 16px; height: 16px; }
.cmp-switch input:checked ~ .cmp-switch__track { background: var(--td-primary); }
.cmp-switch input:checked ~ .cmp-switch__track::before { transform: translateX(18px); }
.cmp-switch--sm input:checked ~ .cmp-switch__track::before { transform: translateX(14px); }
.cmp-switch.is-locked { opacity: 0.5; cursor: not-allowed; }

.cmp-expand {
  background: none; border: 0; font-size: 16px; font-weight: 900;
  cursor: pointer; color: var(--td-ink); padding: 4px 6px;
  transition: transform 0.2s;
}

.cmp-service__detail { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--td-gray-200); font-size: 13px; }
.cmp-kv { margin-bottom: 14px; }
.cmp-kv__k { font-weight: 700; font-size: 12px; color: var(--td-gray-700); margin-bottom: 4px; }
.cmp-kv__v { font-size: 13px; line-height: 1.5; }
.cmp-kv__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cmp-chip {
  display: inline-block; padding: 4px 10px; border-radius: 6px;
  background: var(--td-gray-100); font-size: 11px; font-weight: 600; color: var(--td-gray-700);
}
.cmp-cookies { display: flex; flex-direction: column; gap: 8px; }
.cmp-cookie { padding: 10px 12px; border: 1px solid var(--td-gray-200); border-radius: 8px; background: var(--td-gray-100); }
.cmp-cookie__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.cmp-cookie__head strong { font-size: 13px; font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; }
.cmp-cookie__type { font-size: 10px; font-weight: 700; letter-spacing: 0.8px; color: var(--td-gray-500); text-transform: uppercase; }
.cmp-cookie__purpose { font-size: 12px; line-height: 1.4; color: var(--td-gray-700); }
.cmp-cookie__duration { font-size: 11px; color: var(--td-gray-500); margin-top: 2px; }

.cmp-filter { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.cmp-filter__btn {
  padding: 6px 14px; border-radius: 50px; border: 2px solid var(--td-gray-200);
  background: var(--td-white); font-family: inherit; font-weight: 600; font-size: 12px;
  cursor: pointer; color: var(--td-gray-700); transition: all 0.15s;
}
.cmp-filter__btn.is-active { border-color: var(--td-ink); color: var(--td-ink); background: var(--td-gray-100); }

.cmp-modal__footer {
  padding: 16px 24px; background: var(--td-gray-100); display: flex; flex-direction: column; gap: 10px;
  border-top: 1px solid var(--td-gray-200); flex-shrink: 0;
}
.cmp-modal__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cmp-modal__actions .cmp-btn { flex: 1; min-width: 120px; }
.cmp-modal__meta { font-size: 11px; color: var(--td-gray-500); text-align: center; font-family: ui-monospace, monospace; word-break: break-all; }
.cmp-modal__meta code { background: var(--td-white); padding: 2px 6px; border-radius: 4px; }

@media (max-width: 640px) {
  .cmp-banner__inner { flex-direction: column; align-items: stretch; }
  .cmp-banner__actions { justify-content: stretch; }
  .cmp-banner__actions .cmp-btn { flex: 1; }
  .cmp-modal__dialog { margin: 0; width: 100%; max-height: 100vh; border-radius: 0; border-width: 0; box-shadow: none; }
}
