/* Personalizzazioni Avanzate - stile del widget
 * Ogni modello imposta le variabili --advc-* (colore principale, fondo, bordo, raggio).
 * Per personalizzazioni grafiche usare le classi/id impostati nel modello.
 */
.advc-root { margin: 0 0 1.25rem; }
.advc-loading { min-height: 40px; }
.advc {
  --advc-accent: #1f1f1f;
  --advc-soft: #f4efe9;
  --advc-border: #e3dcd3;
  --advc-radius: 14px;
  --advc-text: #1f1f1f;
  --advc-muted: #6f6a64;
  --advc-ok: #2f7a4a;
  --advc-ok-bg: #e9f4ec;
  --advc-warn: #8a5a00;
  --advc-warn-bg: #fdf3dc;
  --advc-bad: #b3261e;
  --advc-bad-bg: #fbeaea;
  color: var(--advc-text);
  font-size: 15px;
  line-height: 1.4;
  text-align: left;
}
.advc *, .advc *::before, .advc *::after { box-sizing: border-box; }
.advc [hidden] { display: none !important; }
.advc-title { font-size: 1.1rem; font-weight: 700; margin-bottom: .25rem; }
.advc-intro { color: var(--advc-muted); margin-bottom: 1rem; }

/* griglia campi */
.advc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem 1rem; }
.advc-field { grid-column: 1 / -1; min-width: 0; }
.advc-field.advc-w-half { grid-column: auto; }
@media (max-width: 520px) { .advc-field.advc-w-half { grid-column: 1 / -1; } }

.advc-label { display: flex; align-items: baseline; flex-wrap: wrap; gap: .35rem; font-weight: 600; font-size: 1rem; margin: 0 0 .5rem; color: var(--advc-text); }
.advc-req { color: var(--advc-bad); font-weight: 600; }
.advc-price, .advc-opt-price { font-weight: 500; font-size: .82em; color: var(--advc-muted); white-space: nowrap; }

/* input */
.advc .advc-input {
  display: block; width: 100%; min-height: 52px; margin: 0;
  padding: .8rem 1rem; font: inherit; font-size: 1.05rem; color: var(--advc-text);
  background: #fff; border: 1px solid var(--advc-border); border-radius: var(--advc-radius);
  box-shadow: none; outline: none; transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
.advc textarea.advc-input { min-height: 0; resize: vertical; }
.advc .advc-input::placeholder { color: #9a948d; opacity: 1; }
.advc .advc-input:focus { border-color: var(--advc-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--advc-accent) 15%, transparent); }
.advc select.advc-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23555' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 1rem center; padding-right: 2.5rem;
}
.advc input.advc-date { -webkit-appearance: auto; appearance: auto; }
.advc .has-error .advc-input { border-color: var(--advc-bad); }

.advc-meta { display: flex; justify-content: space-between; gap: 1rem; margin-top: .4rem; font-size: .82rem; color: var(--advc-muted); }
.advc-counter { margin-left: auto; font-variant-numeric: tabular-nums; }
.advc-error { color: var(--advc-bad); font-size: .85rem; margin-top: .35rem; }
.advc-error:empty { display: none; }

/* messaggio data */
.advc-date-msg {
  display: flex; align-items: center; gap: .6rem; margin-top: .75rem;
  padding: .85rem 1rem; border-radius: calc(var(--advc-radius) * .75);
  background: var(--advc-soft); color: #4a4540; font-size: .9rem;
}
.advc-date-icon { display: inline-flex; flex: 0 0 auto; }
.advc-date-msg--ok { background: var(--advc-ok-bg); color: var(--advc-ok); }
.advc-date-msg--warn { background: var(--advc-warn-bg); color: var(--advc-warn); }
.advc-date-msg--late { background: var(--advc-bad-bg); color: var(--advc-bad); }

