/* =========================
   ANIMATIONS
   Le prime tre arrivano tali e quali dal pannello ReplyA: stessa identità
   visiva, stesse tempistiche.
========================= */
@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes slideFromRight {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: none; }
}

@keyframes slideFromLeft {
  from { opacity: 0; transform: translateX(-28px); }
  to   { opacity: 1; transform: none; }
}

/* =========================
   UTILITY CLASSES
========================= */
.pulse-soft {
  animation: pulse-soft 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.float-animation {
  animation: float 3s ease-in-out infinite;
  will-change: transform;
}

.slide-in-right { animation: slideFromRight .3s cubic-bezier(.22,.61,.36,1) both; }
.slide-in-left  { animation: slideFromLeft  .3s cubic-bezier(.22,.61,.36,1) both; }

/* Durante lo scorrimento il pannello sborda di 28px oltre il bordo: senza
   questo, sul telefono la pagina diventa trascinabile in orizzontale a ogni
   cambio di passo. `clip` e non `hidden` perche' hidden creerebbe un
   contenitore di scorrimento e romperebbe la navbar sticky; il margine tiene
   fuori dal taglio l'ombra delle card. */
#wizard {
  overflow-x: clip;
  overflow-clip-margin: 28px;
}

/* =========================
   GRADIENTS
========================= */
.gradient-ai-wa {
  background: linear-gradient(135deg, #7C3AED 0%, #25D366 100%);
}

.gradient-ai-wa-animate {
  background: linear-gradient(270deg, #7C3AED, #25D366, #3B82F6);
  background-size: 400% 400%;
  animation: gradient-shift 8s ease infinite;
}

.gradient-overlay {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(37, 211, 102, 0.1) 100%);
}

/* =========================
   GLASS MORPHISM
========================= */
.glass {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* =========================
   QR CODE STYLES
========================= */
.qr-expired {
  filter: blur(8px) grayscale(1);
  opacity: 0.3;
  transition: all 0.5s ease;
}

/* =========================
   BOTTONI
========================= */
.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  transition: opacity .2s ease, transform .15s ease, background .2s ease, border-color .2s ease;
  cursor: pointer;
}
.btn-primary {
  background: linear-gradient(135deg, #7C3AED 0%, #25D366 100%);
  color: #fff;
  box-shadow: 0 10px 24px -14px rgba(124, 58, 237, .9);
}
.btn-primary:hover:not(:disabled) { opacity: .9; }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.btn-lg { padding: 0.85rem 1.9rem; font-size: 1.0625rem; }

.btn-ghost {
  background: #fff;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.btn-ghost:hover:not(:disabled) { border-color: #cbd5e1; color: #1e293b; }
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary:active:not(:disabled),
.btn-ghost:active:not(:disabled) { transform: translateY(1px); }

/* =========================
   STEPPER
========================= */
.stepper-track {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.stepper-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 0 0 auto;
}

.stepper-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 2px solid #e2e8f0;
  background: #fff;
  color: #94a3b8;
  font-weight: 700;
  font-size: .875rem;
  transition: all .3s cubic-bezier(.22,.61,.36,1);
}
.stepper-check { display: none; font-size: .8rem; }

.stepper-label {
  font-size: .875rem;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
  transition: color .3s ease;
}

.stepper-item.is-active .stepper-dot {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, #7C3AED 0%, #25D366 100%);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, .12);
}
.stepper-item.is-active .stepper-label { color: #1e293b; }

.stepper-item.is-done:not(.is-active) .stepper-dot {
  border-color: rgba(37, 211, 102, .45);
  background: rgba(37, 211, 102, .12);
  color: #25D366;
}
.stepper-item.is-done:not(.is-active) .stepper-num { display: none; }
.stepper-item.is-done:not(.is-active) .stepper-check { display: block; }
.stepper-item.is-done:not(.is-active) .stepper-label { color: #64748b; }

.stepper-line {
  flex: 1 1 auto;
  min-width: 1rem;
  height: 2px;
  border-radius: 2px;
  background: #e2e8f0;
  position: relative;
  overflow: hidden;
  list-style: none;
}
.stepper-line::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 0;
  background: linear-gradient(90deg, #7C3AED, #25D366);
  transition: width .45s cubic-bezier(.22,.61,.36,1);
}
.stepper-line.is-filled::after { width: 100%; }

.stepper-mobile { display: none; }

/* =========================
   SCELTA AMBITO (step 2)
========================= */
.scope-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .5rem;
  padding: 1.25rem;
  border: 2px solid #eef2f7;
  border-radius: 1.25rem;
  background: #fff;
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease, transform .15s ease;
}
.scope-card:hover { border-color: #ddd6fe; transform: translateY(-2px); }
.scope-card.is-selected {
  border-color: #7C3AED;
  box-shadow: 0 12px 30px -18px rgba(124, 58, 237, .8);
  background: linear-gradient(135deg, rgba(124,58,237,.05), rgba(37,211,102,.05));
}
.scope-card__icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .875rem;
  color: #fff;
  font-size: .95rem;
  box-shadow: 0 8px 18px -10px rgba(30, 41, 59, .6);
}
.scope-card__name { font-weight: 700; color: #1e293b; }
.scope-card__count { font-size: .8125rem; color: #64748b; }
.scope-card__count strong { color: #7C3AED; }

/* Anello di focus da tastiera, dato che il radio è visivamente nascosto. */
.scope-card:focus-within { outline: 2px solid #7C3AED; outline-offset: 3px; }

/* =========================
   OPZIONI (step 3)
========================= */
.opt-card {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  padding: .9rem 1.1rem;
  border: 2px solid #eef2f7;
  border-radius: 1rem;
  background: #fff;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}
.opt-card:hover { border-color: #ddd6fe; }
.opt-card.is-selected {
  border-color: rgba(124, 58, 237, .55);
  background: linear-gradient(135deg, rgba(124,58,237,.05), rgba(37,211,102,.05));
}
.opt-card:focus-within { outline: 2px solid #7C3AED; outline-offset: 3px; }

.opt-check {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 1.15rem;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: .15rem;
  border: 2px solid #cbd5e1;
  border-radius: .35rem;
  background: #fff;
  cursor: pointer;
  position: relative;
  transition: all .16s ease;
}
.opt-check[type="radio"] { border-radius: 999px; }
.opt-check:checked {
  border-color: transparent;
  background: linear-gradient(135deg, #7C3AED 0%, #25D366 100%);
}
.opt-check[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: .3rem;
  top: .05rem;
  width: .25rem;
  height: .55rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(43deg);
}
.opt-check[type="radio"]:checked::after {
  content: '';
  position: absolute;
  inset: .22rem;
  border-radius: 999px;
  background: #fff;
}
.opt-check:disabled { opacity: .6; cursor: default; }

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 767px) {
  .stepper-label { display: none; }
  .stepper-track { justify-content: space-between; gap: .25rem; }
  .stepper-dot { width: 2rem; height: 2rem; font-size: .8125rem; }
  .stepper-mobile { display: block; margin-top: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
