/* ========================================
   COOKIE CONSENT BANNER (isolated scope)
   Stessa grafica del banner originale; aggiunta solo la "X" di chiusura
   richiesta dalle Linee guida cookie del Garante Privacy (10/06/2021).
   ======================================== */

/* Base styles (mobile-first) */
#cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  transform: translateY(100%);
  background: #ffffff;
  color: #000000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 0;
  width: 100%;
  padding: 12px;
  z-index: 9999;
  transition: transform 0.2s ease;
  overflow: hidden;
  display: none;
  flex-direction: column;
  gap: 8px;
  font-family: 'Montserrat', sans-serif;
}

#cookie-banner.show {
  transform: translateY(0);
}

#cookie-banner .cookie-banner-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Close (X) = continua senza accettare */
#cookie-banner .cookie-close {
  position: absolute;
  top: 4px;
  right: 8px;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: #000000;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}
#cookie-banner .cookie-close:hover {
  color: #444444;
}

/* Icon */
#cookie-banner .cookie-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  margin: 0 auto;
}

/* Text */
#cookie-banner .cookie-text {
  font-size: 0.85rem;
  line-height: 1.4;
  text-align: center;
}
#cookie-banner .cookie-text p {
  margin: 0;
  color: #000000;
}
#cookie-banner .cookie-text a {
  color: #006cff;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}
#cookie-banner .cookie-text a:hover,
#cookie-banner .cookie-text a:focus {
  color: #004bb5;
}

/* Details */
#cookie-banner .cookie-details {
  font-size: 0.85rem;
  width: 100%;
}
#cookie-banner .cookie-details summary {
  cursor: pointer;
  font-weight: 600;
  color: #006cff;
  list-style: none;
  display: inline-block;
}
#cookie-banner .cookie-details summary::-webkit-details-marker {
  display: none;
}
#cookie-banner .cookie-details summary::before {
  content: "▶";
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.2s;
}
#cookie-banner .cookie-details[open] > summary::before {
  transform: rotate(90deg);
}
#cookie-banner .cookie-details ul {
  margin: 6px 0 0 18px;
  padding: 0;
  list-style: disc;
  color: #333;
  text-align: left;
}
#cookie-banner .cookie-details li {
  padding: 0;
  margin: 2px 0;
  color: #333;
}
#cookie-banner .cookie-details li::before {
  content: none;
}

/* Actions */
#cookie-banner .cookie-actions {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 8px;
  margin-top: 8px;
}

/* Buttons */
#cookie-banner .cookie-btn {
  padding: 10px 12px;
  font-size: 0.9rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  min-width: 120px;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

/* Primary */
#cookie-banner .cookie-btn.primary {
  background: #006cff;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 108, 255, 0.3);
}
#cookie-banner .cookie-btn.primary:hover {
  background: #0051cc;
  box-shadow: 0 3px 8px rgba(0, 81, 204, 0.3);
}
#cookie-banner .cookie-btn.primary:active {
  transform: translateY(1px);
}

/* Secondary */
#cookie-banner .cookie-btn.secondary {
  background: #f5f5f5;
  color: #000000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
#cookie-banner .cookie-btn.secondary:hover {
  background: #e0e0e0;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}
#cookie-banner .cookie-btn.secondary:active {
  transform: translateY(1px);
}

/* Tertiary */
#cookie-banner .cookie-btn.tertiary {
  background: transparent;
  color: #000000;
  font-weight: 500;
}
#cookie-banner .cookie-btn.tertiary:hover {
  background: rgba(0, 0, 0, 0.05);
  text-decoration: underline;
}
#cookie-banner .cookie-btn.tertiary:active {
  transform: translateY(1px);
}

/* Modal Overlay */
#cookie-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  font-family: 'Montserrat', sans-serif;
}
#cookie-modal.show {
  display: flex;
}
#cookie-modal .modal-content {
  background: #ffffff;
  color: #000000;
  border-radius: 8px;
  padding: 16px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  line-height: 1.5;
}
#cookie-modal h2 {
  margin-top: 0;
  font-size: 1.2rem;
  color: #000000;
  padding: 0;
}
#cookie-modal h2::before {
  content: none;
}
#cookie-modal p {
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: #000000;
}

