/* ============================================================
   COOKIE CONSENT – GDPR & Garante Privacy 2021 Compliant
   ============================================================ */

/* ---------- Overlay ---------- */
.cc-overlay {
  position: fixed; inset: 0; z-index: 99998;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: opacity .35s ease, visibility .35s ease;
}
.cc-overlay.show { opacity: 1; visibility: visible; }

/* ---------- Banner (primo livello) ---------- */
.cc-banner {
  position: fixed; z-index: 99999;
  left: 50%; top: 50%;
  transform: translate(-50%,-50%) scale(.92);
  width: calc(100% - 24px); max-width: 440px;
  background: linear-gradient(145deg, rgba(15,22,38,.98), rgba(10,15,25,.98));
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  padding: 22px 18px 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.55), 0 0 40px rgba(204,255,0,.06);
  opacity: 0; visibility: hidden;
  transition: all .45s cubic-bezier(.16,1,.3,1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #e9f0ff;
}
.cc-banner.show {
  opacity: 1; visibility: visible;
  transform: translate(-50%,-50%) scale(1);
}

/* Icon */
.cc-icon {
  width: 40px; height: 40px; margin: 0 auto 10px;
  background: linear-gradient(135deg, rgba(204,255,0,.14), rgba(204,255,0,.04));
  border: 1.5px solid rgba(204,255,0,.28);
  border-radius: 50%; display: grid; place-items: center;
}
.cc-icon svg { width: 20px; height: 20px; fill: #ccff00; }

/* Title */
.cc-title {
  font-size: 1.05rem; font-weight: 700;
  text-align: center; margin: 0 0 8px;
  letter-spacing: .01em; color: #fff;
}

/* Description */
.cc-desc {
  font-size: .8rem; color: #a8b6c6;
  text-align: center; line-height: 1.5;
  margin: 0 0 16px;
}
.cc-desc a {
  color: #ccff00; text-decoration: underline;
  text-underline-offset: 2px;
}
.cc-desc a:hover { color: #fff; }

/* ---------- Buttons (primo livello) ---------- */
.cc-buttons {
  display: flex; flex-direction: column; gap: 8px;
}

.cc-btn {
  width: 100%; padding: 10px 14px;
  border-radius: 8px; font-size: .82rem; font-weight: 600;
  cursor: pointer; border: none;
  transition: all .25s ease;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}

/* GARANTE 2021: Accetta e Rifiuta devono avere pari evidenza visiva */
.cc-btn--accept {
  background: #ccff00; color: #000;
  box-shadow: 0 4px 16px rgba(204,255,0,.25);
}
.cc-btn--accept:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(204,255,0,.35);
}

.cc-btn--reject {
  background: rgba(255,255,255,.12); color: #fff;
  border: 1px solid rgba(255,255,255,.18);
}
.cc-btn--reject:hover {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.28);
}

.cc-btn--settings {
  background: transparent; color: #a8b6c6;
  border: 1px solid rgba(255,255,255,.1);
  font-size: .76rem;
}
.cc-btn--settings:hover {
  color: #fff; border-color: rgba(255,255,255,.22);
}

