:root {
    --bg-0: #faf8ff;
    --bg-1: #f3f0ff;
    --primary-500:#a78bfa;
    --primary-600:#8b6cf0;
    --ink-900:#141225;
    --ink-700:#2e2a4a;
    --ink-500:#5d568a;
    --white:#fff;
    --shadow: 0 8px 24px rgba(76, 51, 255, .15);
    --radius-xl: 22px;
    --radius-lg: 16px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
    color: var(--ink-700);
    background:
            radial-gradient(1200px 600px at 95% -10%, rgba(167,139,250,.18), transparent 60%),
            radial-gradient(1000px 600px at -10% 10%, rgba(183,166,255,.22), transparent 60%),
            linear-gradient(180deg, var(--bg-0), var(--bg-1));
}

.container { width: min(1120px, 92%); margin: 0 auto; }

/* Header */
header { position: sticky; top: 0; backdrop-filter: blur(12px); background: rgba(250,248,255,.75); border-bottom: 1px solid #eee8ff; z-index: 20; }
.nav { display:flex; align-items:center; justify-content:space-between; padding: 14px 0; }
.brand { display:flex; align-items:center; gap:10px; font-weight:700; color: var(--ink-900); text-decoration: none; }
.brand-logo { display:block; border-radius: 10px; width: 40px; height: 40px; }
.brand-name { font-weight:800; color: var(--ink-900); font-size: 18px; }

/* Buttons */
.btn { display:inline-flex; align-items:center; padding:10px 18px; border-radius: 999px; font-weight:600; cursor:pointer; transition: all .2s ease; text-decoration:none; }
.btn.primary { background: linear-gradient(90deg, var(--primary-500), var(--primary-600)); color: var(--white); box-shadow: var(--shadow); border:0; }
.btn.primary:hover { transform: translateY(-2px); }
.btn.ghost { background: transparent; border:1px solid #ded6ff; color: var(--ink-700); }

/* Hero */
.hero { display:grid; grid-template-columns: 1fr 1fr; gap: 42px; align-items:center; padding: 56px 0 24px; }
.hero h1 { font-size: clamp(32px, 4.4vw, 56px); line-height: 1.1; color: var(--ink-900); margin: 0 0 14px; }
.accent { background: linear-gradient(90deg, var(--primary-600), #b48cff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: clamp(16px, 2.2vw, 20px); color: var(--ink-500); margin: 0 0 24px; }

.card { background: var(--white); border:1px solid #eee8ff; border-radius: var(--radius-xl); box-shadow: var(--shadow); }
.chat { padding: 18px; }

/* Chat */
.chat-window {
    border-radius: var(--radius-lg);
    border:1px solid #efe9ff;
    background: #fff;
    height: 300px;           /* altezza fissa */
    overflow-y: auto;
    display:flex;
    flex-direction:column;
    padding: 8px 0;
}
.bubble { max-width: 85%; padding: 10px 14px; border-radius: 16px; margin: 8px 12px; font-size: 14px; line-height: 1.35; }
.ai { background: #f5f1ff; border:1px solid #eee8ff; }
.me { margin-left: auto; background: #eef2ff; border:1px solid #dde3ff; }

/* Loader a tre puntini */
.typing { display:inline-flex; align-items:center; gap:4px; vertical-align:middle; }
.typing span { width:6px; height:6px; background:#bfb4ff; border-radius:50%; display:inline-block; animation: typing-bounce 1s infinite ease-in-out; opacity:.6; }
.typing span:nth-child(2){ animation-delay:.2s; } .typing span:nth-child(3){ animation-delay:.4s; }
@keyframes typing-bounce { 0%,80%,100%{ transform:translateY(0); opacity:.4;} 40%{ transform:translateY(-4px); opacity:1; } }

/* Steps & Features */
.steps { padding: 42px 0; display:grid; grid-template-columns: repeat(3, 1fr); gap:18px; }
.step { padding: 22px; text-align:center; }
.step .n { width: 36px; height:36px; display:grid; place-items:center; background: #f1edff; color: var(--ink-700); border-radius: 50%; font-weight:700; margin:0 auto 12px; }
.step h3 { margin: 0 0 8px; font-size: 18px; color: var(--ink-900); }
.step p { margin: 0; color: var(--ink-500); font-size: 15px; }

.features { padding: 8px 0 56px; display:grid; grid-template-columns: repeat(3, 1fr); gap:16px; }
.feature { padding: 20px; text-align:center; }
.feature h4 { margin:8px 0 6px; font-size: 17px; color: var(--ink-900); }
.feature p { margin:0; font-size: 14px; color: var(--ink-500); }
.icon { font-size: 28px; margin-bottom:8px; }

/* CTA + Newsletter */
.cta { background: linear-gradient(180deg, #fbfaff, #ffffff); border:1px solid #eee8ff; box-shadow: var(--shadow); border-radius: var(--radius-xl); padding: 28px; text-align:center; }
.cta h3 { margin:0 0 10px; color: var(--ink-900); }
.newsletter { display:flex; gap:10px; justify-content:center; flex-wrap:wrap; margin-top:10px; }
.input-pill { padding: 10px 14px; border-radius: 999px; border: 1px solid #ded6ff; min-width: 260px; font: inherit; font-size: 16px; outline: none; }
.feedback { margin-top: 8px; }

/* FAQ */
.faq.section { padding: 36px 0 12px; }
.faq-inner { width: min(880px, 92%); margin: 0 auto; }
.faq-inner details { background: #fff; border:1px solid #eee8ff; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.faq-inner summary { cursor: pointer; font-weight: 600; color: var(--ink-900); }
.faq-inner p { margin: 8px 0 0; color: var(--ink-500); }

/* Footer */
footer { padding: 32px 0 60px; color: var(--ink-500); font-size: 14px; text-align:center; }

/* Responsive */
@media (max-width: 960px) {
    .hero { grid-template-columns: 1fr; }
    .steps, .features { grid-template-columns: 1fr; }
    .brand-logo { width: 36px; height: 36px; }
}

/* Azioni sotto ogni bubble */
.fd-msg-actions{
    display:flex; gap:6px; margin-top:4px; opacity:.85;
    font-size:12px; color:var(--fd-muted);
}
.fd-msg-assistant .fd-msg-actions{ justify-content:flex-start; }
.fd-msg-user .fd-msg-actions{ justify-content:flex-end; }

.fd-msg-action{
    display:inline-flex; align-items:center; gap:6px;
    padding:6px 8px; border:1px solid var(--fd-border);
    background:var(--fd-panel); color:inherit;
    border-radius:10px; cursor:pointer; text-decoration:none;
}
.fd-msg-action:hover{ filter:brightness(1.05); }
.fd-msg-action.is-active{
    color:#fff; background:var(--fd-primary); border-color:transparent;
}

/* Iconcine testuali compatte */
.fd-msg-action .ico{ font-size:12px; line-height:1; }


/* === Mobile tweaks === */
@media (max-width: 980px){
    /* Gap più corto tra ultima bubble e composer */
    .fd-messages{
        /* prima probabilmente era alto; lo riduciamo */
        padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px) + var(--composer-h));
    }
}

/* Il modale deve stare sopra a tutto (sidebar incluse) */
.fd-modal{ z-index: 9999; }
.fd-modal__backdrop{ z-index: -1; } /* resta sotto al dialog dentro lo stesso stacking context */
