/* ==========================================================================
   I.DO.ONE Consent-Banner
   Dark Glassmorphism – SaaS Tech Look
   Alle Regeln sind auf .ido-consent* gescoped
   ========================================================================== */

/* --------------------------------------------------------------------------
   Container / Positionierung
   -------------------------------------------------------------------------- */
.ido-consent {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 100%;
  max-width: 460px;
  z-index: 99990;
  animation: ido-consent-slide-in 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
  font-family: inherit;
}

.ido-consent--hidden {
  display: none !important;
}

@keyframes ido-consent-slide-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --------------------------------------------------------------------------
   Glass-Card
   -------------------------------------------------------------------------- */
.ido-consent__card {
  background: rgba(3, 25, 38, 0.94);
  border: 1px solid rgba(var(--accent-color-rgb, 0, 221, 204), 0.22);
  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(var(--accent-color-rgb, 0, 221, 204), 0.06) inset;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 18px;
  overflow: hidden;
  padding: 24px 26px 20px;
  color: #e8f4f8;
}

/* Dezenter Accent-Streifen oben */
.ido-consent__card::before {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(var(--accent-color-rgb, 0, 221, 204), 0.7) 40%,
    rgba(var(--accent-color-rgb, 0, 221, 204), 0.7) 60%,
    transparent 100%
  );
  margin: -24px -26px 20px;
}

/* --------------------------------------------------------------------------
   Header-Bereich
   -------------------------------------------------------------------------- */
.ido-consent__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.ido-consent__icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(var(--accent-color-rgb, 0, 221, 204), 0.12);
  border: 1px solid rgba(var(--accent-color-rgb, 0, 221, 204), 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color, #00ddcc);
  font-size: 15px;
}

.ido-consent__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.02em;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Beschreibungstext
   -------------------------------------------------------------------------- */
.ido-consent__text {
  font-size: 0.82rem;
  line-height: 1.6;
  color: rgba(232, 244, 248, 0.75);
  margin-bottom: 20px;
}

