/*! BiscottiOnesti 1.0.1 | (C) 2026 Silvano De Poli, CookieDiOdino (C) 2026 Runa di Odino | GPL-3.0-or-later */

/* Colori: variabili --bon-accent / --bon-bg / --bon-text impostate dal plugin (opzioni), con ripiego */
.bon-root,
.bon-placeholder,
.bon-policy {
  --_a: var(--bon-accent, #1f5f8b);
  --_bg: var(--bon-bg, #ffffff);
  --_t: var(--bon-text, #1d1d1d);
  --_at: var(--bon-accent-text, #ffffff);
  --_line: rgba(127, 127, 127, .3);
  --_font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.bon-root [hidden],
.bon-policy [hidden],
.bon-banner[hidden],
.bon-float[hidden] {
  display: none !important;
}

.bon-vh {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---------- pulsanti ---------- */

.bon-btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 2.5rem;
  margin: 0;
  padding: .5rem 1.125rem;
  border: 2px solid var(--_a);
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  transition: filter .15s ease, background-color .15s ease;
}

/* Accetta e Rifiuta hanno lo stesso stile (stessa evidenza) */
.bon-btn--primary {
  background: var(--_a);
  color: var(--_at);
}

.bon-btn--secondary {
  background: transparent;
  color: var(--_a);
}

.bon-btn:hover {
  filter: brightness(1.12);
}

.bon-btn--secondary:hover {
  background: rgba(127, 127, 127, .12);
}

.bon-btn:focus-visible,
.bon-x:focus-visible,
.bon-float:focus-visible,
.bon-root a:focus-visible,
.bon-prefs summary:focus-visible,
.bon-switch__input:focus-visible + .bon-switch__ui {
  outline: 3px solid var(--_a);
  outline-offset: 2px;
}

.bon-x {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.bon-x:hover {
  background: rgba(127, 127, 127, .15);
}

/* ---------- banner ---------- */

.bon-banner {
  position: fixed;
  z-index: 2147483000;
  box-sizing: border-box;
  background: var(--_bg);
  color: var(--_t);
  font-family: var(--_font);
  font-size: .9375rem;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, .18);
}

.bon-root--inherit .bon-banner,
.bon-root--inherit .bon-prefs,
.bon-root--inherit .bon-float {
  font-family: inherit;
}

.bon-banner *,
.bon-prefs * {
  box-sizing: border-box;
}

.bon-banner__inner {
  position: relative;
  display: grid;
  gap: .25rem 1.5rem;
  margin: 0 auto;
}

.bon-banner__close {
  position: absolute;
  top: .375rem;
  right: .375rem;
}

.bon-banner__title {
  grid-area: title;
  margin: 0;
  padding-right: 2rem;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
  color: inherit;
}

.bon-banner__text {
  grid-area: text;
}

.bon-banner__text p {
  margin: 0 0 .25rem;
}

.bon-banner__text p:last-child {
  margin-bottom: 0;
}

.bon-banner a,
.bon-prefs a {
  color: var(--_a);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.bon-banner__links {
  grid-area: links;
  margin: 0;
  font-size: .875em;
}

.bon-banner .bon-gpc {
  grid-area: gpc;
}

.bon-gpc {
  margin: .25rem 0 0;
  padding-left: .5rem;
  border-left: 3px solid var(--_a);
  font-size: .875em;
}

.bon-banner__actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  justify-content: flex-end;
}

.bon-banner__actions .bon-btn {
  white-space: nowrap;
}

/* Barra in basso (predefinita) */
.bon-banner--bar {
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 60vh;
  overflow: auto;
  padding-bottom: env(safe-area-inset-bottom, 0);
  animation: bon-in-up .3s ease-out;
}

.bon-banner--bar .bon-banner__inner {
  max-width: 1180px;
  padding: 1rem 3rem 1rem 1.25rem;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title actions"
    "text actions"
    "links actions"
    "gpc actions";
  align-items: center;
}

/* Riquadro in basso a sinistra */
.bon-banner--box {
  left: 1rem;
  bottom: 1rem;
  width: calc(100vw - 2rem);
  max-width: 26rem;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .25);
  animation: bon-in-up .3s ease-out;
}

/* Centrato (senza sfondo che copre la pagina: non è un cookie wall) */
.bon-banner--modal {
  left: 50%;
  top: 50%;
  width: calc(100vw - 2rem);
  max-width: 36rem;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .35);
  transform: translate(-50%, -50%);
}

.bon-banner--box .bon-banner__inner,
.bon-banner--modal .bon-banner__inner {
  padding: 1.125rem 1.25rem 1.25rem;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "title" "text" "links" "gpc" "actions";
}

.bon-banner--box .bon-banner__actions,
.bon-banner--modal .bon-banner__actions {
  margin-top: .5rem;
  justify-content: stretch;
}

.bon-banner--box .bon-banner__actions .bon-btn,
.bon-banner--modal .bon-banner__actions .bon-btn {
  flex: 1 1 0;
}

@keyframes bon-in-up {
  from {
    opacity: 0;
    transform: translateY(1.5rem);
  }
}

/* Mobile: barra compatta (≈ un terzo dello schermo), testo scorrevole, pulsanti sempre visibili */
@media (max-width: 640px) {
  .bon-banner--bar {
    display: flex;
    flex-direction: column;
    max-height: 35vh;
    overflow: hidden;
    font-size: .8125rem;
    line-height: 1.4;
  }

  .bon-banner--bar .bon-banner__inner {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    padding: .625rem .875rem .75rem;
    gap: .3rem;
  }

  .bon-banner--bar .bon-banner__title {
    flex: 0 0 auto;
    font-size: .9375rem;
  }

  .bon-banner--bar .bon-banner__text {
    flex: 1 1 auto;
    min-height: 2.8em;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .bon-banner--bar .bon-banner__links,
  .bon-banner--bar .bon-gpc {
    flex: 0 0 auto;
  }

  .bon-banner__close {
    top: .25rem;
    right: .25rem;
  }

  .bon-banner--bar .bon-banner__actions,
  .bon-banner--box .bon-banner__actions,
  .bon-banner--modal .bon-banner__actions {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .375rem;
    margin-top: .25rem;
  }

  .bon-banner__actions .bon-btn {
    min-height: 2.5rem;
    padding: .45rem .3rem;
    font-size: .8125rem;
    white-space: normal;
  }

  .bon-banner--box {
    left: .5rem;
    right: .5rem;
    bottom: .5rem;
    width: auto;
    max-width: none;
  }
}

@media (max-width: 340px) {
  .bon-banner--bar .bon-banner__actions,
  .bon-banner--box .bon-banner__actions,
  .bon-banner--modal .bon-banner__actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bon-banner__actions [data-bon-action="customize"] {
    grid-column: 1 / -1;
  }
}

/* Telefoni in orizzontale: poco spazio verticale */
@media (max-width: 960px) and (max-height: 480px) {
  .bon-banner--bar {
    max-height: 55vh;
  }
}

/* ---------- pannello preferenze ---------- */

dialog.bon-prefs:not([open]) {
  display: none;
}

.bon-prefs {
  width: min(40rem, calc(100vw - 1.5rem));
  max-width: none;
  max-height: min(88vh, 50rem);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--_bg);
  color: var(--_t);
  font-family: var(--_font);
  font-size: .9375rem;
  line-height: 1.5;
  text-align: left;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .35);
  overflow: hidden;
}

.bon-prefs::backdrop {
  background: rgba(0, 0, 0, .5);
}

.bon-prefs--fallback {
  position: fixed;
  z-index: 2147483001;
  inset: 0;
  height: fit-content;
}

.bon-prefs__inner {
  display: flex;
  flex-direction: column;
  max-height: inherit;
}

.bon-prefs__head {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .875rem 1rem .875rem 1.25rem;
  border-bottom: 1px solid var(--_line);
}

.bon-prefs__title {
  margin: 0;
  font-family: inherit;
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.3;
  color: inherit;
}

.bon-prefs__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: .75rem 1.25rem 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.bon-prefs__intro {
  margin: 0 0 .5rem;
  font-size: .875rem;
}

.bon-prefs__foot {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .5rem;
  padding: .875rem 1.25rem;
  border-top: 1px solid var(--_line);
}

.bon-cat {
  padding: .875rem 0;
  border-top: 1px solid var(--_line);
}

.bon-cat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.bon-cat__title {
  margin: 0;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  color: inherit;
}

.bon-cat__always {
  flex: 0 0 auto;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--_a);
}

.bon-cat__desc {
  margin: .375rem 0 0;
  font-size: .875rem;
}

.bon-cat__services summary {
  display: list-item;
  margin-top: .5rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--_a);
  cursor: pointer;
}

