/* =========================================================
   Studio Legale - Prototipo
   Design system + stili
   ========================================================= */

:root {
  /* Palette: blu notte + oro (sobrietà e affidabilità) */
  --c-bg: #f6f5f2;
  --c-surface: #ffffff;
  --c-ink: #1c2433;
  --c-ink-soft: #4b5566;
  --c-muted: #8a93a3;
  --c-line: #e4e2dc;
  --c-navy: #16263f;
  --c-navy-soft: #243a5e;
  --c-gold: #b08d57;
  --c-gold-soft: #cdb185;
  --c-success: #2e7d52;
  --c-warning: #b7791f;
  --c-danger: #b3261e;
  --c-info: #2f6f9f;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(22, 38, 63, 0.08);
  --shadow-sm: 0 3px 10px rgba(22, 38, 63, 0.07);
  --maxw: 1140px;

  --font-head: "Georgia", "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--c-ink);
  background: var(--c-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-head); color: var(--c-navy); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 4vw, 3rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.18rem; }
p { margin: 0 0 1em; }
a { color: var(--c-navy-soft); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 64px 0; }
.section--tight { padding: 40px 0; }
.center { text-align: center; }
.muted { color: var(--c-muted); }
.lead { font-size: 1.12rem; color: var(--c-ink-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  border: 0; cursor: pointer; font: inherit; font-weight: 600;
  padding: 12px 22px; border-radius: 999px; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--gold { background: var(--c-gold); color: #fff; box-shadow: var(--shadow-sm); }
.btn--gold:hover { background: #9c7b49; }
.btn--navy { background: var(--c-navy); color: #fff; }
.btn--navy:hover { background: var(--c-navy-soft); }
.btn--ghost { background: transparent; color: var(--c-navy); border: 1.5px solid var(--c-line); }
.btn--ghost:hover { border-color: var(--c-gold); color: var(--c-gold); }
.btn--block { width: 100%; justify-content: center; }
.btn--sm { padding: 8px 16px; font-size: .9rem; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--c-line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 150px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--c-navy); }
.brand__mark {
  width: 42px; height: 42px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--c-navy), var(--c-navy-soft));
  display: grid; place-items: center; color: var(--c-gold-soft);
  font-family: var(--font-head); font-weight: 700; font-size: 1.2rem;
  border: 1px solid rgba(176,141,87,.4);
}
.brand__logo { flex: none; display: block; filter: drop-shadow(0 3px 8px rgba(22,38,63,.22)); }
.brand__name { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; line-height: 1.05; }
.brand__sub { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--c-gold); }
.nav__links { display: flex; align-items: center; gap: 6px; }
.nav__links a {
  text-decoration: none; color: var(--c-ink-soft); font-weight: 500;
  padding: 8px 12px; border-radius: 8px; font-size: .96rem;
}
.nav__links a:hover { background: #f0eee9; color: var(--c-navy); }
.nav__links a.active { color: var(--c-navy); font-weight: 700; }
.nav__toggle { display: none; background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--c-navy); }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(1200px 400px at 80% -10%, rgba(176,141,87,.18), transparent),
    linear-gradient(160deg, var(--c-navy), #0e1b2e);
  color: #fff; padding: 84px 0 96px; position: relative; overflow: hidden;
}
.hero__inner { display: flex; align-items: center; justify-content: space-between; gap: 48px; }
.hero__text { flex: 1; min-width: 0; }
.hero__art { flex: none; position: relative; display: grid; place-items: center; }
.hero__art::before { content: ""; position: absolute; width: 120%; height: 120%; border-radius: 50%; background: radial-gradient(circle, rgba(205,177,133,.30), transparent 62%); z-index: 0; }
.hero__art img { position: relative; z-index: 1; width: clamp(340px, 46vw, 600px); height: auto; filter: drop-shadow(0 18px 44px rgba(0,0,0,.5)); animation: floaty 6s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.hero h1 { color: #fff; max-width: 16ch; }
.hero p { color: #d7deea; max-width: 56ch; font-size: 1.12rem; }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.hero__badge {
  display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--c-gold-soft); margin-bottom: 18px;
}
.hero__badge::before { content: ""; width: 28px; height: 1px; background: var(--c-gold); }

/* ---------- Cards & grids ---------- */
.grid { display: grid; gap: 22px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-sm);
}
.card--hover { transition: transform .15s ease, box-shadow .15s ease; }
.card--hover:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card__tag {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--c-gold); background: #f6efe3; padding: 4px 10px; border-radius: 999px; margin-bottom: 12px;
}
.card__date { font-size: .82rem; color: var(--c-muted); }
.icon-circle {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
  background: #f1eee8; color: var(--c-gold); font-size: 1.4rem; margin-bottom: 14px;
}

.section-head { max-width: 60ch; margin-bottom: 34px; }
.section-head--center { margin-left: auto; margin-right: auto; text-align: center; }
.eyebrow { color: var(--c-gold); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: .78rem; }

