/*
 * HardyTech Consent Manager — stili
 * Banner non invasivo (in basso, non blocca la navigazione) + pannello preferenze.
 * "Accetta tutti" e "Rifiuta tutti" hanno IDENTICO peso visivo (EDPB, Cookie
 * Banner Taskforce 2023; Linee guida Garante 2021): nessun dark pattern.
 */
:root {
  --cc-navy: #0A2540;
  --cc-navy-950: #05172B;
  --cc-ink: #0C1E33;
  --cc-muted: #55677D;
  --cc-line: #E5ECF4;
  --cc-line-2: #D6E0EC;
  --cc-surface: #F5F8FC;
  --cc-accent: #29ABE2;
  --cc-accent-dark: #1B4F8A;
  --cc-radius: 20px;
  --cc-shadow: 0 24px 64px rgba(10, 37, 64, 0.22), 0 2px 8px rgba(10, 37, 64, 0.08);
  --cc-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --cc-z: 2147483000;
}

.cc-banner, .cc-modal { font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--cc-ink); line-height: 1.55; letter-spacing: -0.006em; -webkit-font-smoothing: antialiased; }
.cc-banner *, .cc-modal * { box-sizing: border-box; }
.cc-banner[hidden], .cc-modal[hidden] { display: none !important; }
.cc-banner a, .cc-modal a { color: var(--cc-accent-dark); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.cc-banner a:hover, .cc-modal a:hover { color: var(--cc-accent); }
.cc-banner :focus-visible, .cc-modal :focus-visible { outline: 3px solid rgba(41, 171, 226, 0.6); outline-offset: 2px; border-radius: 8px; }

/* ---------------------------------------------------------------- Banner */
.cc-banner { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: var(--cc-z); display: flex; justify-content: center; pointer-events: none; }
.cc-banner__inner {
  position: relative; pointer-events: auto; width: 100%; max-width: 1040px;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px 22px;
  background: #fff; border: 1px solid var(--cc-line); border-radius: var(--cc-radius);
  box-shadow: var(--cc-shadow); padding: 22px 56px 22px 24px;
  transform: translateY(24px); opacity: 0; transition: transform .45s var(--cc-ease), opacity .45s var(--cc-ease);
}
.cc-banner.is-visible .cc-banner__inner { transform: none; opacity: 1; }
.cc-banner__icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(41, 171, 226, 0.12); color: var(--cc-accent-dark); }
.cc-banner__icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cc-banner h2 { margin: 0 0 4px; font-size: 1.02rem; font-weight: 800; letter-spacing: -0.02em; color: var(--cc-ink); }
.cc-banner p { margin: 0; font-size: 0.9rem; color: var(--cc-muted); }
.cc-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------------------------------------------------------------- Pulsanti */
.cc-btn {
  appearance: none; border-radius: 999px; padding: 12px 20px; min-height: 44px; /* target touch ≥ 44px */
  font: inherit; font-size: 0.92rem; font-weight: 700; line-height: 1; cursor: pointer; white-space: nowrap;
  transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s var(--cc-ease);
}
.cc-btn:active { transform: translateY(1px); }
/* Accetta e Rifiuta: stesso stile, stessa evidenza */
.cc-btn--solid { background: var(--cc-navy); color: #fff; border: 1.5px solid var(--cc-navy); }
.cc-btn--solid:hover { background: var(--cc-accent-dark); border-color: var(--cc-accent-dark); }
.cc-btn--outline { background: #fff; color: var(--cc-navy); border: 1.5px solid var(--cc-line-2); }
.cc-btn--outline:hover { border-color: var(--cc-accent); color: var(--cc-accent-dark); }

.cc-x { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--cc-muted); cursor: pointer; display: grid; place-items: center; }
.cc-x:hover { background: var(--cc-surface); color: var(--cc-ink); }
.cc-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.cc-x--static { position: static; }

/* ---------------------------------------------------------------- Pannello */
html.cc-lock { overflow: hidden; }
.cc-modal { position: fixed; inset: 0; z-index: calc(var(--cc-z) + 1); display: grid; place-items: center; padding: 16px; }
.cc-modal__backdrop { position: absolute; inset: 0; background: rgba(5, 23, 43, 0.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; transition: opacity .3s ease; }
.cc-modal__panel {
  position: relative; width: 100%; max-width: 640px; max-height: min(88vh, 760px); display: flex; flex-direction: column;
  background: #fff; border-radius: var(--cc-radius); box-shadow: var(--cc-shadow); outline: none;
  transform: translateY(16px) scale(.98); opacity: 0; transition: transform .35s var(--cc-ease), opacity .35s var(--cc-ease);
}
.cc-modal.is-open .cc-modal__backdrop { opacity: 1; }
.cc-modal.is-open .cc-modal__panel { transform: none; opacity: 1; }
.cc-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 20px 12px 24px; border-bottom: 1px solid var(--cc-line); }
.cc-modal__head h2 { margin: 0; font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; }
.cc-modal__body { padding: 16px 24px; overflow-y: auto; overscroll-behavior: contain; }
.cc-modal__body > p { margin: 0 0 14px; font-size: 0.92rem; color: var(--cc-muted); }
.cc-modal__foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 24px 20px; border-top: 1px solid var(--cc-line); }

