/* =====================================================================
   Fogli di stile delle landing page pubbliche.
   Separato da styles.css (dashboard): una landing deve caricare il minimo
   indispensabile, perché è la pagina che il visitatore vede per prima.

   Tutti i colori passano da variabili CSS impostate a runtime da
   landing.js in base al tema del template e alle personalizzazioni.
   ===================================================================== */

:root {
  --lp-primary: #6366f1;
  --lp-accent: #38bdf8;
  --lp-bg: #0f172a;
  --lp-surface: #1e293b;
  --lp-text: #f8fafc;
  --lp-muted: #94a3b8;
  --lp-radius: 16px;
  --lp-max: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--lp-bg);
  color: var(--lp-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

/* ---------------------------------------------------------------- *
   Stato di caricamento ed errore
   ---------------------------------------------------------------- */

.lp-loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.lp-spinner {
  width: 38px; height: 38px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--lp-primary);
  border-radius: 50%;
  animation: lp-spin 0.8s linear infinite;
}

@keyframes lp-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .lp-spinner { animation-duration: 2s; }
  * { transition: none !important; }
}

.lp-error {
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem;
}

.lp-error h1 { font-size: 1.6rem; margin: 0 0 0.5rem; }
.lp-error p { color: var(--lp-muted); margin: 0 0 1.5rem; max-width: 42ch; }

/* ---------------------------------------------------------------- *
   Struttura
   ---------------------------------------------------------------- */

.lp-wrap {
  max-width: var(--lp-max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.lp-header {
  padding: 1.25rem 0;
  border-bottom: 1px solid rgba(127, 127, 127, 0.18);
}

.lp-header-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lp-logo-img { height: 36px; width: auto; }

.lp-brand {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.lp-section { padding: 3.5rem 0; }
.lp-section + .lp-section { padding-top: 0; }

.lp-section-title {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 800;
  margin: 0 0 1.75rem;
  letter-spacing: -0.02em;
}

/* ---------------------------------------------------------------- *
   Hero
   ---------------------------------------------------------------- */

.lp-hero { padding: clamp(3rem, 8vw, 5.5rem) 0 3rem; }

.lp-hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 860px) {
  .lp-hero-grid { grid-template-columns: 1fr; gap: 2.25rem; }
}

.lp-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.35rem 0.8rem;
  border-radius: 99px;
  background: color-mix(in srgb, var(--lp-primary) 18%, transparent);
  color: var(--lp-primary);
  margin-bottom: 1rem;
}

.lp-headline {
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
}

.lp-subheadline {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--lp-muted);
  margin: 0 0 2rem;
  max-width: 52ch;
}

/* ---------------------------------------------------------------- *
   Pulsanti
   ---------------------------------------------------------------- */

.lp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font: inherit;
  font-weight: 700;
  padding: 0.9rem 1.6rem;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.lp-btn:hover { transform: translateY(-1px); }
.lp-btn:active { transform: translateY(0); }

.lp-btn:focus-visible {
  outline: 3px solid var(--lp-accent);
  outline-offset: 2px;
}

.lp-btn-primary {
  background: var(--lp-primary);
  color: #fff;
  box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--lp-primary) 70%, transparent);
}

.lp-btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.lp-btn-block { width: 100%; }

/* ---------------------------------------------------------------- *
   Form lead
   ---------------------------------------------------------------- */

.lp-form-card {
  background: var(--lp-surface);
  border: 1px solid rgba(127, 127, 127, 0.2);
  border-radius: var(--lp-radius);
  padding: 1.75rem;
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.6);
}

.lp-form-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 1.25rem;
}

.lp-field { margin-bottom: 1rem; }

.lp-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--lp-muted);
  margin-bottom: 0.35rem;
}

.lp-field input,
.lp-field select,
.lp-field textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(127, 127, 127, 0.3);
  background: color-mix(in srgb, var(--lp-bg) 55%, transparent);
  color: var(--lp-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lp-field textarea { min-height: 96px; resize: vertical; }

.lp-field input:focus,
.lp-field select:focus,
.lp-field textarea:focus {
  outline: none;
  border-color: var(--lp-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lp-primary) 25%, transparent);
}

.lp-field-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.lp-field-checkbox input { width: auto; margin-top: 0.25rem; flex-shrink: 0; }

.lp-field-checkbox label {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--lp-muted);
}

/* Honeypot: invisibile agli umani, compilato dai bot. Nascosto senza
   display:none, che alcuni bot interpretano come "campo da ignorare". */
.lp-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.lp-form-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.lp-form-success {
  text-align: center;
  padding: 2rem 1rem;
}

.lp-form-success .lp-check {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.75rem;
}

.lp-form-success h3 { margin: 0 0 0.5rem; font-size: 1.25rem; }
.lp-form-success p { color: var(--lp-muted); margin: 0; }

/* ---------------------------------------------------------------- *
   Griglie di contenuto
   ---------------------------------------------------------------- */

.lp-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.lp-card {
  background: var(--lp-surface);
  border: 1px solid rgba(127, 127, 127, 0.18);
  border-radius: var(--lp-radius);
  padding: 1.5rem;
}

