/* =====================================================================
   ULT Laserspeed OEM — Cookie-Consent UI
   Nutzt die Design-Tokens aus style.css (Farben, Radius, Elevation,
   Buttons via .btn). Banner + Einstellungs-Center + Floating-Button.
   ===================================================================== */

/* Scroll-Lock, wenn das Modal offen ist */
html.cc-lock { overflow: hidden; }

/* [hidden] muss die display-Regeln unten schlagen (sonst waeren
   Overlay/FAB/Banner trotz hidden-Attribut sichtbar). */
.cc-banner[hidden],
.cc-overlay[hidden],
.cc-fab[hidden],
.cc-cat-panel[hidden] { display: none !important; }

.cc-root {
  font-family: 'Roboto', sans-serif;
  color: var(--foreground);
}

/* ---------------------------------------------------------------------
   Banner (helle Karte, unten fixiert)
   --------------------------------------------------------------------- */
.cc-banner {
  position: fixed;
  left: 50%;
  bottom: clamp(0.75rem, 2vw, 1.5rem);
  transform: translateX(-50%);
  width: min(1100px, calc(100% - 2rem));
  z-index: 1000;
  background: var(--card);
  border: 1px solid rgba(0, 78, 168, 0.15);
  border-radius: var(--radius-lg);
  box-shadow: var(--elevation-sm);
  animation: cc-slide-up .35s ease-out;
}
@keyframes cc-slide-up {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .cc-banner { animation: none; }
}

.cc-banner-inner {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.5rem);
  padding: clamp(1.1rem, 2.5vw, 1.75rem);
}
.cc-banner-text { flex: 1 1 auto; }
.cc-banner-title {
  font-size: var(--text-h4);
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.cc-banner-body {
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--foreground);
  max-width: 62ch;
}

.cc-banner-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  min-width: 220px;
}
.cc-banner-actions .btn { width: 100%; min-height: 48px; }

/* Sekundärer Text-Link (Einstellungen) */
.cc-link {
  background: none;
  border: 0;
  padding: 0.25rem 0;
  color: var(--foreground);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  align-self: center;
}
.cc-link:hover { color: var(--primary); }

/* Rechtliche Links (Datenschutz/Impressum) */
.cc-legal {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}
.cc-legal a {
  font-size: var(--text-sm);
  color: var(--secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.cc-legal a:hover { color: var(--primary); }

/* ---------------------------------------------------------------------
   Modal / Einstellungs-Center
   --------------------------------------------------------------------- */
.cc-overlay {
  position: fixed;
  inset: 0;
  z-index: 1001;
  background: rgba(0, 30, 66, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 3vw, 2rem);
  animation: cc-fade .2s ease-out;
}
@keyframes cc-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cc-overlay { animation: none; } }

.cc-modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--elevation-md);
  width: min(680px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cc-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1.1rem, 2.5vw, 1.6rem) clamp(1.25rem, 3vw, 2rem);
  border-bottom: 1px solid var(--muted);
}
.cc-modal-title { font-size: var(--text-h3); font-weight: 700; }
.cc-close {
  background: none; border: 0; cursor: pointer;
  font-size: 2rem; line-height: 1; color: var(--muted-foreground);
  width: 44px; height: 44px; border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cc-close:hover { color: var(--primary); background: var(--canvas); }

.cc-modal-body {
  padding: clamp(1rem, 2.5vw, 1.6rem) clamp(1.25rem, 3vw, 2rem);
  overflow-y: auto;
}
.cc-modal-intro {
  font-size: var(--text-sm);
  line-height: 1.55;
  margin-bottom: 1.25rem;
}
.cc-modal-intro .cc-legal { display: inline-flex; margin: 0 0 0 0.25rem; gap: 1rem; vertical-align: baseline; }

/* Kategorie-Block */
.cc-cat {
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}
.cc-cat.is-open { border-color: rgba(0, 78, 168, 0.35); }
.cc-cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
}
.cc-cat-toggle {
  display: flex; align-items: center; gap: 0.6rem;
  background: none; border: 0; cursor: pointer;
  font-size: var(--text-base); font-weight: 700;
  color: var(--foreground); text-align: left; flex: 1 1 auto;
}
.cc-caret {
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid currentColor;
  transition: transform .2s ease-out;
  flex-shrink: 0;
}
.cc-cat-toggle[aria-expanded="true"] .cc-caret { transform: rotate(180deg); }
.cc-cat-name { line-height: 1.2; }

