/*
 * Greenora Consent
 * Colori: se il sito usa Elementor prende i colori globali del kit (primario, secondario, testo),
 * altrimenti i valori di riserva. I selettori sono volutamente specifici: i kit Elementor e molti
 * temi danno uno stile a tutti i <button> della pagina, che non deve finire su X e bottoni di servizio.
 */
.gc-consent-banner,
.gc-consent-prefs,
.gc-floating {
  --gc-primary: var(--e-global-color-primary, #1f7a4d);
  --gc-primary-hover: var(--e-global-color-secondary, #16603c);
  --gc-text: var(--e-global-color-text, #1d1d1f);
  --gc-banner-bg: #fff;
  --gc-banner-fg: var(--gc-text);
  --gc-btn-font: var(--e-global-typography-accent-font-family, inherit);
  --gc-btn-transform: var(--e-global-typography-accent-text-transform, none);
  font: inherit;
  box-sizing: border-box;
}
.gc-consent-banner *,
.gc-consent-prefs * { box-sizing: border-box; }

/* ---------- Banner ---------- */
.gc-consent-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 99999;
  background: var(--gc-banner-bg);
  color: var(--gc-banner-fg);
  padding: 40px 16px 16px;
  border-top: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 -6px 24px rgba(0,0,0,.12);
}
.gc-consent-banner .gc-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
}
.gc-consent-banner .gc-content { flex: 1 1 420px; min-width: 0; }
.gc-consent-banner .gc-title { font-weight: 700; margin-bottom: 4px; color: inherit; }
.gc-consent-banner .gc-text { font-size: .95em; line-height: 1.45; color: inherit; }
.gc-consent-banner .gc-text a { color: inherit; text-decoration: underline; }
.gc-consent-banner .gc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

/* ---------- Bottoni ----------
 * Testo bianco sui colori scuri, nero sui chiari (es. primario beige del kit Elementor):
 * la luminosità OKLCH del colore decide; i browser senza "relative color" restano sul bianco. */
.gc-consent-banner button.gc-btn,
.gc-consent-prefs button.gc-btn {
  display: inline-block; margin: 0; padding: 10px 18px;
  border: 2px solid transparent; border-radius: 4px; cursor: pointer;
  font-family: var(--gc-btn-font); font-size: 15px; font-weight: 600; line-height: 1.2;
  text-transform: var(--gc-btn-transform); letter-spacing: normal;
  box-shadow: none; text-decoration: none;
}
.gc-consent-banner button.gc-btn-accept,
.gc-consent-prefs button.gc-btn-accept {
  background: var(--gc-primary); border-color: var(--gc-primary); color: #fff; color: oklch(from var(--gc-primary) clamp(0, (0.72 - l) * 1000, 1) 0 0);
}
.gc-consent-banner button.gc-btn-accept:hover,
.gc-consent-banner button.gc-btn-accept:focus,
.gc-consent-prefs button.gc-btn-accept:hover,
.gc-consent-prefs button.gc-btn-accept:focus {
  background: var(--gc-primary-hover); border-color: var(--gc-primary-hover); color: #fff; color: oklch(from var(--gc-primary-hover) clamp(0, (0.72 - l) * 1000, 1) 0 0);
}
/* Personalizza e Rifiuta: stesso peso visivo tra loro */
.gc-consent-banner button.gc-btn-custom,
.gc-consent-banner button.gc-btn-reject {
  background: transparent; border-color: var(--gc-banner-fg); color: var(--gc-banner-fg);
}
.gc-consent-banner button.gc-btn-custom:hover,
.gc-consent-banner button.gc-btn-custom:focus,
.gc-consent-banner button.gc-btn-reject:hover,
.gc-consent-banner button.gc-btn-reject:focus {
  background: var(--gc-banner-fg); border-color: var(--gc-banner-fg); color: var(--gc-banner-bg);
}
.gc-consent-prefs button.gc-btn-custom,
.gc-consent-prefs button.gc-btn-reject {
  background: #fff; border-color: var(--gc-text); color: var(--gc-text);
}
.gc-consent-prefs button.gc-btn-custom:hover,
.gc-consent-prefs button.gc-btn-custom:focus,
.gc-consent-prefs button.gc-btn-reject:hover,
.gc-consent-prefs button.gc-btn-reject:focus {
  background: var(--gc-text); border-color: var(--gc-text); color: #fff;
}

/* X di chiusura = continua senza accettare (linee guida Garante, 10/06/2021) */
.gc-consent-banner button.gc-close,
.gc-consent-banner button.gc-close:hover,
.gc-consent-banner button.gc-close:focus {
  position: absolute; top: 8px; right: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0; padding: 6px; border: 0; border-radius: 0; box-shadow: none;
  background: transparent; color: var(--gc-banner-fg); cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 400; line-height: 1;
  text-transform: none; letter-spacing: normal;
  text-decoration: underline; text-underline-offset: 2px;
}
.gc-consent-banner button.gc-close .gc-close-x { font-size: 26px; line-height: 1; text-decoration: none; }
.gc-consent-banner button.gc-close:hover { opacity: .85; }

.gc-consent-banner button:focus-visible,
.gc-consent-prefs button:focus-visible,
button.gc-floating:focus-visible {
  outline: 2px solid var(--gc-primary); outline-offset: 2px;
}

/* ---------- Pannello preferenze ---------- */
.gc-consent-prefs {
  position: fixed; inset: 0; z-index: 100000;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.gc-consent-prefs[hidden] { display: none; }
html.gc-prefs-open { overflow: hidden; }
.gc-consent-prefs .gc-modal {
  position: relative;
  background: #fff; color: var(--gc-text);
  max-width: 720px; width: 100%;
  border-radius: 8px; padding: 24px 20px 20px;
  max-height: calc(100vh - 32px); overflow: auto;
  outline: none;
  text-align: left;
}
.gc-consent-prefs button.gc-modal-close,
.gc-consent-prefs button.gc-modal-close:hover,
.gc-consent-prefs button.gc-modal-close:focus {
  position: absolute; top: 8px; right: 10px;
  margin: 0; padding: 4px 8px; border: 0; box-shadow: none;
  background: transparent; color: var(--gc-text); cursor: pointer;
  font-family: inherit; font-size: 26px; font-weight: 400; line-height: 1; text-transform: none;
}
.gc-consent-prefs .gc-prefs-title { margin: 0 32px 8px 0; font-size: 1.3em; line-height: 1.3; color: inherit; text-transform: none; }
.gc-consent-prefs .gc-prefs-text { margin: 0 0 14px; color: inherit; }

.gc-pref-groups { display: grid; gap: 12px; }
.gc-group { border: 1px solid rgba(0,0,0,.12); border-radius: 8px; padding: 12px; }
.gc-group-head label { display: flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; margin: 0; }
.gc-badge { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--gc-primary); }
.gc-cat-desc { margin: 6px 0 0; font-size: .9em; opacity: .85; }
.gc-tags { margin-top: 8px; padding-left: 24px; display: grid; gap: 6px; }
.gc-tag-row { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; margin: 0; }
.gc-tag-row input { margin-top: 4px; }
.gc-tag-text { display: flex; flex-direction: column; }
.gc-tag-text small { opacity: .8; }
.gc-group input[type=checkbox] { width: 18px; height: 18px; flex: 0 0 auto; margin: 0; accent-color: var(--gc-primary); }

.gc-consent-id { margin: 14px 0 0; font-size: 12px; opacity: .8; }
.gc-policy-links { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0 0; font-size: 13px; }
.gc-policy-links a { color: inherit; text-decoration: underline; }
.gc-modal-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 16px; }

