/* =====================================================================
   Bancarella AI — design system "fintech trust"
   Marketplace P2P + pagamenti: colori fiducia (blu PayPal), verde
   successo, tipografia sans corporate. Nessun asset esterno.
   ===================================================================== */

:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --ink: #0F172A;
  --ink-2: #475569;
  --line: #E2E8F0;
  --line-strong: #CBD5E1;
  --brand: #0070BA;
  --brand-dark: #003087;
  --brand-hover: #005EA6;
  --success: #059669;
  --success-bg: #ECFDF5;
  --danger: #DC2626;
  --warn-bg: #FEF3C7;
  --warn-ink: #92400E;
  --r-card: 16px;
  --r-btn: 12px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.05);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Header / brand ---------- */

header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 28px 16px 24px;
  text-align: center;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  flex: none;
}

header h1 {
  margin: 0;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.tagline {
  margin: 14px 0 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-dark);
}

.sottotitolo {
  margin: 8px auto 0;
  max-width: 620px;
  font-size: 16px;
  color: var(--ink-2);
}

/* ---------- Layout e card ---------- */

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: 24px 22px 26px;
  margin: 0 0 20px;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.card h3 {
  font-size: 19px;
  font-weight: 600;
  margin: 10px 0 6px;
}

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

label {
  display: block;
  font-weight: 600;
  font-size: 15.5px;
  margin: 18px 0 7px;
  color: var(--ink);
}

input[type="file"],
input[type="number"],
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 17px;
  min-height: 54px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-btn);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

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

input[type="file"] { padding: 10px 12px; }

input[type="file"]::file-selector-button {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 9px 14px;
  margin-right: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #F8FAFC;
  color: var(--ink);
  cursor: pointer;
}

#anteprima {
  display: block;
  max-width: 100%;
  border-radius: 12px;
  margin-top: 12px;
  border: 1px solid var(--line);
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: var(--r-btn);
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

button.grande {
  width: 100%;
  min-height: 56px;
  font-size: 17px;
  font-weight: 700;
  margin-top: 22px;
  padding: 12px 18px;
}

button.primario { background: var(--brand); color: #fff; }
button.primario:hover { background: var(--brand-hover); }
button.primario:active { background: var(--brand-dark); }

button.vendi { background: var(--brand); color: #fff; }
button.vendi:hover { background: var(--brand-hover); }
button.vendi:active { background: var(--brand-dark); }

button.test {
  width: 100%;
  min-height: 52px;
  font-size: 15.5px;
  font-weight: 600;
  margin-top: 12px;
  padding: 10px 16px;
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line-strong);
}

button.test:hover { background: #F1F5F9; color: var(--ink); }

/* Focus sempre visibile: mai rimuovere gli anelli di focus. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(0, 112, 186, 0.45);
  outline-offset: 2px;
}

/* ---------- Badge e preventivo ---------- */

.badge {
  display: inline-block;
  background: #E8F1FB;
  color: var(--brand-dark);
  font-weight: 600;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14.5px;
}

table.preventivo {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 8px;
  font-size: 16.5px;
}

table.preventivo td {
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.preventivo td.cifra {
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

table.preventivo tr.totale td {
  border-bottom: none;
  border-top: 2px solid var(--brand-dark);
  font-size: 20px;
  font-weight: 600;
  padding-top: 14px;
}

.note { font-size: 15px; color: var(--ink-2); }

/* ---------- Banner messaggio ---------- */

.messaggio {
  background: var(--success-bg);
  border: 1px solid #A7F3D0;
  color: #064E3B;
  border-radius: var(--r-btn);
  padding: 13px 16px;
  font-weight: 600;
  margin: 0 0 16px;
}

/* ---------- Schede articolo in bacheca ---------- */

#bacheca-vuota,
#registro-vuoto {
  color: var(--ink-2);
  margin: 0;
}

.articolo {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 18px;
  margin-top: 16px;
  background: var(--surface);
}

.articolo img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 6px;
}

.articolo .titolo {
  font-size: 20px;
  font-weight: 600;
  margin: 10px 0 2px;
}

.articolo .desc {
  margin: 4px 0;
  color: var(--ink-2);
  font-size: 16px;
}

.articolo .prezzo-grande {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 10px 0 12px;
}

.stato {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 13px;
  font-weight: 600;
  font-size: 14.5px;
}

.stato::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.stato.disponibile { background: var(--success-bg); color: #065F46; }
.stato.disponibile::before { background: var(--success); }

.stato.venduto { background: #F1F5F9; color: var(--ink-2); }
.stato.venduto::before { background: #94A3B8; }

.link-pagamento {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  color: var(--ink-2);
  word-break: break-all;
  margin: 12px 0 0;
}

.qr-box {
  margin: 14px auto 0;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
}

.qr-box .qr-label {
  margin: 0 0 10px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.qr-box img {
  max-width: 180px;
  height: auto;
  image-rendering: pixelated;
}

.contenitore-paypal {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  padding: 14px;
  background: #F8FAFC;
}

.fallback-paypal {
  background: var(--warn-bg);
  border: 1px solid #FDE68A;
  color: var(--warn-ink);
  border-radius: var(--r-btn);
  padding: 14px 16px;
  font-weight: 600;
}

.fallback-paypal button.grande { margin-top: 14px; }

/* ---------- Registro vendite ---------- */

#lista-vendite { list-style: none; padding: 0; margin: 0; }

#lista-vendite li {
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}

#lista-vendite li:last-child { border-bottom: none; }

#lista-vendite .esito-ok { color: var(--success); font-weight: 600; }
#lista-vendite .esito-ko { color: var(--danger); font-weight: 600; }

/* ---------- Footer ---------- */

.nota-fondo {
  font-size: 14px;
  color: var(--ink-2);
  text-align: center;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin: 4px auto 0;
}

/* ---------- Movimento ridotto ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
