/* ============================================================
   Soluzione FAD — Roadmap pubblica · main stylesheet
   Estratto dal prototipo di design (mantiene fedelmente animazioni
   e dettagli UX/UI). Le proprietà che dipendono dall'accent color
   sono iniettate in un secondo blocco <style> da app.jsx.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Nunito Sans', system-ui, -apple-system, sans-serif;
  color: #0E1B36;
  background: #F8F9FC;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { font-family: inherit; }
::selection { background: rgba(90, 90, 255, 0.18); }

/* ── Loading screen (mostrato finché React non ha montato l'app) ──────────── */
.sfad-boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #F8F9FC;
  color: #5A647F;
  font-family: 'Nunito Sans', system-ui, sans-serif;
  font-size: 14px;
}
.sfad-boot-spinner {
  width: 28px; height: 28px;
  border: 3px solid #E7EAF1;
  border-top-color: #5A5AFF;
  border-radius: 50%;
  animation: sfadSpin 800ms linear infinite;
  margin-bottom: 16px;
}
@keyframes sfadSpin { to { transform: rotate(360deg); } }

/* ── Pulse dot (status "in lavorazione") ─────────────────────────────────── */
.sfad-pulse { animation: sfadPulse 1.6s ease-out infinite; }
@keyframes sfadPulse {
  0%   { box-shadow: 0 0 0 0 currentColor; opacity: 0.6; }
  70%  { box-shadow: 0 0 0 8px transparent; opacity: 0; }
  100% { box-shadow: 0 0 0 0 transparent; opacity: 0; }
}

/* ── Card hover ──────────────────────────────────────────────────────────── */
.sfad-card {
  background: white;
  border-radius: 16px;
  border: 1px solid #E7EAF1;
  padding: 20px;
  cursor: pointer;
  position: relative;
  box-shadow: 0 1px 0 rgba(17, 17, 17, 0.02);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 200ms ease;
}
.sfad-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px -22px rgba(14, 27, 54, 0.25);
}

