/* DCB Cookie Banner – Cookiebot-Style */
:root {
  --dcb-primary: #0073aa;
  --dcb-text:    #1d1d1b;
  --dcb-bg:      #fff;
  --dcb-border:  #e0e0e0;
  --dcb-radius:  4px;
  --dcb-shadow:  0 8px 40px rgba(0,0,0,.22);
}

/* ── Overlay ─────────────────────────────────────────────────────────────── */
#dcb-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99998;
  display: flex; align-items: center; justify-content: center;
}

/* ── Dialog ──────────────────────────────────────────────────────────────── */
#dcb-banner {
  background: var(--dcb-bg);
  color: var(--dcb-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  border-radius: var(--dcb-radius);
  box-shadow: var(--dcb-shadow);
  border-top: 4px solid var(--dcb-primary);
  width: 94%;
  max-width: 700px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  outline: none;
}

/* ── Position & Layout ───────────────────────────────────────────────────── */
/* Ohne Klassen (Mitte + Box) bleibt es der zentrierte Dialog von oben. */
#dcb-overlay.dcb-pos-bottom { align-items: flex-end; }
#dcb-overlay.dcb-pos-top    { align-items: flex-start; }
#dcb-overlay.dcb-pos-bottom.dcb-layout-box,
#dcb-overlay.dcb-pos-top.dcb-layout-box { padding: 20px 0; }