/* scelte: comune */
.advc-choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.advc .advc-opt {
  font: inherit; color: var(--advc-text); cursor: pointer; margin: 0;
  background: #fff; border: 1px solid var(--advc-border); border-radius: var(--advc-radius);
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .7rem 1rem; line-height: 1.2; text-align: center;
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
}
.advc .advc-opt:hover { border-color: color-mix(in srgb, var(--advc-accent) 45%, var(--advc-border)); }
.advc .advc-opt:focus-visible { outline: 2px solid var(--advc-accent); outline-offset: 2px; }
.advc .advc-opt.is-selected { border-color: var(--advc-accent); box-shadow: inset 0 0 0 1px var(--advc-accent); }
.advc-opt-img { width: 28px; height: 28px; object-fit: contain; }
.advc-opt-color { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); }

/* segmentato (come nello screenshot) */
.advc-choices--segmented { flex-wrap: nowrap; gap: 4px; padding: 4px; background: var(--advc-soft); border-radius: var(--advc-radius); }
.advc .advc-choices--segmented .advc-opt { flex: 1 1 0; min-height: 52px; border: 0; background: transparent; border-radius: calc(var(--advc-radius) - 3px); box-shadow: none; flex-direction: column; gap: 0; }
.advc .advc-choices--segmented .advc-opt.is-selected { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 1px rgba(0,0,0,.04); font-weight: 600; }
.advc-choices--segmented .advc-opt-price { font-size: .75rem; }
.advc .advc-choices--segmented .advc-opt { min-width: 0; padding: .6rem .5rem; }
.advc-choices--segmented.advc-many { flex-wrap: wrap; }
.advc .advc-choices--segmented.advc-many .advc-opt { flex: 1 1 calc(33.333% - 4px); }
@media (max-width: 420px) { .advc .advc-choices--segmented.advc-many .advc-opt { flex-basis: calc(50% - 4px); } }

/* pulsanti */
.advc .advc-choices--buttons .advc-opt { min-height: 48px; }
.advc .advc-choices--buttons .advc-opt.is-selected { background: var(--advc-accent); color: #fff; }
.advc .advc-choices--buttons .advc-opt.is-selected .advc-opt-price { color: rgba(255,255,255,.8); }

/* schede con immagine */
.advc-choices--cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.advc .advc-choices--cards .advc-opt { flex-direction: column; padding: .8rem .6rem; gap: .35rem; }
.advc-choices--cards .advc-opt-img { width: 100%; height: 72px; }
.advc-opt-desc { font-size: .78rem; color: var(--advc-muted); }
.advc .advc-choices--cards .advc-opt.is-selected { background: var(--advc-soft); }

/* campioni colore */
.advc-choices--swatches { gap: .75rem 1rem; align-items: flex-start; }
.advc .advc-choices--swatches .advc-opt { flex-direction: column; border: 0; padding: 0; background: none; box-shadow: none; gap: .3rem; min-width: 48px; }
.advc-swatch-dot { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); background-size: cover; background-position: center; transition: box-shadow .15s; }
.advc-choices--swatches .advc-opt-label { font-size: .78rem; color: var(--advc-muted); }
.advc-choices--swatches .advc-opt-price { font-size: .72rem; }
.advc .advc-choices--swatches .advc-opt.is-selected { box-shadow: none; }
.advc-choices--swatches .advc-opt.is-selected .advc-swatch-dot { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--advc-accent); }
.advc-choices--swatches .advc-opt.is-selected .advc-opt-label { color: var(--advc-text); font-weight: 600; }

/* radio */
.advc-choices--radio { flex-direction: column; gap: .4rem; }
.advc .advc-choices--radio .advc-opt { justify-content: flex-start; border: 0; padding: .35rem 0; background: none; box-shadow: none; text-align: left; }
.advc-radio-dot { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--advc-border); flex: 0 0 auto; position: relative; background: #fff; }
.advc-choices--radio .advc-opt.is-selected .advc-radio-dot { border-color: var(--advc-accent); }
.advc-choices--radio .advc-opt.is-selected .advc-radio-dot::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--advc-accent); }
.advc-choices--radio .advc-opt-price { margin-left: .25rem; }

