/* Consent banner — uses tokens.css variables */

.khc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 19, 0.45);
  z-index: 1000;
  display: none; /* shown only on mobile and in expanded mode */
}

.khc-dialog {
  position: fixed;
  left: 24px;
  right: 24px;
  bottom: 24px;
  z-index: 1001;
  background: var(--et-ivory);
  border: 2px solid var(--et-terracotta);
  border-radius: var(--et-r-md);
  padding: 20px 24px;
  box-shadow: 0 12px 40px rgba(20, 20, 19, 0.14);
  outline: none;
}

/* Show overlay when expanded view is visible */
.khc-dialog:has(#khc-expanded:not([hidden])) ~ .khc-overlay,
.khc-dialog:has(#khc-expanded:not([hidden])) + .khc-overlay {
  display: block;
}

/* --- Title / description --- */

.khc-title {
  font-family: var(--et-serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--et-near-black);
  margin: 0 0 8px;
}

.khc-desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--et-olive);
  margin: 0 0 16px;
}

.khc-link {
  color: var(--et-terracotta);
  text-decoration: underline;
  text-decoration-color: rgba(201, 100, 66, 0.4);
}

/* --- Buttons --- */

.khc-actions {
  display: flex;
  gap: 8px;
}

.khc-btn {
  flex: 1;
  padding: 10px 12px;
  font-family: var(--et-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  border: 1.5px solid var(--et-border-warm);
  border-radius: var(--et-r);
  background: var(--et-ivory);
  color: var(--et-charcoal);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.khc-btn:hover {
  background: var(--et-sand);
  border-color: var(--et-ring-warm);
}

.khc-btn:focus-visible {
  outline: 2px solid var(--et-focus);
  outline-offset: 2px;
}

/* "Auswahl speichern" in expanded view gets terracotta fill */
.khc-btn-save {
  background: var(--et-terracotta);
  color: var(--et-ivory);
  border-color: var(--et-terracotta);
}

.khc-btn-save:hover {
  background: #bb5a3a;
  border-color: #bb5a3a;
}

/* --- Expanded category rows --- */

.khc-expanded:not([hidden]) {
  display: flex;
  flex-direction: column;
}

.khc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--et-border-cream);
}

.khc-row + .khc-actions {
  margin-top: 16px;
}

.khc-row-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.khc-row-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--et-near-black);
}

.khc-row-desc {
  font-size: 12px;
  color: var(--et-stone);
  line-height: 1.45;
}

/* --- Toggle switch --- */

.khc-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}

.khc-toggle input {
  opacity: 0;
  position: absolute;
  width: 0;
  height: 0;
}

.khc-track {
  position: absolute;
  inset: 0;
  background: var(--et-sand);
  border-radius: 22px;
  transition: background 0.2s;
}

.khc-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--et-white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.khc-toggle input:checked + .khc-track {
  background: var(--et-terracotta);
}

.khc-toggle input:checked + .khc-track::after {
  transform: translateX(18px);
}

.khc-toggle-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* --- Mobile bottom sheet (<600px) --- */

@media (max-width: 599px) {
  .khc-overlay {
    display: block; /* always visible on mobile when banner is open */
  }

  .khc-dialog {
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 18px 18px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding: 16px 20px 40px; /* extra bottom for safe-area */
  }

  .khc-actions {
    flex-direction: column;
  }

  .khc-btn {
    width: 100%;
    padding: 14px 16px;
    font-size: 14px;
    min-height: 44px; /* WCAG touch target */
  }
}
