/* cookie-banner.css */

/* ===== Overlay und Dialog ===== */
.cookie-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.cookie-overlay.active { opacity: 1; pointer-events: all; }

/* Bewegungen reduzieren */
@media (prefers-reduced-motion: reduce) {
  .cookie-overlay,
  .cookie-banner,
  .cookie-btn,
  .slider,
  .cookie-settings-icon {
    transition: none !important;
  }
}

/* ===== Banner ===== */
.cookie-banner {
  background: #eadfd9;
  color: #1b2330;
  width: 100%;
  max-width: 100%;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
  transform: translateY(100%);
  transition: transform 0.25s ease;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid rgba(17,24,39,0.08);
}
.cookie-overlay.active .cookie-banner { transform: translateY(0); }

.cookie-content { padding: 22px; font-size: 15px; line-height: 1.6; }
.cookie-title { font-size: 20px; font-weight: 700; margin-bottom: 12px; color: #0f172a; }

/* Text und Links */
.cookie-text { margin-bottom: 20px; color: #374151; }
.cookie-text a {
  color: #1740ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cookie-text a:hover,
.cookie-text a:focus-visible { text-decoration-thickness: 2px; }

/* ===== Kategorien und Schalter ===== */
.cookie-category {
  background: #f7f9fc;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(17,24,39,0.06);
}
.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.category-title { font-weight: 600; font-size: 16px; color: #111827; }
.category-description { font-size: 14px; color: #4b5563; line-height: 1.55; }

/* Visuell versteckt */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* Schalter */
.toggle-switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute; inset: 0;
  cursor: pointer;
  background-color: #d1d5db;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
  border-radius: 26px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}
.slider::before {
  position: absolute; content: "";
  height: 20px; width: 20px; left: 3px; top: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}

/* Aktiv */
.toggle-switch input:checked + .slider { background-color: #1740ff; }
.toggle-switch input:checked + .slider::before { transform: translateX(20px); }

/* Deaktiviert */
.toggle-switch input:disabled + .slider { background-color: #e5e7eb; cursor: not-allowed; opacity: 0.7; }
.toggle-switch input:disabled + .slider::before { background-color: #f3f4f6; }

/* Tastaturfokus */
.toggle-switch input:focus-visible + .slider {
  outline: 2px solid transparent;
  box-shadow: 0 0 0 3px rgba(23,64,255,0.35);
}

/* ===== Buttons ===== */
.cookie-buttons {
  display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px;
}
.cookie-btn {
  flex: 1; min-width: 120px; padding: 14px 20px;
  border-radius: 8px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

/* Primär */
.btn-accept, .btn-save {
  background: #c9bdb0;
  color: #ffffff;
  border-color: #1740ff;
}
.btn-accept:hover, .btn-save:hover { filter: brightness(1.04); }
.btn-accept:focus-visible, .btn-save:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(23,64,255,0.35);
}

/* Sekundär */
.btn-settings, .btn-reject {
  background: #eadfd9;
  color: #1f2a44;
  border-color: rgba(23,64,255,0.25);
}
.btn-settings:hover, .btn-reject:hover { filter: brightness(0.98); }
.btn-settings:focus-visible, .btn-reject:focus-visible {
  outline: 2px solid rgba(23,64,255,0.6);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(23,64,255,0.25);
}

/* Speichern in der Einstellungsansicht ganz breit */
.btn-save { width: 100%; }

/* Mobil Anordnung */
@media (max-width: 480px) {
  .cookie-buttons { flex-direction: column; }
  .cookie-btn { width: 100%; }
  .cookie-content { padding: 18px; }
}

/* Schwebendes Zahnrad */
.cookie-settings-icon {
  width: 50px; height: 50px; border-radius: 50%;
  background: #eadfd9;
  color: #1740ff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.16), 0 0 0 1px rgba(17,24,39,0.06) inset;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  user-select: none;
  border: 1px solid rgba(23,64,255,0.25);
}
.cookie-settings-icon:hover {
  transform: scale(1.08);
  background: #f5f7ff;
  box-shadow: 0 8px 20px rgba(0,0,0,0.18), 0 0 0 1px rgba(17,24,39,0.08) inset;
}
.cookie-settings-icon:focus-visible {
  outline: 2px solid #1740ff; outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(23,64,255,0.25);
}

/* Mobil Buttons stets sichtbar Inhalt scrollt intern */
@media (max-width: 640px) {
  .cookie-banner {
    display: flex;
    flex-direction: column;
    max-height: 100vh;
    height: auto;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .cookie-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 0;
  }

  .cookie-categories {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    max-height: none;
    flex: 1 1 auto;
  }

  .cookie-buttons {
    position: sticky;
    bottom: 0;
    margin-top: 0;
    padding: 12px 16px;
    background:
      linear-gradient(to top, rgba(255,255,255,1), rgba(255,255,255,0.92))
      , #ffffff;
    border-top: 1px solid rgba(17,24,39,0.08);
    z-index: 1;
  }

  .cookie-btn {
    min-height: 48px;
    width: 100%;
    flex: 1 0 auto;
  }
}

/* Kompakt Ansicht ohne Kategorien und ohne Savebar */
.cookie-banner.compact .cookie-categories { display: none; }
.cookie-banner.compact .settings-save { display: none; }

/* Extra Kompakt auf sehr kleinen Screens */
@media (max-width: 360px) {
  .cookie-title { font-size: 18px; }
  .category-description { font-size: 13px; }
  .toggle-switch { width: 42px; height: 24px; }
  .slider::before { width: 18px; height: 18px; }
  .toggle-switch input:checked + .slider::before { transform: translateX(18px); }
}