.bon-svc-list {
  margin: .5rem 0 0;
  padding: 0;
  list-style: none;
}

.bon-svc {
  margin: .5rem 0 0;
  padding: .625rem .75rem;
  border-radius: 8px;
  background: rgba(127, 127, 127, .09);
}

.bon-svc__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.bon-svc__title {
  font-weight: 600;
}

.bon-svc__provider {
  display: block;
  font-size: .8125rem;
  font-weight: 400;
  opacity: .85;
}

.bon-svc__desc,
.bon-svc__cookies {
  margin: .375rem 0 0;
  font-size: .8125rem;
}

/* Interruttore (checkbox role="switch") */
.bon-switch {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: 2.75rem;
  height: 1.5rem;
  cursor: pointer;
}

.bon-switch__input {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.bon-switch__ui {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #767676;
  transition: background-color .2s ease;
}

.bon-switch__ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(1.5rem - 6px);
  height: calc(1.5rem - 6px);
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  transition: transform .2s ease;
}

.bon-switch__input:checked + .bon-switch__ui {
  background: var(--_a);
}

.bon-switch__input:checked + .bon-switch__ui::after {
  transform: translateX(1.25rem);
}

.bon-switch__input:disabled,
.bon-switch__input:disabled + .bon-switch__ui {
  cursor: not-allowed;
  opacity: .5;
}