.ido-consent__text a {
  color: var(--accent-color, #00ddcc);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ido-consent__text a:hover {
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.ido-consent__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ido-consent__actions-row {
  display: flex;
  gap: 8px;
}

.ido-consent__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.1s ease;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  font-family: inherit;
}

.ido-consent__btn:focus-visible {
  outline: 2px solid var(--accent-color, #00ddcc);
  outline-offset: 2px;
}

.ido-consent__btn:active {
  transform: scale(0.97);
}

/* Primär: Alle akzeptieren */
.ido-consent__btn--primary {
  background: var(--accent-color, #00ddcc);
  color: #031926;
  border-color: var(--accent-color, #00ddcc);
  flex: 1;
}

.ido-consent__btn--primary:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: #031926;
  box-shadow: 0 4px 18px rgba(var(--accent-color-rgb, 0, 221, 204), 0.35);
}

/* Sekundär: Nur notwendige */
.ido-consent__btn--secondary {
  background: transparent;
  color: rgba(232, 244, 248, 0.85);
  border-color: rgba(255, 255, 255, 0.18);
  flex: 1;
}

.ido-consent__btn--secondary:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

/* Tertiär: Einstellungen */
.ido-consent__btn--tertiary {
  background: transparent;
  color: rgba(var(--accent-color-rgb, 0, 221, 204), 0.8);
  border-color: rgba(var(--accent-color-rgb, 0, 221, 204), 0.18);
  width: 100%;
  font-weight: 500;
}

.ido-consent__btn--tertiary:hover {
  background: rgba(var(--accent-color-rgb, 0, 221, 204), 0.08);
  border-color: rgba(var(--accent-color-rgb, 0, 221, 204), 0.4);
  color: var(--accent-color, #00ddcc);
}

/* --------------------------------------------------------------------------
   Einstellungs-Panel (Settings-Layer)
   -------------------------------------------------------------------------- */
.ido-consent__settings {
  display: none;
  margin-top: 4px;
}

.ido-consent__settings--open {
  display: block;
}

.ido-consent__settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.ido-consent__settings-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
}

.ido-consent__settings-close {
  background: transparent;
  border: none;
  color: rgba(232, 244, 248, 0.5);
  cursor: pointer;
  font-size: 18px;
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s ease, background 0.15s ease;
  font-family: inherit;
}

.ido-consent__settings-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.ido-consent__settings-close:focus-visible {
  outline: 2px solid var(--accent-color, #00ddcc);
  outline-offset: 2px;
}

.ido-consent__settings-intro {
  font-size: 0.78rem;
  line-height: 1.55;
  color: rgba(232, 244, 248, 0.65);
  margin-bottom: 16px;
}

/* --------------------------------------------------------------------------
   Kategorien
   -------------------------------------------------------------------------- */
.ido-consent__categories {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
  /* max-height auf 2 Kategorien ausgelegt; bei mehr Kategorien erhöhen */
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}

.ido-consent__categories::-webkit-scrollbar {
  width: 4px;
}

.ido-consent__categories::-webkit-scrollbar-track {
  background: transparent;
}

.ido-consent__categories::-webkit-scrollbar-thumb {
  background: rgba(var(--accent-color-rgb, 0, 221, 204), 0.3);
  border-radius: 4px;
}

.ido-consent__category {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: border-color 0.18s ease, background 0.18s ease;
}

.ido-consent__category:hover {
  border-color: rgba(var(--accent-color-rgb, 0, 221, 204), 0.15);
  background: rgba(var(--accent-color-rgb, 0, 221, 204), 0.03);
}

.ido-consent__category-info {
  flex: 1;
  min-width: 0;
}

.ido-consent__category-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: #e8f4f8;
  margin-bottom: 2px;
}

.ido-consent__category-desc {
  font-size: 0.75rem;
  line-height: 1.5;
  color: rgba(232, 244, 248, 0.55);
}

/* --------------------------------------------------------------------------
   Toggle-Switch
   -------------------------------------------------------------------------- */
.ido-consent__toggle-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-top: 2px;
}

.ido-consent__toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.ido-consent__toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.ido-consent__toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ido-consent__toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transition: transform 0.2s ease, background 0.2s ease;
}

.ido-consent__toggle input:checked + .ido-consent__toggle-slider {
  background: var(--accent-color, #00ddcc);
  border-color: var(--accent-color, #00ddcc);
  box-shadow: 0 0 10px rgba(var(--accent-color-rgb, 0, 221, 204), 0.35);
}

.ido-consent__toggle input:checked + .ido-consent__toggle-slider::before {
  transform: translateX(18px) translateY(-50%);
  background: #031926;
}

.ido-consent__toggle input:focus-visible + .ido-consent__toggle-slider {
  outline: 2px solid var(--accent-color, #00ddcc);
  outline-offset: 2px;
}

/* Deaktiviert (Essenziell) */
.ido-consent__toggle input:disabled + .ido-consent__toggle-slider {
  opacity: 1;
  cursor: not-allowed;
  background: rgba(var(--accent-color-rgb, 0, 221, 204), 0.45);
  border-color: rgba(var(--accent-color-rgb, 0, 221, 204), 0.4);
}

.ido-consent__toggle input:disabled:checked + .ido-consent__toggle-slider {
  background: rgba(var(--accent-color-rgb, 0, 221, 204), 0.45);
}

.ido-consent__toggle input:disabled + .ido-consent__toggle-slider::before {
  transform: translateX(18px) translateY(-50%);
  background: rgba(3, 25, 38, 0.7);
}

/* Essenziell-Badge */
.ido-consent__category--essential .ido-consent__category-name::after {
  content: 'Immer aktiv';
  display: inline-block;
  margin-left: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-color, #00ddcc);
  background: rgba(var(--accent-color-rgb, 0, 221, 204), 0.1);
  border: 1px solid rgba(var(--accent-color-rgb, 0, 221, 204), 0.2);
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: middle;
}

/* --------------------------------------------------------------------------
   Settings-Footer
   -------------------------------------------------------------------------- */
.ido-consent__settings-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.ido-consent__settings-link {
  text-align: center;
  font-size: 0.75rem;
  color: rgba(232, 244, 248, 0.45);
}

.ido-consent__settings-link a {
  color: rgba(var(--accent-color-rgb, 0, 221, 204), 0.65);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

.ido-consent__settings-link a:hover {
  color: var(--accent-color, #00ddcc);
}

/* --------------------------------------------------------------------------
   Divider
   -------------------------------------------------------------------------- */
.ido-consent__divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  margin: 16px 0;
}

/* --------------------------------------------------------------------------
   Backdrop (für Settings als Overlay bei Mobile)
   -------------------------------------------------------------------------- */
.ido-consent__backdrop {
  display: none;
}

/* --------------------------------------------------------------------------
   Responsive – Mobile Bottom-Sheet
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  .ido-consent {
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 100%;
    animation: ido-consent-slide-up 0.36s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  @keyframes ido-consent-slide-up {
    from {
      opacity: 0;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .ido-consent__card {
    border-radius: 18px 18px 0 0;
    padding: 20px 18px 24px;
    max-height: 90dvh;
    overflow-y: auto;
  }

  .ido-consent__card::before {
    margin: -20px -18px 16px;
  }

  .ido-consent__actions-row {
    flex-direction: column;
  }

  .ido-consent__btn {
    padding: 12px 16px;
    font-size: 0.88rem;
  }

  .ido-consent__btn--primary,
  .ido-consent__btn--secondary {
    width: 100%;
    flex: none;
  }

  .ido-consent__categories {
    /* Mobile: bei 2 Kategorien passt alles ohne Scroll */
    max-height: 160px;
  }

  .ido-consent__settings-actions {
    flex-direction: column;
  }
}

/* --------------------------------------------------------------------------
   Reduzierte Bewegung
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .ido-consent,
  .ido-consent__btn,
  .ido-consent__toggle-slider,
  .ido-consent__toggle-slider::before {
    animation: none !important;
    transition: none !important;
  }
}
