/* ============================================================
   Questionario Ateneo — Design System
   Palette: navy istituzionale + indigo, sfondi freddi tenui
   ============================================================ */

:root {
  --brand-950: #141A3D;
  --brand-900: #1B2559;
  --brand-800: #232F6E;
  --brand-700: #33409A;
  --brand-600: #4650C9;
  --brand-500: #4F46E5;
  --brand-100: #E4E8FA;
  --brand-50:  #F3F5FD;
  --ink:       #1F2937;
  --ink-soft:  #5B6472;
  --surface:   #FFFFFF;
  --ok:        #22C55E;
  --danger:    #EF4444;
  --radius:    14px;
  --shadow-sm: 0 1px 3px rgba(20, 26, 61, .07);
  --shadow-md: 0 6px 18px rgba(20, 26, 61, .10);
}

html { font-size: 15px; position: relative; min-height: 100%; }

body {
  /* Stack di font di sistema: nessuna dipendenza esterna, nessun flash di caricamento.
     Su Windows (ambiente d'uso dell'ateneo) rende con Segoe UI. */
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #EEF1F7 0%, #E7EBF4 100%);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }

h1, h2, h3, h4, h5, .navbar-brand { letter-spacing: -.01em; }

/* ---------- Topbar ---------- */
.topbar {
  background: linear-gradient(90deg, var(--brand-950), var(--brand-800));
  box-shadow: 0 2px 12px rgba(20, 26, 61, .25);
  padding: .65rem 0;
}
.topbar .navbar-brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.12rem;
  display: flex;
  align-items: center;
  gap: .55rem;
}
.topbar .brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-500), #7C3AED);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(79, 70, 229, .45);
}
.topbar .nav-link {
  color: rgba(255, 255, 255, .78);
  font-weight: 500;
  padding: .45rem .85rem;
  border-radius: 8px;
  transition: all .15s;
}
.topbar .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.topbar .nav-link.attivo { color: #fff; background: rgba(255, 255, 255, .14); }
.topbar .btn-esci {
  color: rgba(255, 255, 255, .78);
  background: none;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 8px;
  padding: .35rem .9rem;
  font-weight: 500;
  transition: all .15s;
}
.topbar .btn-esci:hover { color: #fff; border-color: rgba(255,255,255,.6); background: rgba(255,255,255,.08); }
.topbar .utente-chip {
  color: rgba(255, 255, 255, .9);
  font-size: .86rem;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .35rem .8rem;
  background: rgba(255, 255, 255, .10);
  border-radius: 999px;
  text-decoration: none;
}
.topbar .utente-chip:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.topbar .navbar-toggler { border-color: rgba(255,255,255,.3); }
.topbar .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255,255,255,0.8)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ---------- Card e superfici ---------- */
.card {
  border: 1px solid #E3E8F2;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
a .card { transition: box-shadow .2s, border-color .2s, transform .15s; }
a .card:hover { box-shadow: var(--shadow-md); border-color: var(--brand-100); transform: translateY(-2px); }

/* ---------- Bottoni e form ---------- */
.btn { border-radius: 10px; font-weight: 600; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  border: none;
  box-shadow: 0 2px 8px rgba(79, 70, 229, .35);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--brand-700), var(--brand-600)); }
.btn-success { box-shadow: 0 2px 8px rgba(34, 197, 94, .3); }

.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 .18rem rgba(79, 70, 229, .18);
}
.form-check-input:checked { background-color: var(--brand-500); border-color: var(--brand-500); }

.nav-pills .nav-link { border-radius: 9px; font-weight: 600; color: var(--ink-soft); }
.nav-pills .nav-link.active { background: var(--brand-600); }

.badge { font-weight: 600; border-radius: 7px; }

.table thead th {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-soft);
  border-bottom-width: 2px;
}

/* ---------- Footer ---------- */
.footer {
  padding: 1.1rem 0;
  color: var(--ink-soft);
  font-size: .82rem;
  text-align: center;
}

