/*
 * Banner e preferenze cookie. Prefisso scc-.
 * I tre pulsanti d'azione hanno IDENTICO peso grafico: evidenziarne uno solo
 * è un dark pattern e il Garante lo considera non conforme.
 * I colori si possono ereditare dal sito ridefinendo le variabili --scc-*.
 */
.scc-host {
  --scc-bg: #ffffff;
  --scc-fg: #14213d;
  --scc-muted: #4b5873;
  --scc-line: #c9d1e0;
  --scc-focus: #1d4ed8;
  --scc-shadow: 0 10px 40px rgba(11, 18, 36, .22);
}
:root[data-theme="dark"] .scc-host {
  --scc-bg: #121a30;
  --scc-fg: #f1f4fb;
  --scc-muted: #aab6d3;
  --scc-line: #34416a;
  --scc-focus: #8fb0ff;
  --scc-shadow: 0 10px 40px rgba(0, 0, 0, .55);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .scc-host {
    --scc-bg: #121a30;
    --scc-fg: #f1f4fb;
    --scc-muted: #aab6d3;
    --scc-line: #34416a;
    --scc-focus: #8fb0ff;
    --scc-shadow: 0 10px 40px rgba(0, 0, 0, .55);
  }
}

.scc, .scc * { box-sizing: border-box; }
.scc {
  position: relative;
  color: var(--scc-fg);
  background: var(--scc-bg);
  border: 1px solid var(--scc-line);
  border-radius: 14px;
  box-shadow: var(--scc-shadow);
  padding: 20px 22px 18px;
  font: 400 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.scc h2 { margin: 0 40px 8px 0; font-size: 17px; line-height: 1.3; font-weight: 700; }
.scc p { margin: 0 0 14px; color: var(--scc-muted); }
.scc a { color: var(--scc-fg); text-decoration: underline; text-underline-offset: 2px; }

/* Banner: in basso, non copre tutta la pagina */
.scc-banner {
  position: fixed;
  z-index: 2147483000;
  left: 16px; right: 16px; bottom: 16px;
  max-width: 760px;
  margin: 0 auto;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}

/* Pannello: sopra un velo, il resto della pagina non è raggiungibile */
.scc-backdrop {
  position: fixed; inset: 0;
  z-index: 2147483001;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(11, 18, 36, .55);
}
.scc-panel { width: 100%; max-width: 640px; max-height: calc(100vh - 32px); overflow: auto; }
html.scc-lock { overflow: hidden; }

/* X in alto a destra, stessa grafica dei pulsanti d'azione */
.scc-x {
  position: absolute; top: 12px; right: 12px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid var(--scc-fg); border-radius: 10px;
  background: transparent; color: var(--scc-fg);
  font: 400 26px/1 system-ui, sans-serif;
  cursor: pointer;
}

.scc-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.scc-btn {
  flex: 1 1 150px;
  min-height: 44px;           /* bersaglio tattile da tablet */
  padding: 10px 16px;
  border: 1px solid var(--scc-fg); border-radius: 10px;
  background: transparent; color: var(--scc-fg);
  font: 600 15px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
}
.scc-btn:hover, .scc-x:hover { background: color-mix(in srgb, var(--scc-fg) 8%, transparent); }
.scc button:focus-visible, .scc a:focus-visible, .scc summary:focus-visible, .scc input:focus-visible {
  outline: 3px solid var(--scc-focus); outline-offset: 2px;
}

.scc-rows { margin: 4px 0 16px; border-top: 1px solid var(--scc-line); }
.scc-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--scc-line);
}
.scc-row-t { display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.scc-row-t span { color: var(--scc-muted); font-size: 14px; }
.scc-sw { flex: none; width: 24px; height: 24px; margin-top: 2px; accent-color: var(--scc-fg); }
.scc-det { padding: 0 0 12px; border-bottom: 1px solid var(--scc-line); font-size: 14px; color: var(--scc-muted); }
.scc-det summary { cursor: pointer; padding: 8px 0; color: var(--scc-fg); }
.scc-det ul { margin: 0; padding-left: 18px; }
.scc-note { margin: 14px 0 !important; }

@media (max-width: 520px) {
  .scc { padding: 16px 16px 14px; }
  .scc-banner { left: 8px; right: 8px; bottom: 8px; }
  .scc-btn { flex-basis: 100%; }
}
@media (prefers-reduced-motion: no-preference) {
  .scc-banner { animation: scc-in .22s ease-out; }
  @keyframes scc-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
}
