/* ====================================================================
   COOKIE CONSENT BANNER — GDPR
   Prefisso "bbcc-" (Bora Bora Cookie Consent) per non collidere con
   nient'altro nel progetto. Usa le CSS custom properties già definite
   in styles.css (--first-color, --title-color, --border-radius, ecc.)
   ==================================================================== */

.bbcc-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  background: var(--body-color, #fff);
  color: var(--text-color, #1e2530);
  border-top: 1px solid rgba(0, 0, 0, .1);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .18);
  padding: 1.1rem 1.25rem;
  max-height: 100vh;
  overflow-y: auto;
}

.bbcc-banner[hidden] { display: none; }

.bbcc-banner-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.bbcc-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.bbcc-text {
  flex: 1 1 320px;
  font-size: .85rem;
  line-height: 1.5;
  margin: 0;
}

.bbcc-text a {
  color: var(--first-color);
  text-decoration: underline;
}

.bbcc-actions {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.bbcc-btn {
  border: none;
  border-radius: var(--border-radius-sm, 4px);
  padding: .65rem 1.1rem;
  font-size: .82rem;
  font-family: var(--body-font);
  font-weight: var(--font-medium, 500);
  cursor: pointer;
  white-space: nowrap;
}

.bbcc-btn-ghost {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, .2);
  color: var(--text-color, #1e2530);
}

.bbcc-btn-primary {
  background: var(--first-color);
  color: #fff;
}

.bbcc-btn-primary:hover { background: var(--first-color-alt, var(--first-color)); }

/* "Rifiuta" deve avere la stessa evidenza visiva di "Accetta tutti"
   (stesso ingombro, stesso "peso" pieno) — il consenso non è valido se
   il banner spinge visivamente verso l'accettazione. */
.bbcc-btn-reject {
  /* Colore fisso (non legato a --title-color): quel token si inverte in
     modalità scura e diventa quasi bianco, rendendo invisibile il testo
     bianco sopra. Qui serve un contrasto stabile in entrambi i temi. */
  background: #1e2530;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.bbcc-btn-reject:hover { filter: brightness(1.25); }

/* ---------- modale preferenze ---------- */

.bbcc-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(0, 0, 0, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

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

.bbcc-modal {
  background: var(--body-color, #fff);
  color: var(--text-color, #1e2530);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: var(--border-radius, 8px);
  padding: 1.75rem;
}

.bbcc-modal h2 {
  margin: 0 0 .5rem;
  font-family: var(--title-font);
  color: var(--title-color);
  font-size: 1.15rem;
}

.bbcc-modal p {
  font-size: .85rem;
  line-height: 1.55;
  margin: 0 0 1.25rem;
}

.bbcc-category {
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: var(--border-radius-sm, 4px);
  padding: .9rem 1rem;
  margin-bottom: .75rem;
}

.bbcc-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .35rem;
}

.bbcc-category-head strong {
  font-size: .88rem;
}

.bbcc-category p {
  margin: 0;
  font-size: .78rem;
  color: var(--text-color-light, var(--text-color));
}

.bbcc-tag-locked {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-color-light, var(--text-color));
  background: rgba(0, 0, 0, .06);
  padding: .2rem .5rem;
  border-radius: 999px;
}

/* switch on/off accessibile */
.bbcc-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

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

.bbcc-switch-track {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .25);
  border-radius: 999px;
  transition: background .2s ease;
}

.bbcc-switch-track::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s ease;
}

.bbcc-switch input:checked + .bbcc-switch-track {
  background: var(--first-color);
}

.bbcc-switch input:checked + .bbcc-switch-track::before {
  transform: translateX(18px);
}

.bbcc-switch input:disabled + .bbcc-switch-track {
  opacity: .6;
  cursor: not-allowed;
}

.bbcc-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

@media screen and (max-width: 575px) {
  .bbcc-banner {
    padding: .9rem .9rem calc(.9rem + env(safe-area-inset-bottom, 0px));
  }
  .bbcc-banner-inner {
    flex-direction: column;
    align-items: stretch;
    gap: .75rem;
  }
  .bbcc-icon {
    font-size: 1.3rem;
  }
  .bbcc-text {
    flex-basis: auto;
    font-size: .78rem;
    line-height: 1.45;
  }
  .bbcc-actions {
    justify-content: stretch;
    gap: .5rem;
  }
  .bbcc-btn {
    flex: 1 1 auto;
    padding: .6rem .5rem;
    font-size: .78rem;
  }

  .bbcc-modal {
    padding: 1.25rem;
    max-height: 90vh;
  }
  .bbcc-modal-actions {
    justify-content: stretch;
  }
  .bbcc-modal-actions .bbcc-btn {
    flex: 1 1 auto;
  }
}

/* ---------- placeholder contenuti esterni (mappa, Instagram) ---------- */

.bbcc-embed-placeholder {
  height: 100%;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  text-align: center;
  padding: 1.5rem;
  background: var(--input-color, #eef1f5);
  color: var(--text-color, #1e2530);
}

/* Senza questa regola l'attributo hidden impostato da JS non avrebbe
   effetto: stessa specificità di [hidden] dello user agent, e il
   display:flex qui sopra vincerebbe restando sempre visibile. */
.bbcc-embed-placeholder[hidden] {
  display: none;
}

.bbcc-embed-placeholder p {
  max-width: 320px;
  font-size: .85rem;
  margin: 0;
}

.bbcc-embed-btn {
  border: none;
  border-radius: var(--border-radius-sm, 4px);
  background: var(--first-color);
  color: #fff;
  font-family: var(--body-font);
  font-weight: var(--font-medium, 500);
  padding: .65rem 1.25rem;
  cursor: pointer;
}

.bbcc-embed-btn:hover { background: var(--first-color-alt, var(--first-color)); }

.bbcc-embed-link {
  font-size: .8rem;
  color: var(--first-color);
}