/* Leiste: volle Breite, Inhalt auf --dcb-bar-max zentriert (Theme kann den Wert setzen) */
#dcb-overlay.dcb-layout-bar #dcb-banner {
  --dcb-bar-inline: max(20px, calc((100% - var(--dcb-bar-max, 1200px)) / 2));
  width: 100%;
  max-width: none;
  max-height: 85vh;
  border-radius: 0;
}
#dcb-overlay.dcb-layout-bar .dcb-tabs,
#dcb-overlay.dcb-layout-bar .dcb-panel,
#dcb-overlay.dcb-layout-bar .dcb-banner-btns,
#dcb-overlay.dcb-layout-bar .dcb-links {
  padding-left: var(--dcb-bar-inline);
  padding-right: var(--dcb-bar-inline);
}
#dcb-overlay.dcb-layout-bar .dcb-banner-btns { justify-content: flex-end; }
#dcb-overlay.dcb-layout-bar .dcb-links       { text-align: left; }
#dcb-overlay.dcb-pos-bottom.dcb-layout-bar #dcb-banner { box-shadow: 0 -8px 40px rgba(0,0,0,.18); }
#dcb-overlay.dcb-pos-top.dcb-layout-bar #dcb-banner {
  border-top: 0;
  border-bottom: 4px solid var(--dcb-primary);
}
@media (min-width: 561px) {
  #dcb-overlay.dcb-layout-bar .dcb-btn { flex: 0 1 220px; }
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.dcb-tabs {
  display: flex;
  border-bottom: 1px solid var(--dcb-border);
  padding: 0 20px;
  flex-shrink: 0;
}

.dcb-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 14px 18px 11px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.dcb-tab.active          { color: var(--dcb-primary); border-bottom-color: var(--dcb-primary); }
.dcb-tab:hover:not(.active) { color: #111; }
.dcb-tab:focus-visible   { outline: 3px solid var(--dcb-primary); outline-offset: -2px; border-radius: 3px; }

/* ── Tab panels ──────────────────────────────────────────────────────────── */
.dcb-panel          { padding: 20px 24px; overflow-y: auto; flex: 1; }
.dcb-panel.dcb-hidden { display: none; }

.dcb-banner-logo  { max-height: 48px; max-width: 180px; width: auto; height: auto; display: block; margin-bottom: 14px; object-fit: contain; }
.dcb-banner-title { font-size: 1em; font-weight: 700; margin: 0 0 10px; }
.dcb-banner-text  { margin: 0; color: #444; }

/* ── Categories (Details tab) ────────────────────────────────────────────── */
.dcb-category { border-bottom: 1px solid var(--dcb-border); padding: 14px 0; }
.dcb-category:last-child { border-bottom: none; }

.dcb-category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  border-radius: 3px;
}
.dcb-category-header:focus-visible {
  outline: 3px solid var(--dcb-primary);
  outline-offset: 3px;
}

.dcb-cat-chevron {
  color: #888;
  font-size: 11px;
  width: 14px;
  flex-shrink: 0;
  transition: transform .2s;
  line-height: 1;
}
.dcb-cat-chevron.open { transform: rotate(90deg); }

.dcb-cat-name  { font-weight: 700; flex: 1; font-size: 14px; }

.dcb-cat-count {
  display: inline-block;
  background: var(--dcb-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}

.dcb-cat-always {
  font-size: 12px;
  font-weight: 400;
  color: #666; /* 5.74:1 on white – WCAG 1.4.3 AA ✓ */
}

/* Toggle switch */
.dcb-toggle { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.dcb-toggle input { opacity: 0; width: 0; height: 0; }
.dcb-slider {
  position: absolute; inset: 0;
  background: #3a3a3a;
  border-radius: 26px;
  cursor: pointer;
  transition: background .2s;
}
.dcb-slider::before {
  content: '';
  position: absolute;
  left: 3px; bottom: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.dcb-toggle input:checked   + .dcb-slider { background: var(--dcb-primary); }
.dcb-toggle input:checked   + .dcb-slider::before { transform: translateX(20px); }
.dcb-toggle input:disabled  + .dcb-slider { opacity: .65; cursor: not-allowed; }
.dcb-toggle input:focus-visible + .dcb-slider { outline: 3px solid var(--dcb-primary); outline-offset: 2px; }

.dcb-category-desc {
  font-size: 13px;
  color: #555;
  margin: 8px 0 0 22px;
  display: none;
}
.dcb-category-desc.open { display: block; }

/* ── Cookie table inside category accordion ──────────────────────────────── */
.dcb-cat-desc-text { margin: 0 0 10px; }

#dcb-banner .dcb-inner-table {
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: 13px !important;
  margin-top: 8px !important;
  table-layout: auto !important;
}
#dcb-banner .dcb-inner-table th,
#dcb-banner .dcb-inner-table td {
  border: 1px solid #e0e0e0 !important;
  padding: 8px 10px !important;
  text-align: left !important;
  vertical-align: top !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
  color: #444 !important;
  background: #fff !important;
  box-shadow: none !important;
}
#dcb-banner .dcb-inner-table thead tr th {
  background: #f5f5f5 !important;
  font-weight: 600 !important;
  color: #333 !important;
  white-space: nowrap !important;
}
#dcb-banner .dcb-inner-table code {
  background: #f0f0f0 !important;
  color: #333 !important;
  padding: 2px 5px !important;
  border-radius: 3px !important;
  font-size: 12px !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace !important;
  border: none !important;
}

/* ── About tab ───────────────────────────────────────────────────────────── */
.dcb-about-text       { color: #444; }
.dcb-about-text p     { margin: 0 0 12px; }
.dcb-about-text p:last-child { margin-bottom: 0; }
.dcb-about-text a     { color: var(--dcb-primary); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.dcb-banner-btns {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--dcb-border);
  flex-shrink: 0;
}

.dcb-btn {
  flex: 1;
  padding: 12px 14px;
  border-radius: var(--dcb-radius);
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--dcb-primary);
  color: #fff;
  transition: filter .15s;
}
.dcb-btn:hover        { filter: brightness(1.12); }
.dcb-btn:focus-visible { outline: 3px solid var(--dcb-primary); outline-offset: 2px; filter: brightness(1.12); }

/* ── Footer links ────────────────────────────────────────────────────────── */
.dcb-links {
  font-size: 12px;
  color: #666; /* 5.74:1 on white – WCAG 1.4.3 AA ✓ */
  text-align: center;
  padding: 6px 20px 12px;
  flex-shrink: 0;
}
.dcb-links a { color: #666; }
.dcb-links a:hover { color: #333; }

/* ── Page overlay (Impressum / Datenschutz) ──────────────────────────────── */
#dcb-page-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 99999;
  display: flex; align-items: center; justify-content: center;
}

#dcb-page-modal {
  background: var(--dcb-bg);
  border-radius: var(--dcb-radius);
  box-shadow: var(--dcb-shadow);
  border-top: 4px solid var(--dcb-primary);
  width: 94%;
  max-width: 860px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#dcb-page-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--dcb-border);
  flex-shrink: 0;
}

#dcb-page-modal-title {
  font-weight: 700;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#dcb-page-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: #555;
  line-height: 1;
  padding: 4px 6px;
  border-radius: var(--dcb-radius);
  transition: color .15s;
}
#dcb-page-close:hover       { color: #111; }
#dcb-page-close:focus-visible { outline: 3px solid var(--dcb-primary); outline-offset: 2px; }

