/* Consent Kit — stili banner e preferences center (nessun layout shift: overlay fixed) */
.ck-banner {
  --ck-bg: #ffffff;
  --ck-fg: #1f2933;
  --ck-accent: #2563eb;
  --ck-muted: #6b7280;
  --ck-border: #e5e7eb;
  position: fixed;
  left: 0; right: 0;
  z-index: 2147483000;
  background: var(--ck-bg);
  color: var(--ck-fg);
  box-shadow: 0 -2px 24px rgba(0,0,0,.12);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  padding: 18px 20px;
  transition: transform .25s ease, opacity .25s ease;
}
.ck-banner--bottom { bottom: 0; }
.ck-banner--top { top: 0; box-shadow: 0 2px 24px rgba(0,0,0,.12); }
.ck-banner--hide { transform: translateY(120%); opacity: 0; }

.ck-banner__inner { max-width: 1080px; margin: 0 auto; display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.ck-banner__text { flex: 1 1 420px; min-width: 260px; }
.ck-banner__title { font-weight: 700; margin-bottom: 4px; }
.ck-banner__desc { margin: 0; color: var(--ck-muted); }
.ck-banner__actions { display: flex; gap: 10px; flex-wrap: wrap; }

.ck-banner__error {
  margin-top: 8px; padding: 8px 12px; border-radius: 8px;
  background: #fef2f2; color: #991b1b; font-size: 14px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.ck-banner__error[hidden] { display: none; }
.ck-banner__error .ck-btn { padding: 6px 12px; }

.ck-facade__cta { cursor: pointer; }

/* Toast errore globale (copre anche le riaperture del centro preferenze) */
.ck-toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 2147483002;
  background: #fff; color: #991b1b; border: 1px solid #fecaca; border-left: 4px solid #ef4444;
  border-radius: 10px; padding: 12px 14px; display: flex; align-items: center; gap: 12px;
  font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  box-shadow: 0 8px 30px rgba(0,0,0,.18); max-width: 360px;
}
.ck-toast[hidden] { display: none; }

/* Durante il salvataggio: niente click duplicati */
body.ck-saving .ck-btn { pointer-events: none; opacity: .6; }

/* Accessibilità: focus sempre visibile */
.ck-banner button:focus-visible,
.ck-modal button:focus-visible,
.ck-modal input:focus-visible + .ck-switch__slider,
.ck-reopen:focus-visible,
.ck-facade__cta:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }

.ck-banner__close {
  position: absolute; top: 8px; right: 10px;
  border: 0; background: transparent; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--ck-muted);
}

.ck-btn {
  appearance: none; border: 1px solid var(--ck-border); cursor: pointer;
  padding: 10px 18px; border-radius: 8px; font-size: 15px; font-weight: 600;
  background: #fff; color: var(--ck-fg); transition: filter .15s ease;
}
.ck-btn:hover { filter: brightness(.96); }
.ck-btn--primary { background: var(--ck-accent); border-color: var(--ck-accent); color: #fff; }
.ck-link { color: var(--ck-accent); text-decoration: underline; }

/* Preferences center */
.ck-modal {
  position: fixed; inset: 0; z-index: 2147483001;
  background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
.ck-modal__box {
  background: #fff; color: #1f2933; border-radius: 14px; max-width: 640px; width: 100%;
  max-height: 86vh; overflow: auto; padding: 24px;
}
.ck-modal__title { margin: 0 0 16px; font-size: 20px; }
.ck-pref__row { display: flex; gap: 16px; align-items: flex-start; padding: 14px 0; border-top: 1px solid #eef1f4; }
.ck-pref__text { flex: 1 1 auto; }
.ck-pref__name { font-weight: 600; }
.ck-pref__desc { color: #6b7280; font-size: 14px; }
.ck-pref__services { color: #94a3b8; font-size: 12px; margin-top: 4px; }
.ck-modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* Switch */
.ck-switch { position: relative; display: inline-block; width: 48px; height: 28px; flex: 0 0 auto; }
.ck-switch input { opacity: 0; width: 0; height: 0; }
.ck-switch__slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: background .15s ease; }
.ck-switch__slider::before { content: ""; position: absolute; height: 22px; width: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s ease; }
.ck-switch input:checked + .ck-switch__slider { background: var(--ck-accent, #2563eb); }
.ck-switch input:checked + .ck-switch__slider::before { transform: translateX(20px); }
.ck-switch input:disabled + .ck-switch__slider { opacity: .55; }

/* Reopen button */
.ck-reopen {
  position: fixed; left: 14px; bottom: 14px; z-index: 2147482000;
  background: #fff; color: #1f2933; border: 1px solid #e5e7eb; border-radius: 999px;
  padding: 8px 14px; cursor: pointer; font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,0,0,.1);
}

/* Facade contenuti esterni */
.ck-facade { position: relative; aspect-ratio: 16/9; background: #0f172a; color: #fff; display: flex; align-items: center; justify-content: center; border-radius: 10px; }
.ck-facade__cta { background: #2563eb; color: #fff; border: 0; border-radius: 8px; padding: 12px 20px; font-weight: 600; cursor: pointer; }

@media (max-width: 600px) {
  .ck-banner__actions { width: 100%; }
  .ck-banner__actions .ck-btn { flex: 1 1 auto; }
}
