/* ============================================================
   COOKIE / CONSENT BANNER
   Transport & Hausmeisterservice Oettinger
   - DSGVO/TTDSG-konform (Opt-in, gleichwertige Buttons)
   - Google Consent Mode v2
   - Styles angelehnt an style.css (Sage/Mintgrün)
   ============================================================ */

:root {
  --cb-color-primary: #5e9470;
  --cb-color-primary-hover: #4a7a5a;
  --cb-color-text: #2c2e2c;
  --cb-color-muted: #6b7c6b;
  --cb-color-bg: #ffffff;
  --cb-color-border: #daeada;
  --cb-color-shadow: rgba(44, 80, 55, 0.18);
  --cb-radius: 14px;
  --cb-z: 999999;
}

/* ---------- Overlay (deaktiviert Klicks dahinter) ---------- */
.cb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: var(--cb-z);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  animation: cb-fade 0.25s ease-out;
}

.cb-overlay.cb-hide {
  display: none !important;
}

@keyframes cb-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ---------- Haupt-Banner (unten zentriert) ---------- */
.cb-banner {
  background: var(--cb-color-bg);
  color: var(--cb-color-text);
  border-radius: var(--cb-radius);
  box-shadow: 0 10px 40px var(--cb-color-shadow);
  border: 1px solid var(--cb-color-border);
  max-width: 720px;
  width: 100%;
  padding: 24px 26px 22px;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  margin-bottom: max(16px, env(safe-area-inset-bottom));
  animation: cb-slide-up 0.35s ease-out;
}

@keyframes cb-slide-up {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.cb-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--cb-color-text);
}

.cb-text {
  margin: 0 0 18px;
  color: var(--cb-color-muted);
  font-size: 14.5px;
}

.cb-text a {
  color: var(--cb-color-primary);
  text-decoration: underline;
}

.cb-text a:hover {
  color: var(--cb-color-primary-hover);
}

/* ---------- Buttons ---------- */
.cb-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cb-btn {
  flex: 1 1 auto;
  min-width: 130px;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.05s ease;
  font-family: inherit;
  text-align: center;
  white-space: nowrap;
}

.cb-btn:active {
  transform: translateY(1px);
}

.cb-btn-primary {
  background: var(--cb-color-primary);
  color: #fff;
}

.cb-btn-primary:hover {
  background: var(--cb-color-primary-hover);
}

.cb-btn-secondary {
  background: #fff;
  color: var(--cb-color-text);
  border-color: var(--cb-color-border);
}

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

.cb-btn-ghost {
  background: transparent;
  color: var(--cb-color-muted);
  border-color: transparent;
  text-decoration: underline;
  padding: 11px 8px;
}

.cb-btn-ghost:hover {
  color: var(--cb-color-text);
}

/* ---------- Modal: Detaillierte Einstellungen ---------- */
.cb-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: calc(var(--cb-z) + 1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: cb-fade 0.2s ease-out;
}

.cb-modal-backdrop.cb-hide {
  display: none !important;
}

.cb-modal {
  background: var(--cb-color-bg);
  color: var(--cb-color-text);
  border-radius: var(--cb-radius);
  border: 1px solid var(--cb-color-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  animation: cb-slide-up 0.3s ease-out;
}

.cb-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--cb-color-border);
}

.cb-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.cb-modal-close {
  background: transparent;
  border: 0;
  font-size: 26px;
  line-height: 1;
  color: var(--cb-color-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.cb-modal-close:hover {
  background: #f0f8f2;
  color: var(--cb-color-text);
}

.cb-modal-body {
  padding: 18px 24px;
}

.cb-modal-intro {
  color: var(--cb-color-muted);
  font-size: 14px;
  margin: 0 0 14px;
}

.cb-category {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--cb-color-border);
}

.cb-category:last-child {
  border-bottom: 0;
}

.cb-category-info {
  flex: 1 1 auto;
  min-width: 0;
}

.cb-category-name {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--cb-color-text);
}

.cb-category-desc {
  margin: 0;
  font-size: 13px;
  color: var(--cb-color-muted);
  line-height: 1.45;
}

/* ---------- Toggle Switch ---------- */
.cb-toggle {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  margin-top: 2px;
}

.cb-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cb-toggle-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 999px;
  transition: background 0.2s ease;
  cursor: pointer;
}

.cb-toggle-slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.cb-toggle input:checked+.cb-toggle-slider {
  background: var(--cb-color-primary);
}

.cb-toggle input:checked+.cb-toggle-slider::before {
  transform: translateX(20px);
}

.cb-toggle input:disabled+.cb-toggle-slider {
  background: var(--cb-color-primary);
  opacity: 0.55;
  cursor: not-allowed;
}

.cb-toggle-always {
  font-size: 12px;
  color: var(--cb-color-muted);
  margin-left: 6px;
  white-space: nowrap;
  align-self: center;
}

.cb-modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--cb-color-border);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

/* ---------- Mobile Anpassungen ---------- */
@media (max-width: 540px) {
  .cb-banner {
    padding: 18px 18px 16px;
    font-size: 14px;
  }

  .cb-title {
    font-size: 16px;
  }

  .cb-text {
    font-size: 13.5px;
  }

  .cb-buttons {
    flex-direction: column;
  }

  .cb-btn {
    width: 100%;
    min-width: 0;
  }

  .cb-modal-header,
  .cb-modal-body,
  .cb-modal-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .cb-modal-footer {
    flex-direction: column-reverse;
  }

  .cb-modal-footer .cb-btn {
    width: 100%;
  }
}