.cc-cat { border: 1px solid var(--cc-line); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; background: #fff; }
.cc-cat__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cc-cat__title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cc-cat h3 { margin: 0; font-size: 0.98rem; font-weight: 700; }
.cc-cat__desc { margin: 6px 0 0; font-size: 0.87rem; color: var(--cc-muted); }
.cc-badge { font-size: 0.72rem; font-weight: 700; color: #166534; background: #DCFCE7; border-radius: 999px; padding: 3px 9px; }

.cc-details { margin-top: 8px; }
.cc-details summary { cursor: pointer; font-size: 0.84rem; font-weight: 600; color: var(--cc-accent-dark); padding: 4px 0; }
.cc-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 0.8rem; }
.cc-table th, .cc-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--cc-line); vertical-align: top; }
.cc-table th { color: var(--cc-muted); font-weight: 600; background: var(--cc-surface); }
.cc-table code { font-size: 0.78rem; background: var(--cc-surface); padding: 1px 5px; border-radius: 5px; }
.cc-empty { margin: 8px 0 0; font-size: 0.82rem; color: var(--cc-muted); font-style: italic; }

/* Interruttore accessibile (checkbox role="switch") */
.cc-switch { position: relative; display: inline-flex; flex-shrink: 0; width: 46px; height: 26px; }
.cc-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.cc-switch input:disabled { cursor: not-allowed; }
.cc-switch__track { width: 100%; height: 100%; border-radius: 999px; background: #C3CFDD; transition: background .2s ease; position: relative; }
.cc-switch__track::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,.25); transition: transform .2s var(--cc-ease); }
.cc-switch input:checked + .cc-switch__track { background: var(--cc-accent-dark); }
.cc-switch input:checked + .cc-switch__track::after { transform: translateX(20px); }
.cc-switch input:disabled + .cc-switch__track { opacity: .55; }
.cc-switch input:focus-visible + .cc-switch__track { outline: 3px solid rgba(41, 171, 226, 0.6); outline-offset: 2px; }

/* Link "Preferenze cookie" nei footer */
button[data-cc-open].cc-footer-link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 860px) {
  .cc-banner__inner { grid-template-columns: 1fr; padding: 20px 18px 18px; }
  .cc-banner__icon { display: none; }
  .cc-banner__text { padding-right: 32px; }
  .cc-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .cc-actions [data-cc="customize"] { grid-column: 1 / -1; order: 3; }
}
@media (max-width: 480px) {
  .cc-banner { left: 8px; right: 8px; bottom: 8px; }
  .cc-banner__inner { padding: 16px 14px 14px; gap: 12px; }
  .cc-banner h2 { font-size: .96rem; }
  .cc-banner p { font-size: .82rem; line-height: 1.5; }
  .cc-btn { padding: 10px 12px; font-size: .88rem; }
  .cc-actions { gap: 8px; }
  .cc-modal { padding: 0; place-items: end center; }
  .cc-modal__panel { max-height: 92vh; border-radius: 20px 20px 0 0; }
  .cc-modal__foot { display: grid; grid-template-columns: 1fr; }
  .cc-table th:nth-child(2), .cc-table td:nth-child(2) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cc-banner__inner, .cc-modal__panel, .cc-modal__backdrop { transition: none; }
}
@media print { .cc-banner, .cc-modal { display: none !important; } }

/* Link legali nel footer (Privacy e Cookie Policy · Preferenze cookie) */
.cc-legal-links { display: inline-flex; flex-wrap: wrap; gap: 4px 16px; margin-left: 16px; }
.cc-legal-links a { color: #B8C7DB; text-decoration: none; font-weight: 600; }
.cc-legal-links a:hover { color: #7DD4F7; text-decoration: underline; }
@media (max-width: 600px) { .cc-legal-links { display: flex; margin: 8px 0 0; } }