/* ---------- Bottone flottante ---------- */
button.gc-floating,
button.gc-floating:hover,
button.gc-floating:focus {
  position: fixed; bottom: 16px; z-index: 99998;
  width: 44px; height: 44px; margin: 0; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gc-primary); color: #fff; color: oklch(from var(--gc-primary) clamp(0, (0.72 - l) * 1000, 1) 0 0); border: 0; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
button.gc-floating { opacity: .85; }
button.gc-floating:hover { opacity: 1; }
button.gc-floating[hidden] { display: none; }
button.gc-floating.gc-floating-left { left: 16px; right: auto; }
button.gc-floating.gc-floating-right { right: 16px; left: auto; }

.gc-hidden { display: none !important; }

@media (max-width: 600px) {
  .gc-consent-banner .gc-actions { width: 100%; }
  .gc-consent-banner .gc-actions .gc-btn { flex: 1 1 auto; }
  .gc-modal-actions .gc-btn { flex: 1 1 100%; }
}

/* ---------- Contenuti esterni bloccati ----------
 * Solo <span> nell'HTML (il riquadro può stare in un <p>): la struttura la dà il CSS.
 * Colori neutri: deve leggersi sia su sfondi chiari sia dentro footer scuri. */
.gc-embed {
  --gc-primary: var(--e-global-color-primary, #1f7a4d);
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 200px; margin: 0 auto;
  box-sizing: border-box; padding: 16px;
  background: #f3f4f6; color: #1d1d1f;
  border: 1px solid rgba(0,0,0,.1); border-radius: 6px;
  font-size: 14px; line-height: 1.45; text-align: center;
  overflow: auto;
}
.gc-embed * { box-sizing: border-box; }
.gc-embed .gc-embed-ph { display: block; max-width: 520px; }
.gc-embed .gc-embed-title { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; color: inherit; }
.gc-embed .gc-embed-text { display: block; margin-bottom: 12px; color: inherit; }
.gc-embed .gc-embed-actions { display: flex; gap: 8px 16px; flex-wrap: wrap; align-items: center; justify-content: center; margin-bottom: 10px; }
.gc-embed button.gc-embed-btn {
  display: inline-block; margin: 0; padding: 9px 16px;
  background: var(--gc-primary); border: 2px solid var(--gc-primary); border-radius: 4px; color: #fff; color: oklch(from var(--gc-primary) clamp(0, (0.72 - l) * 1000, 1) 0 0);
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; letter-spacing: normal;
  text-transform: none; box-shadow: none; cursor: pointer;
}
.gc-embed button.gc-embed-btn:hover,
.gc-embed button.gc-embed-btn:focus { filter: brightness(.9); background: var(--gc-primary); color: #fff; color: oklch(from var(--gc-primary) clamp(0, (0.72 - l) * 1000, 1) 0 0); }
.gc-embed .gc-embed-actions a,
.gc-embed .gc-embed-links a { color: inherit; text-decoration: underline; }
.gc-embed .gc-embed-links { display: block; font-size: 12px; opacity: .8; }

/* Post social: il testo di riserva resta sotto, il riquadro è una fascia in cima */
.gc-embed.gc-embed-note { min-height: 0; margin: 0 0 12px; }
/* Dentro i contenitori a proporzione fissa (l'iframe è in posizione assoluta sopra uno spazio
   riservato con padding) il riquadro occupa tutto lo spazio: WordPress, Elementor, FitVids, Bootstrap */
.wp-has-aspect-ratio .wp-block-embed__wrapper > .gc-embed,
.elementor-fit-aspect-ratio > .gc-embed,
.elementor-video > .gc-embed,
.fluid-width-video-wrapper > .gc-embed,
.embed-responsive > .gc-embed,
.ratio > .gc-embed { position: absolute; inset: 0; height: 100%; max-width: none; aspect-ratio: auto; min-height: 0; }
.elementor-wrapper > .gc-embed { height: 100%; max-width: none; aspect-ratio: auto; }
[data-gc-embed-widget] .elementor-custom-embed-image-overlay { display: none !important; }
/* Schermi stretti: uno spazio 16:9 è troppo basso per il testo, il riquadro cresce col contenuto
   e i contenitori a proporzione fissa si adattano finché c'è il riquadro */
@media (max-width: 600px) {
  .gc-embed { padding: 12px; font-size: 13px; aspect-ratio: auto !important; height: auto; min-height: 0; }
  .gc-embed .gc-embed-text { margin-bottom: 8px; }
  .wp-has-aspect-ratio .wp-block-embed__wrapper > .gc-embed,
  .elementor-fit-aspect-ratio > .gc-embed,
  .elementor-video > .gc-embed,
  .elementor-wrapper > .gc-embed,
  .fluid-width-video-wrapper > .gc-embed,
  .embed-responsive > .gc-embed,
  .ratio > .gc-embed { position: static; height: auto; }
  .wp-block-embed__wrapper:has(> .gc-embed)::before,
  .ratio:has(> .gc-embed)::before,
  .embed-responsive:has(> .gc-embed)::before { display: none !important; }
  .elementor-wrapper:has(.gc-embed),
  .elementor-fit-aspect-ratio:has(> .gc-embed),
  .fluid-width-video-wrapper:has(> .gc-embed),
  .embed-responsive:has(> .gc-embed),
  .ratio:has(> .gc-embed) { aspect-ratio: auto !important; height: auto !important; padding: 0 !important; }
}
