/* =========================================================
   Newsletter Immobiliare Trovacasa
   Stile allineato al sito immobiliaretrovacasa.it (tema Astra):
   indaco brand #393F8C, link blu #046bd2, testi slate, font di sistema.
   ========================================================= */
:root {
  --brand: #393F8C;        /* indaco header/bottoni del sito */
  --brand-dark: #2f3576;
  --brand-tint: #eef0f8;
  --link: #046bd2;         /* blu link Astra */
  --heading: #1e293b;      /* slate 800 */
  --text: #334155;         /* slate 700 */
  --muted: #64748b;        /* slate 500 */
  --page: #F0F5FA;         /* sfondo chiaro del sito */
  --card: #ffffff;
  --border: #D1D5DB;       /* grigio bordo Astra */
  --border-soft: #e5e9f0;
  --danger: #c0392b;
  --ok: #2e7d46;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font);
  background: var(--page); color: var(--text); line-height: 1.6;
}
a { color: var(--link); }

/* ---------- Header (barra indaco come il sito) ---------- */
.topbar { background: var(--brand); }
.topbar-inner {
  max-width: 920px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-badge {
  background: #fff; border-radius: 10px; padding: 5px;
  display: inline-flex; line-height: 0; box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.brand-badge img { height: 38px; width: 38px; object-fit: contain; display: block; border-radius: 6px; }
.brand-name { color: #fff; font-weight: 700; font-size: 1.08rem; letter-spacing: .01em; }
.topbar-tag {
  color: #fff; font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .12em; border: 1px solid rgba(255,255,255,.45); padding: 3px 10px; border-radius: 999px;
}

/* ---------- Layout pagina ---------- */
.page { max-width: 920px; margin: 0 auto; padding: 36px 24px 56px; }
.intro { text-align: center; max-width: 620px; margin: 0 auto 26px; }
.intro h1 {
  font-size: clamp(1.7rem, 3.6vw, 2.25rem); line-height: 1.18; margin: 0 0 10px;
  color: var(--heading); font-weight: 800; letter-spacing: -.01em;
}
.intro p { margin: 0; font-size: 1.05rem; color: var(--muted); }

/* card bianca (form, conferma, preferenze) */
.card, .sheet {
  background: var(--card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 32px;
  box-shadow: 0 10px 30px -18px rgba(30, 41, 59, .35);
}
.card { max-width: 680px; margin: 0 auto; }
.sheet { max-width: 560px; margin: 18px auto 56px; text-align: center; }
.sheet--form { max-width: 680px; text-align: left; }
.sheet h1, .card h1 { color: var(--heading); }
.sheet h1 { font-size: 1.7rem; margin: 0 0 8px; font-weight: 800; }
.card-title { margin: 0 0 22px; font-size: 1.35rem; font-weight: 700; color: var(--heading); }
.lead { color: var(--muted); margin: 0 0 22px; font-size: 1.02rem; }

/* ---------- Form ---------- */
.form { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field-label { font-weight: 700; font-size: .9rem; color: var(--heading); }
.field-label .req { color: var(--link); }
.hint { font-weight: 400; color: var(--muted); font-size: .78rem; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

input[type=email], input[type=number], select {
  width: 100%; padding: 11px 13px; font-size: 15px; font-family: var(--font);
  border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder { color: #9aa6b6; }
input:focus, select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(57, 63, 140, .16);
}

/* campi con valuta / unità */
.money, .unit { position: relative; }
.money input { padding-left: 28px; }
.unit input { padding-right: 40px; }
.money-sign, .unit-suffix {
  position: absolute; top: 50%; transform: translateY(-50%); color: var(--muted);
  font-size: .92rem; pointer-events: none;
}
.money-sign { left: 13px; }
.unit-suffix { right: 13px; }

/* Preferenze avanzate (sezione a comparsa) */
.advanced { border: 1px solid var(--border-soft); border-radius: 8px; padding: 0 14px; }
.advanced > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px;
  padding: 13px 0; font-weight: 700; font-size: .9rem; color: var(--brand); user-select: none;
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::marker { content: ""; }
.advanced > summary .hint { font-weight: 400; }
.advanced > summary .chev { display: inline-block; font-size: 1.1rem; line-height: 1; transition: transform .15s ease; }
.advanced[open] > summary .chev { transform: rotate(90deg); }
.advanced[open] > summary { border-bottom: 1px solid var(--border-soft); }
.advanced > summary:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 6px; }
.advanced-body { display: flex; flex-direction: column; gap: 20px; padding: 18px 0; }

/* chip a pillola bianche (come la ricerca del sito) */
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 15px; font-size: .92rem; cursor: pointer; user-select: none;
  background: #fff; color: var(--text); transition: all .12s ease;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip:has(input:checked) { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.chip:has(input:focus-visible) { outline: 2px solid var(--link); outline-offset: 2px; }
.chip .count {
  font-size: .72rem; line-height: 1; padding: 3px 7px; border-radius: 6px;
  background: #eef1f5; color: var(--muted); font-variant-numeric: tabular-nums;
}
.chip:has(input:checked) .count { background: rgba(255,255,255,.24); color: #fff; }

/* consenso */
.checkbox { display: flex; align-items: flex-start; gap: 11px; font-size: .9rem; line-height: 1.45; color: var(--text); }
.checkbox input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--brand); flex: none; }
.checkbox .req { color: var(--link); }

/* pulsanti (indaco come "RICERCA") */
.btn {
  background: var(--brand); color: #fff; border: 0; border-radius: 8px;
  padding: 14px 24px; font-size: 1rem; font-weight: 700; font-family: var(--font);
  cursor: pointer; text-decoration: none; display: inline-block; text-align: center;
  transition: background .15s ease, transform .08s ease;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
.form .btn { width: 100%; margin-top: 4px; }
.btn-ghost {
  background: #fff; color: var(--brand); border: 1px solid var(--border);
  margin-top: 20px; padding: 11px 22px; font-weight: 700;
}
.btn-ghost:hover { background: var(--brand-tint); border-color: var(--brand); }

/* avvisi */
.alert { border-radius: 8px; padding: 13px 16px; margin-bottom: 20px; font-size: .9rem; }
.alert-error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c0; }
.alert-error ul { margin: 0; padding-left: 18px; }
.alert-success { background: #e9f6ed; color: var(--ok); border: 1px solid #bfe3c9; font-weight: 600; }
.alert-welcome { background: var(--brand-tint); color: var(--brand); border: 1px solid #c5c9e8; font-weight: 600; }

.unsub-row {
  margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border-soft);
  font-size: .85rem; color: var(--muted);
}
.unsub-row a { color: var(--muted); }

/* esito conferma / errore */
.status-icon {
  width: 58px; height: 58px; border-radius: 50%; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center; font-size: 28px; color: #fff;
}
.status-icon.ok { background: var(--brand); }
.status-icon.err { background: var(--danger); }

/* footer */
.sitefoot {
  padding: 26px 24px 44px; text-align: center; font-size: .82rem; color: var(--muted);
  border-top: 1px solid var(--border-soft); background: #fff;
}
.sitefoot a { color: var(--link); }
.foot-legal { color: var(--muted); }
.foot-credit { margin-top: 8px; font-size: .78rem; color: #94a3b8; }
.foot-dev { color: var(--brand); font-weight: 600; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (max-width: 520px) {
  .field-row { flex-direction: column; }
  .card, .sheet { padding: 24px 20px; }
  .brand-name { font-size: .98rem; }
}
