/* =====================================================================
   Cookie notice Clypse — banner fisso in basso con modal dettagli.
   Compliance: usiamo SOLO cookie tecnici essenziali (sessione + CSRF),
   quindi ai sensi del GDPR/ePrivacy non serve consenso preventivo, basta
   l'informativa. Il banner e' quindi informativo, non blocca l'uso del sito.
   ===================================================================== */

/* Banner nascosto di default. Diventa visibile con .cn-visible via JS. */
#cookie-notice {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  z-index: 99998;
  max-width: 720px;
  margin: 0 auto;
  background: rgba(13, 21, 39, 0.96);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  padding: 18px 22px;
  color: #f7f9fd;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  animation: cn-slide-up 0.35s ease-out;
}

@keyframes cn-slide-up {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

#cookie-notice.cn-visible { display: block; }

#cookie-notice .cn-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

#cookie-notice .cn-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7ca2ff, #be84ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 8px 20px rgba(126, 163, 255, 0.35);
}

#cookie-notice .cn-text {
  flex: 1;
  min-width: 200px;
  color: #d8dee9;
}

#cookie-notice .cn-text strong {
  color: #ffffff;
  font-weight: 700;
}

#cookie-notice a {
  color: #7ca2ff;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px dotted rgba(124, 162, 255, 0.4);
}

#cookie-notice a:hover {
  color: #be84ff;
  border-bottom-color: rgba(190, 132, 255, 0.6);
}

.cn-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #7ca2ff, #be84ff);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(126, 163, 255, 0.28);
}

.cn-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(126, 163, 255, 0.4);
}

.cn-btn.cn-btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: none;
  color: #d8dee9;
}

.cn-btn.cn-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: none;
}

/* ------------------- Modal dettagli ------------------- */
#cn-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#cn-modal.cn-visible {
  display: flex;
  animation: cn-fade-in 0.25s ease-out;
}

@keyframes cn-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#cn-modal .cn-modal-inner {
  background: #0d1527;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 32px;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  color: #f7f9fd;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
  animation: cn-modal-in 0.3s ease-out;
}

@keyframes cn-modal-in {
  from { transform: scale(0.96); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

#cn-modal h3 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

#cn-modal .cn-modal-sub {
  color: #a4aec1;
  font-size: 14px;
  margin-bottom: 24px;
}

#cn-modal .cn-section {
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#cn-modal .cn-section:last-of-type {
  border-bottom: none;
  margin-bottom: 20px;
}

#cn-modal .cn-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 12px;
}

#cn-modal .cn-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#cn-modal .cn-badge.cn-badge-required {
  background: rgba(55, 217, 139, 0.15);
  color: #37d98b;
  border: 1px solid rgba(55, 217, 139, 0.3);
}

#cn-modal .cn-badge.cn-badge-none {
  background: rgba(255, 255, 255, 0.06);
  color: #a4aec1;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

#cn-modal .cn-cookie-row {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  color: #d8dee9;
}

#cn-modal .cn-cookie-row code {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(124, 162, 255, 0.12);
  color: #7ca2ff;
  border-radius: 6px;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 12px;
  margin-right: 8px;
}

#cn-modal .cn-cookie-row .cn-cookie-desc {
  color: #a4aec1;
  margin-top: 2px;
  font-size: 12px;
}

#cn-modal p {
  color: #d8dee9;
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 12px;
}

#cn-modal .cn-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

#cn-modal .cn-legal {
  font-size: 12px;
  color: #7d899f;
  margin-top: 6px;
}

/* ------------------- Mobile ------------------- */
@media (max-width: 640px) {
  #cookie-notice {
    left: 12px;
    right: 12px;
    bottom: 12px;
    padding: 14px 16px;
  }

  #cookie-notice .cn-inner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  #cookie-notice .cn-icon {
    margin: 0 auto;
  }

  .cn-btn {
    width: 100%;
  }

  #cn-modal .cn-modal-inner {
    padding: 24px 20px;
  }
}