.bon-switch--sm {
  width: 2.25rem;
  height: 1.25rem;
}

.bon-switch--sm .bon-switch__ui::after {
  width: calc(1.25rem - 6px);
  height: calc(1.25rem - 6px);
}

.bon-switch--sm .bon-switch__input:checked + .bon-switch__ui::after {
  transform: translateX(1rem);
}

@media (max-width: 640px) {
  .bon-prefs {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 1rem);
    font-size: .875rem;
  }

  .bon-prefs__head,
  .bon-prefs__body,
  .bon-prefs__foot {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .bon-prefs__foot {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .375rem;
  }

  .bon-prefs__foot .bon-btn {
    padding: .45rem .3rem;
    font-size: .8125rem;
  }
}

/* ---------- pulsante fluttuante ---------- */

.bon-float {
  -webkit-appearance: none;
  appearance: none;
  position: fixed;
  z-index: 2147482999;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 2px solid var(--_bg);
  border-radius: 50%;
  background: var(--_a);
  color: var(--_at);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
  cursor: pointer;
  opacity: .92;
  transition: opacity .15s ease, transform .15s ease;
}

.bon-float:hover {
  opacity: 1;
  transform: scale(1.06);
}

.bon-float--bottom-left {
  right: auto;
  left: 1rem;
}

@media (max-width: 640px) {
  .bon-float {
    right: .75rem;
    bottom: calc(.75rem + env(safe-area-inset-bottom, 0px));
    width: 2.5rem;
    height: 2.5rem;
  }

  .bon-float--bottom-left {
    right: auto;
    left: .75rem;
  }
}

/* ---------- segnaposto degli iframe bloccati ---------- */