/* casella sì/no */
.advc .advc-check { text-align: left; }
.advc-check { display: flex; align-items: center; gap: .75rem; cursor: pointer; margin: 0; padding: .85rem 1rem; border: 1px solid var(--advc-border); border-radius: var(--advc-radius); background: #fff; font-weight: 400; }
.advc-check-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.advc-switch { flex: 0 0 auto; width: 42px; height: 24px; border-radius: 12px; background: #d9d3cc; position: relative; transition: background .15s; }
.advc-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.advc-check-input:checked + .advc-switch { background: var(--advc-accent); }
.advc-check-input:checked + .advc-switch::after { transform: translateX(18px); }
.advc-check-input:focus-visible + .advc-switch { outline: 2px solid var(--advc-accent); outline-offset: 2px; }
.advc-check-text { display: flex; flex-direction: column; flex: 1; text-align: left; }
.advc-check-text .advc-label-text { font-weight: 600; }
.advc-check-sub { font-size: .85rem; color: var(--advc-muted); }

.advc-html { color: var(--advc-muted); font-size: .9rem; }
.advc-html > :last-child { margin-bottom: 0; }

/* riepilogo prezzi */
.advc-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; margin-top: 1.25rem; padding: .85rem 1rem; border-radius: var(--advc-radius); background: var(--advc-soft); font-size: .92rem; }
.advc-global-error { margin-top: .75rem; color: var(--advc-bad); font-weight: 600; font-size: .9rem; }
.advc.is-busy { opacity: .7; pointer-events: none; }
.advc-btn-busy { cursor: progress !important; opacity: .75; }

/* anteprima */
.advc-preview { margin-bottom: 1.5rem; }
.advc-stage {
  position: relative; overflow: hidden; container-type: inline-size;
  border-radius: var(--advc-radius); background: var(--advc-soft); user-select: none;
}
.advc-stage--empty { aspect-ratio: 4 / 3; }
.advc-stage-bg { display: block; width: 100%; height: auto; pointer-events: none; }
.advc-preview-title { text-align: center; font-size: .82rem; color: var(--advc-muted); margin-top: .5rem; }
.advc-layer { position: absolute; white-space: pre-wrap; overflow-wrap: anywhere; pointer-events: none; transition: color .2s; }
.advc-layer--image img { display: block; width: 100%; height: auto; }
.advc-layer-mask { width: 100%; aspect-ratio: 1 / 1; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; }
.advc-layer--sample { opacity: .45; }
.advc-fx-engrave { mix-blend-mode: multiply; opacity: .9; text-shadow: 0 1px 0 rgba(255,255,255,.35), 0 -1px 0 rgba(0,0,0,.18); }
.advc-fx-engrave.advc-layer--sample { opacity: .4; }
.advc-fx-emboss { text-shadow: -1px -1px 0 rgba(255,255,255,.5), 1px 1px 1px rgba(0,0,0,.35); }
.advc-fx-shadow { text-shadow: 0 2px 6px rgba(0,0,0,.35); }
.advc-layer--image.advc-fx-engrave { text-shadow: none; }

/* editor (back office) */
.advc--admin .advc-layer { pointer-events: auto; cursor: move; outline: 1px dashed transparent; outline-offset: 4px; }
.advc--admin .advc-layer:hover { outline-color: rgba(0,0,0,.35); }
.advc--admin .advc-layer.is-selected { outline: 1.5px dashed #25b9d7; }
.advc-layer-placeholder { border: 1px dashed rgba(0,0,0,.35); border-radius: 6px; padding: .4rem; font-size: 12px; color: rgba(0,0,0,.55); text-align: center; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; }

/* prodotto personalizzabile senza blocco (anteprima rapida) */
.advc-qv-note { width: 100%; margin: 0 0 .75rem; padding: .6rem .8rem; border-radius: 10px; background: #f4efe9; color: #4a4540; font-size: .9rem; }