/* ── Like button bump animation ──────────────────────────────────────────── */
.sfad-like.is-bump { animation: sfadBump 360ms cubic-bezier(.2, 1.2, .4, 1); }
@keyframes sfadBump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* ── Like button hover micro-animation + tooltip ─────────────────────────── */
.sfad-like { will-change: transform; }
.sfad-like:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -10px color-mix(in oklab, var(--accent, #5A5AFF) 50%, transparent);
}
.sfad-like:hover .sfad-like-heart {
  animation: sfadHeartBeat 700ms ease-in-out infinite;
  color: var(--accent, #5A5AFF);
}
.sfad-like:active { transform: translateY(0) scale(0.96); }
@keyframes sfadHeartBeat {
  0%, 100% { transform: scale(1); }
  15%      { transform: scale(1.25) rotate(-6deg); }
  30%      { transform: scale(0.95); }
  45%      { transform: scale(1.18) rotate(6deg); }
  60%      { transform: scale(1); }
}

/* ── Tooltip sopra il like button ────────────────────────────────────────── */
.sfad-tooltip {
  position: absolute; bottom: calc(100% + 10px); left: 50%;
  transform: translate(-50%, 4px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 180ms ease, transform 220ms cubic-bezier(.2, 1.1, .3, 1), visibility 0s linear 180ms;
  z-index: 50;
  white-space: nowrap;
}
.sfad-tooltip-inner {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px 8px 8px; border-radius: 999px;
  background: #0E1B36; color: white;
  font-family: 'Nunito Sans', system-ui; font-size: 12px; font-weight: 700;
  letter-spacing: -0.005em;
  box-shadow: 0 12px 28px -12px rgba(14, 27, 54, 0.5), 0 2px 6px rgba(14, 27, 54, 0.12);
  position: relative;
}
.sfad-tooltip-inner::after {
  content: ""; position: absolute; left: 50%; top: 100%;
  transform: translate(-50%, -2px) rotate(45deg);
  width: 8px; height: 8px; background: #0E1B36;
  border-radius: 2px;
}
.sfad-like-wrap:hover .sfad-tooltip,
.sfad-like-wrap:focus-within .sfad-tooltip {
  opacity: 1; visibility: visible; transform: translate(-50%, 0);
  transition: opacity 180ms ease 120ms, transform 220ms cubic-bezier(.2, 1.1, .3, 1) 120ms, visibility 0s;
}

/* ── Like burst particles (cuoricini che esplodono al voto) ──────────────── */
.sfad-burst {
  display: inline-block;
  transform-origin: 0 0;
  opacity: 0;
  animation: sfadBurst 720ms cubic-bezier(.2, .7, .2, 1) forwards;
}
.sfad-burst-0 { --tx: -22px; --ty: -28px; }
.sfad-burst-1 { --tx:  -4px; --ty: -36px; }
.sfad-burst-2 { --tx:  18px; --ty: -28px; }
.sfad-burst-3 { --tx:  26px; --ty:  -6px; }
.sfad-burst-4 { --tx: -28px; --ty:  -8px; }
.sfad-burst-5 { --tx:   6px; --ty: -42px; }
@keyframes sfadBurst {
  0%   { transform: translate(0, 0) scale(0.4) rotate(0deg);   opacity: 0; }
  25%  { opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0.9) rotate(20deg); opacity: 0; }
}

/* ── Toast di conferma voto ──────────────────────────────────────────────── */
.sfad-toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 200;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px 14px 16px;
  background: white;
  border-radius: 999px;
  box-shadow: 0 24px 60px -16px rgba(14, 27, 54, 0.28), 0 2px 6px rgba(14, 27, 54, 0.06);
  border: 1px solid rgba(14, 27, 54, 0.06);
  animation: sfadToastIn 320ms cubic-bezier(.2, 1.1, .3, 1), sfadToastOut 320ms ease 2.2s forwards;
  will-change: transform, opacity;
  max-width: calc(100vw - 32px);
  overflow: hidden;
}
@keyframes sfadToastIn  { from { transform: translate(-50%, 24px) scale(0.92); opacity: 0; } to { transform: translate(-50%, 0) scale(1); opacity: 1; } }
@keyframes sfadToastOut { to   { transform: translate(-50%, 24px) scale(0.92); opacity: 0; } }
.sfad-toast-icon {
  position: relative; flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent, #5A5AFF) 0%, #079FED 100%);
  color: white;
  display: inline-flex; align-items: center; justify-content: center;
  animation: sfadToastPulse 900ms ease-out;
  box-shadow: 0 6px 20px -6px color-mix(in oklab, var(--accent, #5A5AFF) 60%, transparent);
}
@keyframes sfadToastPulse {
  0%   { transform: scale(0.5); }
  55%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.sfad-toast-glow {
  position: absolute; inset: -2px; border-radius: 999px;
  background: linear-gradient(120deg, transparent 30%, color-mix(in oklab, var(--accent, #5A5AFF) 35%, white) 50%, transparent 70%);
  opacity: 0; animation: sfadToastShine 1100ms ease 120ms;
  pointer-events: none;
}
@keyframes sfadToastShine {
  0%   { opacity: 0; transform: translateX(-30%); }
  50%  { opacity: 0.8; }
  100% { opacity: 0; transform: translateX(30%); }
}
.sfad-toast-spark {
  position: absolute; width: 6px; height: 6px; border-radius: 999px;
  background: var(--accent, #5A5AFF); top: 50%; left: 50%;
  margin: -3px 0 0 -3px;
  opacity: 0;
  animation: sfadSpark 900ms ease-out forwards;
}
.sfad-toast-spark-1 { --sx:  26px; --sy: -22px; background: #FF8158; }
.sfad-toast-spark-2 { --sx: -28px; --sy: -14px; }
.sfad-toast-spark-3 { --sx:  18px; --sy:  26px; background: #079FED; }
.sfad-toast-spark-4 { --sx: -22px; --sy:  20px; }
.sfad-toast-spark-5 { --sx:   2px; --sy: -30px; background: #079FED; }
.sfad-toast-spark-6 { --sx:  30px; --sy:   4px; background: #FF8158; }
@keyframes sfadSpark {
  0%   { transform: translate(0, 0) scale(0.4); opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: translate(var(--sx), var(--sy)) scale(0); opacity: 0; }
}

/* ── Hero: blob morphing + particle floating + mesh ──────────────────────── */
.sfad-blob { border-radius: 50%; will-change: transform, border-radius; }
.sfad-blob-a { animation: sfadBlobA 14s ease-in-out infinite; }
.sfad-blob-b { animation: sfadBlobB 17s ease-in-out infinite; }
.sfad-blob-c { animation: sfadBlobC 20s ease-in-out infinite; }
@keyframes sfadBlobA {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); border-radius: 64% 36% 55% 45% / 48% 58% 42% 52%; }
  25%      { transform: translate(-26px, 18px) rotate(20deg) scale(1.06); border-radius: 38% 62% 70% 30% / 56% 40% 60% 44%; }
  50%      { transform: translate(30px, -14px) rotate(-15deg) scale(0.96); border-radius: 60% 40% 30% 70% / 70% 30% 70% 30%; }
  75%      { transform: translate(-10px, 24px) rotate(28deg) scale(1.04); border-radius: 50% 50% 40% 60% / 42% 58% 42% 58%; }
}
@keyframes sfadBlobB {
  0%, 100% { transform: translate(0, 0) scale(1); border-radius: 70% 30% 50% 50%; }
  33%      { transform: translate(34px, -22px) scale(1.1); border-radius: 30% 70% 60% 40%; }
  66%      { transform: translate(-20px, 28px) scale(0.92); border-radius: 50% 50% 30% 70%; }
}
@keyframes sfadBlobC {
  0%, 100% { transform: translate(0, 0) scale(1); border-radius: 50% 50% 70% 30%; }
  50%      { transform: translate(-40px, -30px) scale(1.15); border-radius: 70% 30% 40% 60%; }
}

.sfad-p { animation-name: sfadFloat; animation-iteration-count: infinite; animation-timing-function: ease-in-out; }
.sfad-p-1 { animation-duration: 7s;   }
.sfad-p-2 { animation-duration: 9s;   animation-delay: -2s; }
.sfad-p-3 { animation-duration: 11s;  animation-delay: -4s; }
.sfad-p-4 { animation-duration: 8s;   animation-delay: -1s; }
.sfad-p-5 { animation-duration: 12s;  animation-delay: -5s; }
.sfad-p-6 { animation-duration: 9.5s; animation-delay: -3s; }
.sfad-p-7 { animation-duration: 10s;  animation-delay: -6s; }
.sfad-p-8 { animation-duration: 7.5s; animation-delay: -2.5s; }
.sfad-p-9 { animation-duration: 11.5s; animation-delay: -7s; }
@keyframes sfadFloat {
  0%, 100% { transform: translate(0, 0); opacity: var(--op, 0.5); }
  50%      { transform: translate(0, -22px); opacity: 0.9; }
}

.sfad-mesh { animation: sfadMesh 22s ease-in-out infinite; }
@keyframes sfadMesh {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(-20px, 12px); }
}

/* ── Drawer dettaglio + modal + overlay ──────────────────────────────────── */
.sfad-overlay {
  position: fixed; inset: 0;
  background: rgba(14, 27, 54, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90;
  animation: sfadFade 200ms ease;
}
@keyframes sfadFade { from { opacity: 0 } to { opacity: 1 } }

.sfad-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(560px, 100vw);
  background: white;
  z-index: 100;
  display: flex; flex-direction: column;
  box-shadow: -40px 0 80px -40px rgba(14, 27, 54, 0.3);
  animation: sfadSlide 280ms cubic-bezier(.2, .8, .2, 1);
}
@keyframes sfadSlide { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.sfad-modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  background: white;
  border-radius: 24px;
  padding: 32px;
  z-index: 100;
  box-shadow: 0 40px 80px -20px rgba(14, 27, 54, 0.4);
  animation: sfadPop 240ms cubic-bezier(.2, 1, .3, 1);
}
@keyframes sfadPop { from { transform: translate(-50%, -48%) scale(0.96); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }

/* ── Form input ──────────────────────────────────────────────────────────── */
.sfad-input {
  display: block; width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid #E4E7EE;
  background: white;
  font-family: 'Nunito Sans', system-ui;
  font-size: 14px;
  color: #0E1B36;
  outline: none;
  transition: border-color 160ms ease;
  box-sizing: border-box;
}
.sfad-input:focus { border-color: var(--accent, #5A5AFF); }

/* ── Honeypot anti-spam (campo invisibile) ───────────────────────────────── */
.sfad-honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ── Responsive: timeline grid scala su mobile ───────────────────────────── */
@media (max-width: 960px) {
  .sfad-grid-timeline { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 640px) {
  .sfad-grid-timeline { grid-template-columns: 1fr !important; }
  .sfad-hero-pad { padding: 24px 20px 32px !important; }
  .sfad-toolbar-pad { padding: 14px 20px !important; }
  .sfad-section-pad { padding: 32px 20px 64px !important; }
  .sfad-bottom-cta-pad { padding: 48px 20px !important; flex-direction: column; align-items: flex-start !important; }
  .sfad-trustpilot-pad { padding: 36px 20px !important; }
}

/* ── Rispetta prefers-reduced-motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .sfad-blob-a, .sfad-blob-b, .sfad-blob-c,
  .sfad-mesh, .sfad-pulse, .sfad-p,
  .sfad-burst, .sfad-toast, .sfad-toast-icon,
  .sfad-toast-glow, .sfad-toast-spark,
  .sfad-like:hover .sfad-like-heart,
  .sfad-card:hover {
    animation: none !important;
    transition: none !important;
  }
}