/* ---------- Stats / wins ---------- */
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; }
.stat { text-align: center; }
.stat__num { font-family: var(--font-head); font-size: 2.2rem; color: var(--c-navy); }
.stat__lbl { color: var(--c-ink-soft); font-size: .95rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--c-navy); color: #c9d2e0; padding: 54px 0 28px; margin-top: 40px; }
.site-footer h4 { color: #fff; font-family: var(--font-head); margin: 0 0 14px; }
.site-footer a { color: #c9d2e0; text-decoration: none; }
.site-footer a:hover { color: var(--c-gold-soft); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 30px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 30px; padding-top: 18px; font-size: .85rem; display:flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.share-row { display: flex; gap: 10px; flex-wrap: wrap; }
.share-btn {
  width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(255,255,255,.08); color: #fff; text-decoration: none; font-size: 1.1rem; border: 1px solid rgba(255,255,255,.12);
}
.share-btn:hover { background: var(--c-gold); }

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: .92rem; color: var(--c-ink); }
.field input, .field select, .field textarea {
  font: inherit; padding: 12px 14px; border: 1.5px solid var(--c-line); border-radius: var(--radius-sm);
  background: #fff; color: var(--c-ink); width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--c-gold); box-shadow: 0 0 0 3px rgba(176,141,87,.15); }
.field--check { display: flex; gap: 10px; align-items: flex-start; }
.field--check input { width: auto; margin-top: 4px; }
.field--check label { font-weight: 400; font-size: .88rem; color: var(--c-ink-soft); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Badges / status ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; }
.badge--success { background: #e4f3ea; color: var(--c-success); }
.badge--warning { background: #fbf0db; color: var(--c-warning); }
.badge--info { background: #e4eff6; color: var(--c-info); }
.badge--danger { background: #fbe7e6; color: var(--c-danger); }
.badge--neutral { background: #eef0f3; color: var(--c-ink-soft); }

/* ---------- Auth / client area ---------- */
.auth-wrap { min-height: 70vh; display: grid; place-items: center; padding: 50px 0; }
.auth-card { background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 36px; width: 100%; max-width: 430px; }
.auth-card h2 { text-align: center; }
.demo-hint { background: #f3f6fb; border: 1px dashed #c2cee0; border-radius: var(--radius-sm); padding: 12px 14px; font-size: .85rem; color: var(--c-ink-soft); margin-top: 18px; }

.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 150px); }
.app-side { background: #fff; border-right: 1px solid var(--c-line); padding: 22px 14px; }
.app-side__user { padding: 10px 12px 18px; border-bottom: 1px solid var(--c-line); margin-bottom: 14px; }
.app-side__user .nm { font-weight: 700; color: var(--c-navy); }

/* Selettore pratica attiva (sempre visibile) */
.pratica-switch { padding: 0 12px 16px; border-bottom: 1px solid var(--c-line); margin-bottom: 14px; }
.ps-label { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--c-gold); margin-bottom: 7px; }
.ps-select {
  width: 100%; font: inherit; font-weight: 600; color: var(--c-navy); cursor: pointer;
  padding: 11px 12px; border: 1.5px solid var(--c-line); border-radius: var(--radius-sm); background: #fbfaf7;
  appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23b08d57' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.ps-select:focus { outline: none; border-color: var(--c-gold); box-shadow: 0 0 0 3px rgba(176,141,87,.15); }
.ps-single { padding: 10px 12px; background: #fbfaf7; border: 1px solid var(--c-line); border-radius: var(--radius-sm); }
.ps-single .t { font-weight: 700; color: var(--c-navy); font-size: .92rem; }

/* Barra di contesto pratica (nelle altre schede) */
.pratica-ctx { display: flex; align-items: center; gap: 10px; background: #f6efe3; border: 1px solid #ecdfc8; border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 20px; font-size: .9rem; }
.pratica-ctx .lbl { color: var(--c-gold); font-weight: 700; }
.app-nav { display: grid; gap: 4px; }
.app-nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  background: none; border: 0; font: inherit; padding: 11px 12px; border-radius: 9px; color: var(--c-ink-soft);
}
.app-nav button:hover { background: #f2f1ec; }
.app-nav button.active { background: var(--c-navy); color: #fff; }
.app-main { padding: 30px; max-width: 900px; }

/* ---------- Timeline (stato pratica) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 4px; bottom: 4px; width: 2px; background: var(--c-line); }
.timeline li { position: relative; padding: 0 0 22px 40px; }
.timeline .dot { position: absolute; left: 3px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--c-line); }
.timeline li.done .dot { background: var(--c-success); border-color: var(--c-success); }
.timeline li.current .dot { background: var(--c-gold); border-color: var(--c-gold); box-shadow: 0 0 0 4px rgba(176,141,87,.18); }
.timeline .t-title { font-weight: 700; color: var(--c-navy); }
.timeline .t-date { font-size: .82rem; color: var(--c-muted); }

/* ---------- Doc / list rows ---------- */
.row-list { display: grid; gap: 10px; }
.row-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: #fff;
  border: 1px solid var(--c-line); border-radius: var(--radius-sm);
}
.row-item .ri-ic { width: 40px; height: 40px; border-radius: 9px; background: #f1eee8; color: var(--c-gold); display: grid; place-items: center; font-size: 1.2rem; flex: none; }
.row-item .ri-main { flex: 1; min-width: 0; }
.row-item .ri-title { font-weight: 600; }
.row-item .ri-sub { font-size: .83rem; color: var(--c-muted); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--c-line); margin-bottom: 22px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; font: inherit; cursor: pointer; padding: 10px 16px; color: var(--c-muted); font-weight: 600; border-bottom: 3px solid transparent; }
.tabs button.active { color: var(--c-navy); border-bottom-color: var(--c-gold); }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; gap: 12px; max-height: 420px; overflow-y: auto; padding: 6px; }
.msg { max-width: 75%; padding: 10px 14px; border-radius: 14px; font-size: .94rem; }
.msg .meta { display: block; font-size: .72rem; opacity: .7; margin-top: 4px; }
.msg--in { align-self: flex-start; background: #f0eee9; border-bottom-left-radius: 4px; }
.msg--out { align-self: flex-end; background: var(--c-navy); color: #fff; border-bottom-right-radius: 4px; }
.chat-input { display: flex; gap: 10px; margin-top: 14px; }
.chat-input input { flex: 1; }

/* ---------- Service / pricing cards ---------- */
.price { font-family: var(--font-head); font-size: 1.8rem; color: var(--c-navy); }
.price small { font-size: .8rem; color: var(--c-muted); font-family: var(--font-body); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16,27,46,.55); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: var(--radius); max-width: 520px; width: 100%; padding: 30px; box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto; }
.modal__close { float: right; background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: var(--c-muted); }

/* ---------- WhatsApp floating button ---------- */
.wa-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 150;
  display: flex; align-items: center; gap: 10px;
  background: #25d366; color: #fff; text-decoration: none;
  padding: 13px 18px 13px 14px; border-radius: 999px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(37,211,102,.45);
  transition: transform .15s ease, box-shadow .15s ease;
}
.wa-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(37,211,102,.55); color:#fff; }
.wa-fab svg { width: 26px; height: 26px; flex: none; }
.btn svg { width: 20px; height: 20px; flex: none; }
.wa-fab .wa-txt { font-size: .95rem; white-space: nowrap; }
.wa-fab__pulse { position: absolute; inset: 0; border-radius: 999px; box-shadow: 0 0 0 0 rgba(37,211,102,.5); animation: waPulse 2.2s infinite; }
@keyframes waPulse { 0% { box-shadow: 0 0 0 0 rgba(37,211,102,.5); } 70% { box-shadow: 0 0 0 16px rgba(37,211,102,0); } 100% { box-shadow: 0 0 0 0 rgba(37,211,102,0); } }
@media (max-width: 640px) { .wa-fab .wa-txt { display: none; } .wa-fab { padding: 14px; right: 16px; bottom: 16px; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--c-navy); color: #fff; padding: 13px 22px; border-radius: 999px;
  box-shadow: var(--shadow); z-index: 200; font-weight: 600; animation: fadein .25s ease;
}
@keyframes fadein { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Informativa privacy ---------- */
.privacy h3 { margin-top: 30px; margin-bottom: 8px; font-size: 1.12rem; }
.privacy p { color: var(--c-ink-soft); }
.privacy ul { color: var(--c-ink-soft); padding-left: 22px; margin: 0 0 1em; }
.privacy ul li { margin-bottom: 8px; }
.privacy a { color: var(--c-navy-soft); }

/* ---------- Utility ---------- */
.stack-sm > * + * { margin-top: 8px; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.divider { height: 1px; background: var(--c-line); border: 0; margin: 22px 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid--3 { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .app-shell { grid-template-columns: 1fr; }
  .app-side { border-right: 0; border-bottom: 1px solid var(--c-line); }
  .app-nav { grid-auto-flow: column; overflow-x: auto; }
  .app-nav button { white-space: nowrap; }
}
@media (max-width: 640px) {
  .nav { height: 88px; }
  .brand__logo { width: 64px; height: 64px; }
  .nav__links { display: none; position: absolute; top: 88px; left: 0; right: 0; background: #fff; flex-direction: column; padding: 12px; border-bottom: 1px solid var(--c-line); gap: 2px; }
  .nav__links.open { display: flex; }
  .nav__links a { padding: 12px; }
  .nav__toggle { display: block; }
  .grid--3, .grid--2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .hero__inner { flex-direction: column-reverse; text-align: center; gap: 24px; }
  .hero h1, .hero p { max-width: none; }
  .hero__actions { justify-content: center; }
  .hero__art img { width: 200px; }
}