/* Footer links */
.cc-footer {
  display: flex; justify-content: center; gap: 10px;
  margin-top: 12px; font-size: .7rem;
}
.cc-footer a {
  color: #5a6884; text-decoration: none;
  transition: color .2s;
}
.cc-footer a:hover { color: #ccff00; }

/* ---------- Second layer: Preferences modal ---------- */
.cc-prefs {
  position: fixed; inset: 0; z-index: 100000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}
.cc-prefs.show { opacity: 1; visibility: visible; }

.cc-prefs-card {
  position: relative;
  width: calc(100% - 24px); max-width: 460px; max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(145deg, rgba(15,22,38,.99), rgba(10,15,25,.99));
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  padding: 22px 18px 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  transform: scale(.92);
  transition: transform .35s cubic-bezier(.16,1,.3,1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #e9f0ff;
}
.cc-prefs.show .cc-prefs-card { transform: scale(1); }

.cc-prefs-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; color: #5a6884; cursor: pointer;
  padding: 4px; transition: color .2s;
}
.cc-prefs-close:hover { color: #fff; }

.cc-prefs-title {
  font-size: 1rem; font-weight: 700;
  margin: 0 0 6px; color: #fff;
}
.cc-prefs-desc {
  font-size: .78rem; color: #a8b6c6;
  line-height: 1.45; margin: 0 0 16px;
}

/* Category items */
.cc-cat {
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,.07);
}
.cc-cat:last-child { border-bottom: 1px solid rgba(255,255,255,.07); }

.cc-cat-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.cc-cat-name {
  font-size: .82rem; font-weight: 600; color: #fff;
  margin: 0 0 2px;
}
.cc-cat-desc {
  font-size: .72rem; color: #6b7d9a;
  margin: 2px 0 0; line-height: 1.4;
}

/* Toggle switch */
.cc-toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.cc-toggle input { opacity: 0; width: 0; height: 0; }
.cc-toggle-track {
  position: absolute; inset: 0; cursor: pointer;
  background: rgba(255,255,255,.1); border-radius: 22px;
  transition: background .25s;
}
.cc-toggle-track::after {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #5a6884; transition: all .25s;
}
.cc-toggle input:checked + .cc-toggle-track { background: rgba(204,255,0,.25); }
.cc-toggle input:checked + .cc-toggle-track::after {
  background: #ccff00; transform: translateX(18px);
}
.cc-toggle input:disabled + .cc-toggle-track { opacity: .5; cursor: not-allowed; }
.cc-toggle input:disabled:checked + .cc-toggle-track::after { background: #7a9900; }

/* Prefs buttons */
.cc-prefs-actions {
  display: flex; gap: 8px; margin-top: 18px;
}
.cc-prefs-btn {
  flex: 1; padding: 10px 12px;
  border-radius: 8px; font-size: .8rem; font-weight: 600;
  cursor: pointer; transition: all .25s; border: none;
}
.cc-prefs-btn--save {
  background: #ccff00; color: #000;
  box-shadow: 0 4px 16px rgba(204,255,0,.2);
}
.cc-prefs-btn--save:hover {
  box-shadow: 0 6px 24px rgba(204,255,0,.32);
}
.cc-prefs-btn--reject {
  background: rgba(255,255,255,.1); color: #fff;
  border: 1px solid rgba(255,255,255,.15);
}
.cc-prefs-btn--reject:hover {
  background: rgba(255,255,255,.16);
}

/* ---------- Floating reopener (icona impostazioni cookie) ---------- */
.cc-reopener {
  position: fixed; bottom: 20px; left: 20px; z-index: 99990;
  width: 44px; height: 44px;
  background: linear-gradient(145deg, rgba(15,22,38,.95), rgba(10,15,25,.95));
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 50%; cursor: pointer;
  display: none; /* hidden until consent is given */
  align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  transition: all .25s ease;
}
.cc-reopener.show { display: flex; }
.cc-reopener:hover {
  transform: scale(1.08);
  border-color: rgba(204,255,0,.3);
  box-shadow: 0 6px 28px rgba(0,0,0,.5);
}
.cc-reopener svg { width: 20px; height: 20px; fill: #ccff00; }

/* ---------- Desktop (≥ 480px) ---------- */
@media (min-width:480px) {
  .cc-banner { max-width: 480px; padding: 26px 24px 20px; }
  .cc-buttons { flex-direction: row; flex-wrap: wrap; }
  .cc-btn--accept, .cc-btn--reject { flex: 1 1 45%; }
  .cc-btn--settings { flex: 1 1 100%; }
  .cc-prefs-card { max-width: 520px; padding: 28px 24px 22px; }
}

@media (min-width:768px) {
  .cc-banner { max-width: 540px; }
}