#dcb-page-iframe {
  flex: 1;
  border: none;
  width: 100%;
}

@media (max-width: 560px) {
  #dcb-page-modal { height: 90vh; }
}

/* ── Floating re-open button ─────────────────────────────────────────────── */
#dcb-float-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 99997;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--dcb-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  box-shadow: 0 2px 12px rgba(0,0,0,.28);
  transition: filter .15s;
}
#dcb-float-btn:hover        { filter: brightness(1.12); }
#dcb-float-btn:focus-visible { outline: 3px solid var(--dcb-primary); outline-offset: 3px; }

/* ── Cookie list shortcode ───────────────────────────────────────────────── */
.dcb-cookie-category { margin-bottom: 30px; }
.dcb-cookie-category h3 { font-size: 1.1em; border-bottom: 2px solid var(--dcb-primary); padding-bottom: 6px; margin-bottom: 8px; }
.dcb-cookie-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dcb-cookie-table th, .dcb-cookie-table td { border: 1px solid rgba(128,128,128,.35); padding: 8px 10px; text-align: left; color: inherit; }
/* Durchscheinend statt fest hell: bleibt auf hellen und dunklen Themes lesbar */
.dcb-cookie-table th { background: rgba(128,128,128,.15); font-weight: 600; }
.dcb-cookie-table code { background: rgba(128,128,128,.2); color: inherit; padding: 2px 5px; border-radius: 3px; font-size: 12px; }
.dcb-last-scan { color: #888; margin-bottom: 16px; }
.dcb-reopen-banner { background: var(--dcb-primary); color: #fff; border: none; padding: 8px 16px; border-radius: 5px; cursor: pointer; font-size: 14px; }
.dcb-block-hint { margin-top: 6px; font-size: 12px; color: #888; }
.dcb-block-hint code { background: #f4f4f4; padding: 1px 5px; border-radius: 3px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  #dcb-banner     { max-height: 95vh; }
  .dcb-tabs       { padding: 0 12px; }
  .dcb-tab        { padding: 12px 10px 9px; font-size: 13px; }
  .dcb-panel      { padding: 16px; }
  .dcb-banner-btns { flex-direction: column; padding: 12px 16px; gap: 6px; }
  .dcb-links      { padding: 4px 16px 10px; }
}

/* ── Schutz gegen globale Button-Stile ───────────────────────────────────────
   Page-Builder und Themes färben oft jeden <button> – Elementor-Kits etwa mit
   „.elementor-kit-N button" (0,1,1). Die Klassenregeln oben (0,1,0) verlieren
   dagegen: im Live-Test war der aktive Reiter Schrift auf gleichfarbigem Grund.
   Das ID-Präfix hebt die Banner-Regeln darüber (1,1,0), ohne !important. */
#dcb-banner .dcb-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  box-shadow: none;
  min-height: 0;
  padding: 14px 18px 11px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
  color: #555;
}
#dcb-banner .dcb-tab.active             { background: none; color: var(--dcb-primary); border-bottom-color: var(--dcb-primary); }
#dcb-banner .dcb-tab:hover:not(.active) { background: none; color: #111; }

#dcb-banner .dcb-btn {
  background: var(--dcb-primary);
  color: #fff;
  border: none;
  border-radius: var(--dcb-radius);
  box-shadow: none;
  min-height: 0;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
}
#dcb-banner .dcb-btn:hover,
#dcb-banner .dcb-btn:focus { background: var(--dcb-primary); color: #fff; }

@media (max-width: 560px) {
  #dcb-banner .dcb-tab { padding: 12px 10px 9px; font-size: 13px; }
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #dcb-banner, .dcb-btn, .dcb-slider, .dcb-slider::before, .dcb-cat-chevron, .dcb-tab {
    transition: none !important;
    animation: none !important;
  }
}
