/* PrestoWeb Consent: stile di banner, pannello e pulsante (ADR-38). Personalizzabile con le variabili --pwc-*
   o con "theme" nella configurazione (es. {"accent": "#1f4dff"} diventa --pwc-accent). */
.pwc {
  --pwc-accent: #1f2937;
  --pwc-accent-text: #fff;
  --pwc-bg: #fff;
  --pwc-text: #111827;
  --pwc-muted: #4b5563;
  --pwc-line: #e5e7eb;
  --pwc-soft: #f3f4f6;
  --pwc-radius: 14px;
  --pwc-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-family: var(--pwc-font);
  color: var(--pwc-text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}
.pwc *, .pwc *::before, .pwc *::after { box-sizing: inherit; }
.pwc h2, .pwc h3, .pwc p, .pwc ul { margin: 0; padding: 0; }
.pwc button { font: inherit; }
.pwc-link { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* Pulsanti: «Rifiuta» e «Accetta tutti» hanno lo stesso peso visivo, come chiede il Garante */
.pwc-btn {
  appearance: none; cursor: pointer; border-radius: 10px; padding: .65rem 1rem; font-size: .9rem; font-weight: 600;
  border: 1.5px solid var(--pwc-accent); background: var(--pwc-bg); color: var(--pwc-accent); line-height: 1.2;
}
.pwc-btn:hover { background: var(--pwc-soft); }
.pwc-btn.pwc-primary { background: var(--pwc-accent); color: var(--pwc-accent-text); }
.pwc-btn.pwc-primary:hover { filter: brightness(1.1); }
.pwc-btn:focus-visible, .pwc-x:focus-visible, .pwc-fab:focus-visible, .pwc summary:focus-visible, .pwc-switch input:focus-visible + .pwc-slider {
  outline: 2px solid var(--pwc-accent); outline-offset: 2px;
}
.pwc-x {
  appearance: none; border: 0; background: transparent; color: var(--pwc-muted); cursor: pointer;
  width: 34px; height: 34px; border-radius: 50%; font-size: 1.5rem; line-height: 1; display: grid; place-items: center;
}
.pwc-x:hover { background: var(--pwc-soft); color: var(--pwc-text); }

/* Banner */
.pwc-banner {
  position: fixed; z-index: 2147483000; left: 12px; right: 12px; bottom: 12px;
  background: var(--pwc-bg); border: 1px solid var(--pwc-line); border-radius: var(--pwc-radius);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, .28); padding: 1.25rem 1.25rem 1.1rem;
  max-height: calc(100vh - 24px); overflow: auto;
}
.pwc-banner .pwc-x { position: absolute; top: 8px; right: 8px; }
.pwc-banner .pwc-title { font-size: 1.05rem; font-weight: 700; padding-right: 2rem; }
.pwc-banner .pwc-text { margin-top: .45rem; font-size: .9rem; color: var(--pwc-muted); }
.pwc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: 1rem; }
/* Su telefono «Rifiuta» e «Accetta tutti» stanno affiancati e uguali, «Personalizza» sotto */
.pwc-actions .pwc-btn:nth-child(2) { grid-column: 1 / -1; order: 1; }
@media (min-width: 720px) {
  .pwc-banner { right: auto; left: 24px; bottom: 24px; width: 30rem; }
  .pwc-banner[data-position="right"] { left: auto; right: 24px; }
  .pwc-actions { grid-template-columns: repeat(3, auto); justify-content: end; }
  .pwc-actions .pwc-btn:nth-child(2) { grid-column: auto; order: 0; }
}