/* ============================================================
   Pagina di Login
   ============================================================ */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
}
.login-card {
  display: grid;
  grid-template-columns: 5fr 6fr;
  max-width: 940px;
  width: 100%;
  background: var(--surface);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(20, 26, 61, .18);
}
.login-card-semplice { grid-template-columns: 1fr; max-width: 440px; }
.login-hero {
  background: linear-gradient(150deg, var(--brand-950) 0%, var(--brand-800) 55%, var(--brand-700) 100%);
  color: #fff;
  padding: 2.8rem 2.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-hero::before {
  content: '';
  position: absolute;
  width: 340px; height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 70, 229, .35), transparent 70%);
  top: -120px; right: -120px;
}
.login-hero::after {
  content: '';
  position: absolute;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, .28), transparent 70%);
  bottom: -100px; left: -80px;
}
.login-hero > * { position: relative; z-index: 1; }
.login-hero-brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-weight: 700;
  font-size: 1.15rem;
}
.login-hero-brand .brand-mark {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand-500), #7C3AED);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}
.login-hero h2 {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 1.8rem 0 .6rem;
}
.login-hero .sotto { color: rgba(255, 255, 255, .72); font-size: .92rem; line-height: 1.55; }
.login-feature {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  margin-top: 1.1rem;
  font-size: .88rem;
  color: rgba(255, 255, 255, .85);
}
.login-feature .icona {
  width: 34px; height: 34px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: rgba(255, 255, 255, .12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.login-hero .firma { color: rgba(255, 255, 255, .45); font-size: .75rem; margin-top: 2rem; }

.login-form-panel { padding: 2.8rem 2.6rem; }
.login-form-panel h1 { font-size: 1.45rem; font-weight: 700; margin-bottom: .3rem; }
.login-form-panel .sotto { color: var(--ink-soft); font-size: .9rem; margin-bottom: 1.6rem; }
.login-form-panel .form-floating > .form-control { border-radius: 10px; }
.login-links { font-size: .85rem; }
.login-links a { color: var(--brand-600); text-decoration: none; font-weight: 500; }
.login-links a:hover { text-decoration: underline; }

@media (max-width: 820px) {
  .login-card { grid-template-columns: 1fr; max-width: 460px; }
  .login-hero { display: none; }
  .login-form-panel { padding: 2.2rem 1.8rem; }
}

/* ============================================================
   Home — hero
   ============================================================ */
.hero {
  text-align: center;
  padding: 2.6rem 1rem 1.8rem;
}
.hero h1 {
  font-size: 2.1rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--brand-900), var(--brand-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { color: var(--ink-soft); max-width: 560px; margin: .6rem auto 0; }
.modulo-icona {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: .8rem;
}

/* ============================================================
   Commento automatico profilo di rischio
   ============================================================ */
.ai-comment-box {
  line-height: 1.6;
  color: #333;
  background: #F8FAFC;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid #E2E8F0;
  margin-bottom: 2rem;
}
.ai-comment-box .commento-header { display: flex; align-items: center; margin-bottom: 15px; }
.ai-comment-box .commento-icona { font-size: 24px; margin-right: 10px; }
.ai-comment-box h3 { color: #1E40AF; margin: 0; font-size: 1.25rem; }
.ai-comment-box .commento-area { color: #9A3412; margin-top: 16px; font-size: 1.1rem; }
.ai-comment-box .commento-criticita { color: #4B5563; margin-top: 16px; font-size: 1.1rem; }
.ai-comment-box .commento-criticita-alta { color: #B91C1C; margin-top: 16px; font-size: 1.1rem; }
.ai-comment-box .commento-raccomandazione {
  background-color: #F0FDF4;
  border-left: 4px solid var(--ok);
  padding: 12px;
  margin-top: 20px;
  border-radius: 4px;
}
.ai-comment-box .commento-raccomandazione strong { color: #166534; }

/* ============================================================
   Wizard somministrazione questionario
   ============================================================ */
.wizard-wrap { max-width: 780px; }

.wizard-pills {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: .6rem;
}
.wizard-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 2px solid #dee2e6;
  background: #fff;
  border-radius: 999px;
  padding: .35rem .8rem;
  font-size: .82rem;
  font-weight: 600;
  color: #6c757d;
  cursor: default;
  transition: all .15s;
}
.wizard-pill.raggiungibile { cursor: pointer; }
.wizard-pill.attivo {
  border-color: var(--brand-500);
  background: var(--brand-500);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, .35);
}
.wizard-pill.completato { border-color: var(--ok); color: #15803d; background: #F0FDF4; }
.wizard-pill .wizard-pill-check { display: none; }
.wizard-pill.completato .wizard-pill-check { display: inline; color: var(--ok); }
.wizard-pill.completato .wizard-pill-icona { display: none; }

.wizard-progress { height: 6px; margin-bottom: 1.2rem; border-radius: 999px; }
.wizard-progress .progress-bar { background: var(--brand-500); transition: width .3s; }

.wizard-step-header {
  display: flex;
  align-items: center;
  gap: .8rem;
  background: linear-gradient(135deg, var(--brand-800), var(--brand-600));
  color: #fff;
  border-radius: var(--radius);
  padding: 1rem 1.3rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow-md);
}
.wizard-step-icona { font-size: 1.9rem; }
.wizard-step-titolo { font-size: 1.25rem; font-weight: 700; letter-spacing: .5px; }
.wizard-step-sotto { font-size: .8rem; opacity: .85; }

.domanda-card {
  background: #F7F9FF;
  border: 1px solid #DCE3F5;
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  margin-bottom: .9rem;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.domanda-card:focus-within {
  background: #fff;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.domanda-card.domanda-errore {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .12);
}
.domanda-card .form-select, .domanda-card .form-control { background-color: #fff; }

.domanda-testata {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  margin-bottom: .7rem;
}
.domanda-numero {
  flex: 0 0 auto;
  width: 1.9rem; height: 1.9rem;
  border-radius: 50%;
  background: var(--brand-100);
  color: var(--brand-600);
  font-weight: 700;
  font-size: .9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: .1rem;
}
.domanda-testo {
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.45;
  color: var(--ink);
  margin: 0;
}
.domanda-input { padding-left: 2.6rem; }

.domanda-condizionale {
  margin-left: 2.2rem;
  background: #F6F0FF;
  border-left: 4px solid #A78BFA;
  border-color: #E2D6F8;
  border-radius: 0 12px 12px 0;
}
.domanda-condizionale .domanda-input { padding-left: 1.6rem; }
.domanda-freccia {
  flex: 0 0 auto;
  color: #7C3AED;
  font-weight: 700;
  font-size: 1.1rem;
}

.scelta-check {
  display: flex;
  align-items: center;
  gap: .6rem;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: .55rem .8rem;
  margin-bottom: .45rem;
  cursor: pointer;
  background: #fff;
  transition: all .12s;
}
.scelta-check:hover { background: #F1F4FE; }
.scelta-check:has(input:checked) {
  border-color: var(--brand-500);
  background: var(--brand-50);
}
.scelta-check input { margin: 0; }
.multiselect-hint { font-size: .82rem; color: var(--ink-soft); margin-bottom: .5rem; }

.wizard-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.5rem 0 3rem;
}
.wizard-nav #btn-avanti, .wizard-nav #btn-invia { min-width: 200px; }

@media (max-width: 576px) {
  .wizard-pill-nome { display: none; }
  .wizard-pill { padding: .35rem .55rem; }
  .domanda-input { padding-left: 0; }
  .domanda-condizionale { margin-left: .8rem; }
}

@media print {
  body { background: #fff; }
  .topbar, .footer { display: none; }
}

/* ============================================================
   Icone e-Campus (ritagliate dai banner dell'applicativo originale)
   ============================================================ */
.icona-ecampus {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(20, 26, 61, .18);
}
.icona-ecampus.icona-lg { width: 72px; height: 72px; }
.icona-ecampus.icona-sm { width: 34px; height: 34px; margin-bottom: .25rem; }

.icona-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: -4px;
}

/* Sigillo/filigrana come marchio */
.brand-sigillo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  padding: 1px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.brand-sigillo-lg { width: 42px; height: 42px; }

.hero-logo { max-width: 240px; height: auto; }
.login-logo { max-width: 190px; height: auto; display: block; margin-left: auto; margin-right: auto; }

/* Righe bozza nell'elenco somministrazione: rosso tenue, evidenzia il lavoro da completare.
   Bootstrap colora le CELLE tramite --bs-table-bg / --bs-table-accent-bg: vanno sovrascritte
   quelle, non il background della <tr> (che verrebbe coperto dalle celle). */
tr.riga-bozza {
  --bs-table-bg: #FDECEC;
  --bs-table-accent-bg: #FDECEC;
}
.table-hover > tbody > tr.riga-bozza:hover {
  --bs-table-accent-bg: #FBDDDD;
  color: inherit;
}