.cc-cat-panel {
  padding: 0 1rem 1rem;
  border-top: 1px dashed var(--muted);
}
.cc-cat-desc {
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--foreground);
  margin: 0.85rem 0;
}

/* „Immer aktiv“-Badge (Essenziell) */
.cc-always {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Toggle-Switch */
.cc-switch {
  position: relative;
  display: inline-block;
  width: 46px; height: 26px;
  flex-shrink: 0;
}
.cc-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.cc-slider {
  position: absolute; inset: 0;
  background: var(--muted);
  border-radius: 999px;
  transition: background .2s ease-out;
  cursor: pointer;
}
.cc-slider::before {
  content: '';
  position: absolute;
  height: 20px; width: 20px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s ease-out;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.cc-switch input:checked + .cc-slider { background: var(--primary); }
.cc-switch input:checked + .cc-slider::before { transform: translateX(20px); }
.cc-switch input:focus-visible + .cc-slider {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Dienste-Detail */
.cc-service {
  padding: 0.75rem 0;
  border-top: 1px solid var(--muted);
}
.cc-service:first-of-type { border-top: 0; }
.cc-service-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.75rem; flex-wrap: wrap;
}
.cc-service-name { font-weight: 700; }
.cc-service-provider { font-size: var(--text-sm); color: var(--muted-foreground); }
.cc-service-purpose { font-size: var(--text-sm); line-height: 1.5; margin: 0.35rem 0; }
.cc-service-empty { font-size: var(--text-sm); color: var(--muted-foreground); font-style: italic; }
.cc-service-link {
  font-size: var(--text-sm); color: var(--secondary);
  text-decoration: underline; text-underline-offset: 3px;
}
.cc-service-link:hover { color: var(--primary); }

.cc-cookie-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0;
  font-size: 13px;
}
.cc-cookie-table th, .cc-cookie-table td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--muted);
  vertical-align: top;
}
.cc-cookie-table th { background: var(--canvas); font-weight: 700; }

/* Modal-Footer */
.cc-modal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: clamp(1rem, 2.5vw, 1.5rem) clamp(1.25rem, 3vw, 2rem);
  border-top: 1px solid var(--muted);
  background: var(--card);
}
.cc-modal-foot .btn { flex: 1 1 auto; min-height: 48px; }
.cc-modal-foot .cc-save { flex-basis: 100%; }

/* ---------------------------------------------------------------------
   Floating-Button (dauerhaft, unten links)
   --------------------------------------------------------------------- */
.cc-fab {
  position: fixed;
  left: clamp(0.75rem, 2vw, 1.25rem);
  bottom: clamp(0.75rem, 2vw, 1.25rem);
  z-index: 999;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--secondary);
  color: #fff;
  border: 0;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--elevation-sm);
  transition: background .2s ease-out, transform .2s ease-out;
}
.cc-fab:hover { background: var(--primary); transform: translateY(-2px); }
.cc-fab:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }

/* ---------------------------------------------------------------------
   Footer-Link „Cookie-Einstellungen“ (nutzt vorhandenes .footer-links)
   --------------------------------------------------------------------- */
.footer-cookie-btn {
  background: none; border: 0; padding: 0;
  font: inherit; color: inherit; cursor: pointer;
}
/* Hover/Fokus-Stil kommt aus style.css (.footer-links), einheitlich mit den Footer-Links */

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */
@media (max-width: 720px) {
  .cc-banner-inner { flex-direction: column; align-items: stretch; }
  .cc-banner-actions { min-width: 0; }
  .cc-modal-foot .btn { flex-basis: 100%; }
}