/* Modal categories */
#cookie-modal .cookie-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0;
}
#cookie-modal .cookie-category label {
  font-size: 0.9rem;
  margin: 0;
}
#cookie-modal .cookie-category small {
  display: block;
  color: #555;
  font-size: 0.78rem;
  line-height: 1.35;
}
#cookie-modal .cookie-category input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Modal actions */
#cookie-modal .modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
#cookie-modal .modal-actions button {
  padding: 10px 12px;
  font-size: 0.9rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
  font-family: inherit;
}
#cookie-modal .modal-actions button.primary {
  background: #006cff;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 108, 255, 0.3);
}
#cookie-modal .modal-actions button.primary:hover {
  background: #0051cc;
  box-shadow: 0 3px 8px rgba(0, 81, 204, 0.3);
}
#cookie-modal .modal-actions button.secondary {
  background: #f5f5f5;
  color: #000000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
#cookie-modal .modal-actions button.secondary:hover {
  background: #e0e0e0;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

/* Close button */
#cookie-modal .close-modal {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #000000;
  cursor: pointer;
  transition: color 0.2s;
}
#cookie-modal .close-modal:hover {
  color: #444444;
}

/* ================================
   Toggle Icon
   ================================ */
#cookie-toggle { position:fixed; bottom:20px; left:20px; background:transparent; border:none; cursor:pointer; z-index:1500; width:20px; height:20px; padding:0; transition:transform .2s; display:none; }
#cookie-toggle img { width:100%; height:100%; filter:brightness(0); }
#cookie-toggle:hover img { transform:scale(1.15); }

/* Focus visibile solo da tastiera (non cambia l'aspetto con il mouse) */
#cookie-banner button:focus-visible,
#cookie-banner a:focus-visible,
#cookie-banner summary:focus-visible,
#cookie-modal button:focus-visible,
#cookie-modal input:focus-visible,
#cookie-toggle:focus-visible {
  outline: 2px solid #006cff;
  outline-offset: 2px;
}

/* Desktop overrides */
@media (min-width: 769px) {
  #cookie-banner {
    bottom: 20px;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(100%);
    width: 90%;
    max-width: 900px;
    border-radius: 8px;
    padding: 16px 24px;
  }
  #cookie-banner .cookie-banner-content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  #cookie-banner .cookie-text {
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.5;
    flex: 1 1 auto;
  }
  #cookie-banner .cookie-actions {
    flex-direction: row;
    width: auto;
    gap: 10px;
    margin-top: 0;
    padding-right: 18px;
  }
  #cookie-modal .modal-content {
    padding: 24px 32px;
  }
  #cookie-modal h2 {
    font-size: 1.3rem;
    margin-bottom: 16px;
  }
  #cookie-modal p {
    font-size: 0.95rem;
  }
  #cookie-modal .cookie-category label {
    font-size: 0.95rem;
  }
  #cookie-modal .modal-actions {
    flex-direction: row;
    justify-content: flex-end;
  }
  #cookie-modal .modal-actions button {
    flex: 1 1 auto;
    margin-top: 0;
  }
  /* Quando diventa visibile, rimane centrato */
  #cookie-banner.show {
    transform: translateX(-50%) translateY(0) !important;
  }
}

/* ================================
   Google Maps: segnaposto finché non c'è il consenso
   ================================ */
.map-embed {
  position: relative;
  width: 100%;
  height: 300px;
  background: #f7f7f7;
}
.map-embed iframe {
  display: block;
  width: 100%;
  height: 300px;
  border: 0;
}
.map-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 1.5rem;
  text-align: center;
  background: linear-gradient(#FFF0E8, #F7EDEA);
}
.map-placeholder i {
  font-size: 2.5rem;
  color: #326A69;
}
.studies-list .map-placeholder p {
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
  color: #555;
}
.map-placeholder .map-load-btn {
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #ffffff;
  background: #326A69;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 50px #326A69;
  cursor: pointer;
  transition: ease-out 0.3s;
  font-family: inherit;
}
.map-placeholder .map-load-btn:hover {
  color: #326A69;
  background: transparent;
  box-shadow: inset 0 0 0 0 #326A69;
  border-color: #326A69;
}
