/* Componente consenso cookie condiviso — personalizzabile con le variabili --cc-* */
.consent-banner {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 11000;
  width: min(420px, calc(100vw - 48px));
  padding: 24px;
  background: var(--cc-surface, #fff);
  color: var(--cc-ink, #10212f);
  border: 1px solid var(--cc-border, rgba(10, 61, 98, 0.12));
  border-radius: var(--cc-radius, 16px);
  box-shadow: 0 24px 70px -20px rgba(6, 30, 48, 0.45);
  font-family: var(--cc-font, "Manrope", system-ui, sans-serif);
  font-size: 0.875rem;
  line-height: 1.6;
  animation: consent-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes consent-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

.consent-banner__title {
  margin: 0 0 6px;
  font-family: var(--cc-title-font, var(--cc-font, inherit));
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--cc-ink, #10212f);
}

.consent-banner p {
  margin: 0;
}

.consent-banner a {
  color: var(--cc-accent, #0071bc);
  text-underline-offset: 2px;
}

.consent-banner__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.consent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 18px;
  border-radius: var(--cc-btn-radius, 8px);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  border: 1px solid transparent;
}

.consent-btn--primary {
  background: var(--cc-accent, #0071bc);
  color: #fff;
}

.consent-btn--primary:hover {
  background: var(--cc-accent-hover, #005a96);
}

.consent-btn--ghost {
  background: transparent;
  color: var(--cc-ink, #10212f);
  border-color: var(--cc-border-strong, rgba(10, 61, 98, 0.25));
}

.consent-btn--ghost:hover {
  border-color: var(--cc-ink, #10212f);
}

.consent-btn--link {
  min-height: auto;
  padding: 6px 2px;
  color: var(--cc-muted, #5a6b7a);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
}

.consent-btn--link:hover {
  color: var(--cc-ink, #10212f);
}

.consent-modal {
  position: fixed;
  inset: 0;
  z-index: 11500;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 30, 48, 0.55);
  backdrop-filter: blur(3px);
}

.consent-modal[hidden] {
  display: none;
}

.consent-dialog {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 28px;
  background: var(--cc-surface, #fff);
  color: var(--cc-ink, #10212f);
  border-radius: var(--cc-radius, 16px);
  box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.5);
  font-family: var(--cc-font, "Manrope", system-ui, sans-serif);
  font-size: 0.9rem;
  line-height: 1.6;
}

.consent-dialog h2 {
  margin: 0 0 8px;
  font-family: var(--cc-title-font, var(--cc-font, inherit));
  font-size: 1.35rem;
  line-height: 1.25;
}

.consent-dialog p {
  margin: 0 0 18px;
  color: var(--cc-muted, #5a6b7a);
}

.consent-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--cc-border, rgba(10, 61, 98, 0.12));
}

.consent-option:last-of-type {
  border-bottom: 1px solid var(--cc-border, rgba(10, 61, 98, 0.12));
}

.consent-option__text {
  flex: 1;
}

.consent-option__text strong {
  display: block;
  font-size: 0.925rem;
}

.consent-option__text span {
  display: block;
  margin-top: 2px;
  color: var(--cc-muted, #5a6b7a);
  font-size: 0.8125rem;
}

.consent-switch {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 26px;
  margin-top: 2px;
}

.consent-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}

.consent-switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c9d4de;
  transition: background-color 0.2s ease;
}

.consent-switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.consent-switch input:checked + span {
  background: var(--cc-accent, #0071bc);
}

.consent-switch input:checked + span::after {
  transform: translateX(20px);
}

.consent-switch input:disabled + span {
  background: var(--cc-accent, #0071bc);
  opacity: 0.65;
}

.consent-switch input:disabled {
  cursor: not-allowed;
}

.consent-switch input:focus-visible + span {
  outline: 3px solid var(--cc-accent, #0071bc);
  outline-offset: 3px;
}

.consent-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

/* Contenitore mappa con caricamento subordinato al consenso */
.map-frame {
  position: relative;
  overflow: hidden;
  background: var(--map-bg, #e8eef3);
  min-height: 320px;
}

.map-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.map-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.72)),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(10, 61, 98, 0.12) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(10, 61, 98, 0.12) 39px 40px),
    #e9f0f6;
}

.map-fallback[hidden] {
  display: none;
}

.map-fallback__inner {
  max-width: 340px;
  display: grid;
  justify-items: center;
  gap: 10px;
  color: #3f5668;
  font-size: 0.8125rem;
  line-height: 1.55;
}

.map-fallback__inner strong {
  display: block;
  color: #0a3d62;
  font-size: 0.95rem;
}

.map-fallback svg {
  color: #0071bc;
}

.map-fallback .consent-btn {
  margin-top: 4px;
}

.map-fallback .map-link {
  font-weight: 600;
  color: #0a3d62;
  text-underline-offset: 3px;
}

@media (max-width: 640px) {
  .consent-banner {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    padding: 20px;
  }

  .consent-banner__actions .consent-btn {
    flex: 1 1 auto;
  }

  .consent-dialog {
    padding: 22px;
  }

  .map-frame {
    min-height: 360px;
  }
}