.bon-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 12rem;
  margin: 0 0 1rem;
  padding: 1.25rem;
  border-radius: 8px;
  background: #1d1d1d linear-gradient(135deg, rgba(255, 255, 255, .07), rgba(0, 0, 0, .25));
  color: #ffffff;
  font-size: .9375rem;
  line-height: 1.45;
  text-align: center;
}

.bon-placeholder__inner {
  max-width: 32rem;
}

.bon-placeholder__text {
  margin: 0 0 .75rem;
}

.bon-placeholder__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
  margin: 0;
}

.bon-placeholder .bon-btn {
  border-color: #ffffff;
}

.bon-placeholder .bon-btn--primary {
  background: #ffffff;
  color: #1d1d1d;
}

.bon-placeholder .bon-btn--secondary {
  color: #ffffff;
}

.bon-placeholder .bon-btn:focus-visible {
  outline-color: #ffffff;
}

.bon-placeholder__links {
  margin: .75rem 0 0;
  font-size: .8125rem;
}

.bon-placeholder a {
  color: #ffffff;
  text-decoration: underline;
}

/* ---------- cookie policy ---------- */

.bon-policy__edit {
  margin: 1rem 0 1.5rem;
}

.bon-policy__toc ul {
  margin: 0 0 1.5rem;
  padding-left: 1.25rem;
}

.bon-policy__cat {
  margin: 2rem 0 0;
}

.bon-policy__basis {
  font-size: .9375em;
}

.bon-policy__service {
  margin: 1.25rem 0 0;
}

.bon-policy__provider {
  font-size: .9375em;
}

.bon-policy__table-wrap {
  margin: .5rem 0 1.25rem;
  overflow-x: auto;
}

.bon-policy__table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.bon-policy__table caption {
  padding: .25rem 0;
  caption-side: top;
  font-weight: 600;
  text-align: left;
}

.bon-policy__table th,
.bon-policy__table td {
  padding: .5rem .625rem;
  border-bottom: 1px solid var(--_line);
  text-align: left;
  vertical-align: top;
}

.bon-policy__table thead th {
  border-bottom-width: 2px;
  font-weight: 700;
}

.bon-policy__table code {
  white-space: nowrap;
}

.bon-policy__none {
  font-style: italic;
}

.bon-policy__consent {
  margin: 2rem 0 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--_line);
  border-left: 4px solid var(--_a);
  border-radius: 6px;
}

.bon-policy__consent h2 {
  margin-top: 0;
}

.bon-policy__consent-data {
  margin: 0;
}

.bon-policy__consent-data div {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1rem;
  padding: .25rem 0;
}

.bon-policy__consent-data dt {
  min-width: 8rem;
  font-weight: 600;
}

.bon-policy__consent-data dd {
  margin: 0;
  word-break: break-all;
}

.bon-policy__hint,
.bon-policy__updated {
  font-size: .875em;
}

@media (max-width: 640px) {
  .bon-policy__table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .bon-policy__table tr {
    display: block;
    padding: .5rem 0;
    border-bottom: 1px solid var(--_line);
  }

  .bon-policy__table th,
  .bon-policy__table td {
    display: block;
    padding: .125rem 0;
    border: 0;
  }

  .bon-policy__table td::before {
    content: attr(data-label) ": ";
    font-weight: 600;
  }
}

/* ---------- accessibilità e stampa ---------- */

@media (prefers-reduced-motion: reduce) {
  .bon-banner,
  .bon-btn,
  .bon-float,
  .bon-switch__ui,
  .bon-switch__ui::after {
    animation: none !important;
    transition: none !important;
  }

  .bon-float:hover {
    transform: none;
  }
}

@media (forced-colors: active) {
  .bon-switch__ui {
    border: 1px solid CanvasText;
  }

  .bon-switch__input:checked + .bon-switch__ui {
    background: Highlight;
  }
}

@media print {
  .bon-root {
    display: none !important;
  }
}