/* Pannello delle preferenze */
.pwc-lock, .pwc-lock body { overflow: hidden; }
.pwc-overlay {
  position: fixed; inset: 0; z-index: 2147483001; background: rgba(17, 24, 39, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
.pwc-dialog {
  background: var(--pwc-bg); width: 100%; max-height: 92vh; display: flex; flex-direction: column;
  border-radius: var(--pwc-radius) var(--pwc-radius) 0 0; box-shadow: 0 24px 64px rgba(0, 0, 0, .3);
}
@media (min-width: 720px) {
  .pwc-overlay { align-items: center; padding: 24px; }
  .pwc-dialog { max-width: 40rem; max-height: min(44rem, 90vh); border-radius: var(--pwc-radius); }
}
.pwc-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1rem .5rem 1.25rem; }
.pwc-panel-head .pwc-title { font-size: 1.15rem; font-weight: 700; }
.pwc-panel-body { overflow: auto; padding: 0 1.25rem 1rem; }
.pwc-panel-body > .pwc-text { color: var(--pwc-muted); font-size: .9rem; }
.pwc-cats { list-style: none; margin-top: 1rem; display: grid; gap: .6rem; }
.pwc-cat { border: 1px solid var(--pwc-line); border-radius: 12px; padding: .85rem 1rem; }
.pwc-cat-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.pwc-cat-head h3 { font-size: .98rem; font-weight: 700; }
.pwc-cat-desc { margin-top: .3rem; font-size: .87rem; color: var(--pwc-muted); }
.pwc-always { font-size: .8rem; font-weight: 600; color: var(--pwc-muted); white-space: nowrap; }
.pwc details { margin-top: .5rem; }
.pwc summary { cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--pwc-text); width: fit-content; border-radius: 4px; }
.pwc-svc { margin-top: .7rem; padding-top: .7rem; border-top: 1px dashed var(--pwc-line); font-size: .85rem; }
.pwc-svc-head span { color: var(--pwc-muted); }
.pwc-svc-desc { margin-top: .2rem; color: var(--pwc-muted); }
.pwc-table { overflow-x: auto; margin-top: .45rem; }
.pwc table { border-collapse: collapse; width: 100%; font-size: .8rem; }
.pwc th, .pwc td { text-align: left; vertical-align: top; padding: .35rem .5rem; border-bottom: 1px solid var(--pwc-line); }
.pwc th { color: var(--pwc-muted); font-weight: 600; background: var(--pwc-soft); }
.pwc code { font-family: ui-monospace, Consolas, monospace; font-size: .95em; word-break: break-all; }
.pwc-meta { margin-top: 1rem; font-size: .75rem; color: var(--pwc-muted); word-break: break-all; }
.pwc-panel-foot { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; padding: .85rem 1.25rem 1rem; border-top: 1px solid var(--pwc-line); }
.pwc-panel-foot .pwc-btn:nth-child(2) { grid-column: 1 / -1; order: 1; }
.pwc-foot-single { grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .pwc-panel-foot { grid-template-columns: repeat(3, auto); justify-content: end; }
  .pwc-foot-single { grid-template-columns: auto; }
  .pwc-panel-foot .pwc-btn:nth-child(2) { grid-column: auto; order: 0; }
}

/* Interruttore */
.pwc-switch { position: relative; display: inline-block; width: 44px; height: 26px; flex-shrink: 0; cursor: pointer; }
.pwc-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.pwc-slider { position: absolute; inset: 0; border-radius: 999px; background: #d1d5db; transition: background .15s; pointer-events: none; }
.pwc-slider::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.pwc-switch input:checked + .pwc-slider { background: var(--pwc-accent); }
.pwc-switch input:checked + .pwc-slider::after { transform: translateX(18px); }

/* Pulsante fisso per riaprire le preferenze */
.pwc-fab {
  position: fixed; z-index: 2147482999; left: 16px; bottom: 16px; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--pwc-line); background: var(--pwc-bg); color: var(--pwc-accent); cursor: pointer;
  display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); padding: 0;
}
.pwc-fab[data-position="right"] { left: auto; right: 16px; }
.pwc-fab:hover { transform: scale(1.06); }

/* Segnaposto dei contenuti esterni (mappe e video) */
.pw-embed { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #eef1f4; border-radius: .75rem; overflow: hidden; }
.pw-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.pw-embed-ph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; padding: 1rem; text-align: center; font: 400 .875rem/1.5 system-ui, sans-serif; color: #3b4654; }
.pw-embed-ph p { margin: 0; }
.pw-embed-ph button { border: 0; border-radius: .6rem; padding: .6rem 1rem; font: 600 .875rem system-ui, sans-serif; background: #0b192a; color: #fff; cursor: pointer; }

@media (prefers-reduced-motion: reduce) { .pwc-slider, .pwc-slider::after { transition: none; } .pwc-fab:hover { transform: none; } }
@media print { .pwc-banner, .pwc-fab, .pwc-overlay { display: none !important; } }

/* Tabella dei cookie generata nella cookie policy (ConsentPolicy::cookieTable) */
.pw-cookie-table { overflow-x: auto; margin: 1rem 0; }
.pw-cookie-table table { border-collapse: collapse; width: 100%; min-width: 640px; font-size: .875rem; line-height: 1.45; }
.pw-cookie-table th, .pw-cookie-table td { text-align: left; vertical-align: top; padding: .5rem .6rem; border: 1px solid rgba(0, 0, 0, .12); }
.pw-cookie-table th { font-weight: 600; background: rgba(0, 0, 0, .04); }
.pw-cookie-table code { font-size: .9em; word-break: break-all; }
.pw-cookie-table small { opacity: .75; }
