/* =========================================================================
   Cookie Consent – banner nero, testi bianchi, pulsanti blu
   ========================================================================= */
.cc-banner, .cc-modal, .cc-recall {
  --cc-bg: #000000;
  --cc-bg-soft: #141414;
  --cc-line: #2b2b2b;
  --cc-text: #ffffff;
  --cc-muted: #c7c7c7;
  --cc-blue: #1d6ff2;
  --cc-blue-hover: #1557c4;
  --cc-focus: #8ab4ff;
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  box-sizing: border-box;
}
.cc-banner *, .cc-modal *, .cc-recall * { box-sizing: border-box; }
.cc-banner[hidden], .cc-modal[hidden], .cc-recall[hidden] { display: none !important; }

/* ---------- Banner ---------- */
.cc-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 2147483000;
  padding: 0 16px 16px;
  pointer-events: none;
  transform: translateY(110%);
  transition: transform .35s ease;
}
.cc-banner.cc-visible { transform: translateY(0); }
.cc-banner__inner {
  position: relative;
  pointer-events: auto;
  max-width: 980px;
  margin: 0 auto;
  background: var(--cc-bg);
  color: var(--cc-text);
  border-radius: 14px;
  padding: 22px 26px 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .45);
  border: 1px solid var(--cc-line);
}
.cc-title {
  margin: 0 40px 8px 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--cc-text);
  line-height: 1.3;
  font-family: inherit;
}
.cc-text {
  margin: 0 0 8px;
  font-size: .92rem;
  line-height: 1.55;
  color: var(--cc-text);
}
.cc-links {
  margin: 0 0 16px;
  font-size: .92rem;
  line-height: 1.5;
  color: var(--cc-text);
}
.cc-banner a, .cc-modal a {
  color: var(--cc-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cc-banner a:hover, .cc-modal a:hover { color: var(--cc-focus); }

.cc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
.cc-btn {
  appearance: none;
  border: 2px solid var(--cc-blue);
  background: var(--cc-blue);
  color: #ffffff;
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 11px 22px;
  border-radius: 8px;
  cursor: pointer;
  min-width: 140px;
  min-height: 44px;
  transition: background-color .2s ease, border-color .2s ease;
}
.cc-btn:hover { background: var(--cc-blue-hover); border-color: var(--cc-blue-hover); }

.cc-close {
  position: absolute;
  top: 12px; right: 12px;
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--cc-text);
  width: 40px; height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
}
.cc-close:hover { background: rgba(255, 255, 255, .12); }

.cc-btn:focus-visible, .cc-close:focus-visible, .cc-recall:focus-visible,
.cc-banner a:focus-visible, .cc-modal a:focus-visible, .cc-switch__input:focus-visible + .cc-switch__track {
  outline: 3px solid var(--cc-focus);
  outline-offset: 2px;
}

/* ---------- Modale preferenze ---------- */
.cc-lock, .cc-lock body { overflow: hidden; }
.cc-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.cc-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .65);
}
.cc-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--cc-bg);
  color: var(--cc-text);
  border: 1px solid var(--cc-line);
  border-radius: 14px;
  padding: 26px 26px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  outline: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease;
}
.cc-modal.cc-visible .cc-modal__dialog { opacity: 1; transform: none; }
.cc-modal .cc-title { font-size: 1.3rem; }

.cc-cats { margin: 4px 0 18px; }
.cc-cat {
  background: var(--cc-bg-soft);
  border: 1px solid var(--cc-line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.cc-cat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cc-cat__label { font-weight: 700; font-size: 1rem; cursor: pointer; color: var(--cc-text); }
.cc-cat__desc { margin: 6px 0 8px; font-size: .88rem; line-height: 1.5; color: var(--cc-muted); }
.cc-always { font-size: .8rem; font-weight: 600; color: #7fb0ff; white-space: nowrap; }
.cc-services { margin: 0; padding-left: 18px; font-size: .84rem; line-height: 1.5; color: var(--cc-text); }
.cc-services .cc-muted { color: var(--cc-muted); list-style: none; margin-left: -18px; font-style: italic; }
.cc-consent-id { margin: 14px 0 0; font-size: .75rem; color: var(--cc-muted); word-break: break-all; }

/* Interruttore */
.cc-switch { position: relative; display: inline-flex; flex-shrink: 0; }
.cc-switch__input {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}
.cc-switch__track {
  width: 50px; height: 28px;
  border-radius: 28px;
  background: #555;
  position: relative;
  transition: background-color .2s ease;
}
.cc-switch__track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
}
.cc-switch__input:checked + .cc-switch__track { background: var(--cc-blue); }
.cc-switch__input:checked + .cc-switch__track::after { transform: translateX(22px); }

/* ---------- Pulsante di richiamo (in basso a destra) ---------- */
.cc-recall {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2147482999;
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 2px solid var(--cc-blue);
  background: var(--cc-bg);
  color: var(--cc-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  transition: transform .2s ease, background-color .2s ease;
}
.cc-recall:hover { background: var(--cc-blue); transform: scale(1.06); }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .cc-banner { padding: 0 8px 8px; }
  .cc-banner__inner { padding: 16px 16px 0; border-radius: 12px; max-height: 78vh; max-height: 78dvh; overflow-y: auto; }
  .cc-title { font-size: 1.05rem; }
  .cc-text, .cc-links { font-size: .84rem; line-height: 1.5; }
  .cc-links { margin-bottom: 12px; }
  /* Pulsanti sempre visibili, stessa evidenza per "Rifiuta" e "Accetta tutti" */
  .cc-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "reject accept" "custom custom";
    gap: 8px;
    position: sticky;
    bottom: 0;
    background: var(--cc-bg);
    padding: 10px 0 16px;
    margin: 0;
  }
  .cc-btn { width: 100%; min-width: 0; padding: 11px 10px; }
  .cc-btn--reject { grid-area: reject; }
  .cc-btn--accept { grid-area: accept; }
  .cc-btn--custom { grid-area: custom; }
  .cc-consent-id { padding-bottom: 14px; }
  .cc-modal { padding: 8px; align-items: flex-end; }
  .cc-modal__dialog { padding: 22px 16px 0; max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); }
  .cc-recall { right: 12px; bottom: 12px; width: 50px; height: 50px; }
}

@media (prefers-reduced-motion: reduce) {
  .cc-banner, .cc-modal__dialog, .cc-recall, .cc-switch__track, .cc-switch__track::after { transition: none !important; }
}