.lp-card-icon { font-size: 1.6rem; display: block; margin-bottom: 0.6rem; }
.lp-card h3 { margin: 0 0 0.4rem; font-size: 1.02rem; font-weight: 700; }
.lp-card p { margin: 0; color: var(--lp-muted); font-size: 0.9rem; }

.lp-stats {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  text-align: center;
}

.lp-stat-value {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 800;
  color: var(--lp-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.lp-stat-label { color: var(--lp-muted); font-size: 0.85rem; }

.lp-gallery {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.lp-gallery img {
  border-radius: var(--lp-radius);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
}

.lp-quote {
  background: var(--lp-surface);
  border-left: 3px solid var(--lp-primary);
  border-radius: 0 var(--lp-radius) var(--lp-radius) 0;
  padding: 1.4rem 1.5rem;
}

.lp-quote p { margin: 0 0 0.8rem; font-style: italic; }
.lp-quote footer { font-size: 0.82rem; color: var(--lp-muted); font-style: normal; }
.lp-quote-author { font-weight: 700; color: var(--lp-text); font-style: normal; }

/* ---------------------------------------------------------------- *
   FAQ
   ---------------------------------------------------------------- */

.lp-faq-item {
  border-bottom: 1px solid rgba(127, 127, 127, 0.18);
}

.lp-faq-item summary {
  cursor: pointer;
  padding: 1.1rem 0;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.lp-faq-item summary::-webkit-details-marker { display: none; }

.lp-faq-item summary::after {
  content: '+';
  font-size: 1.3rem;
  color: var(--lp-primary);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.lp-faq-item[open] summary::after { transform: rotate(45deg); }

.lp-faq-item p {
  margin: 0 0 1.1rem;
  color: var(--lp-muted);
  font-size: 0.93rem;
}

/* ---------------------------------------------------------------- *
   CTA finale e footer
   ---------------------------------------------------------------- */

.lp-final-cta {
  text-align: center;
  background: color-mix(in srgb, var(--lp-primary) 12%, var(--lp-surface));
  border: 1px solid color-mix(in srgb, var(--lp-primary) 30%, transparent);
  border-radius: 22px;
  padding: 3rem 1.5rem;
  margin: 1rem 0 3.5rem;
}

.lp-final-cta h2 { margin: 0 0 0.6rem; font-size: clamp(1.4rem, 3vw, 2rem); }
.lp-final-cta p { color: var(--lp-muted); margin: 0 0 1.75rem; }

.lp-footer {
  border-top: 1px solid rgba(127, 127, 127, 0.18);
  padding: 2rem 0 3rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--lp-muted);
}

.lp-footer a { color: var(--lp-primary); text-decoration: none; }
.lp-footer a:hover { text-decoration: underline; }

.lp-powered {
  margin-top: 0.75rem;
  opacity: 0.75;
  font-size: 0.78rem;
}

/* ---------------------------------------------------------------- *
   Widget chat live
   ---------------------------------------------------------------- */

.lp-chat-toggle {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--lp-primary);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.55);
  z-index: 40;
}

.lp-chat-toggle:focus-visible { outline: 3px solid var(--lp-accent); outline-offset: 3px; }

.lp-chat-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 5.75rem;
  width: min(360px, calc(100vw - 2.5rem));
  height: min(480px, calc(100vh - 8rem));
  background: var(--lp-surface);
  border: 1px solid rgba(127, 127, 127, 0.25);
  border-radius: 18px;
  box-shadow: 0 30px 70px -25px rgba(0, 0, 0, 0.7);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 41;
}

.lp-chat-panel.open { display: flex; }

.lp-chat-head {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid rgba(127, 127, 127, 0.2);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lp-chat-close {
  background: none;
  border: none;
  color: var(--lp-muted);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem 0.4rem;
}

.lp-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.lp-msg {
  max-width: 82%;
  padding: 0.6rem 0.85rem;
  border-radius: 14px;
  font-size: 0.88rem;
  word-wrap: break-word;
}

.lp-msg-visitor {
  align-self: flex-end;
  background: var(--lp-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.lp-msg-business {
  align-self: flex-start;
  background: color-mix(in srgb, var(--lp-bg) 60%, transparent);
  border: 1px solid rgba(127, 127, 127, 0.22);
  border-bottom-left-radius: 4px;
}

.lp-msg-system {
  align-self: center;
  font-size: 0.78rem;
  color: var(--lp-muted);
  text-align: center;
  max-width: 100%;
}

.lp-msg-sender {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.8;
  margin-bottom: 0.15rem;
}

.lp-chat-foot {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid rgba(127, 127, 127, 0.2);
}

.lp-chat-foot input {
  flex: 1;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(127, 127, 127, 0.3);
  background: color-mix(in srgb, var(--lp-bg) 55%, transparent);
  color: var(--lp-text);
}

.lp-chat-foot input:focus { outline: none; border-color: var(--lp-primary); }

.lp-chat-send {
  border: none;
  background: var(--lp-primary);
  color: #fff;
  border-radius: 10px;
  padding: 0 0.95rem;
  font-size: 1rem;
  cursor: pointer;
}

/* Rispetta chi ha ridotto le trasparenze o preferisce contrasto alto. */
@media (prefers-contrast: more) {
  .lp-card, .lp-form-card { border-color: currentColor; }
}
