/* =========================================================
   Test Pratico Risanamento — style.css
   Font: Syne (headings) + Rubik (body)
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=Rubik:wght@300;400;500;600&display=swap');

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:    #0c1445;
  --accent:  #0284c7;
  --accent2: #0ea5e9;
  --bg:      #f1f5f9;
  --card:    #ffffff;
  --text:    #1e293b;
  --muted:   #64748b;
  --border:  #cbd5e1;
  --green-bg:#dcfce7; --green-text:#15803d; --green-border:#86efac;
  --yellow-bg:#fef9c3; --yellow-text:#a16207; --yellow-border:#fde047;
  --red-bg:  #fee2e2; --red-text:  #b91c1c; --red-border:  #fca5a5;
  --shadow:  0 1px 3px rgba(0,0,0,.07), 0 4px 12px rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 10px 30px rgba(0,0,0,.08);
  --radius:  10px;
  --font-head: 'Syne', sans-serif;
  --font-body: 'Rubik', sans-serif;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font-body); color: var(--text); background: var(--bg); min-height: 100vh; }

/* --- Navbar --- */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 60px; background: var(--navy);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.navbar-brand {
  font-family: var(--font-head); font-weight: 700; font-size: .9rem;
  color: #ffffff; letter-spacing: .03em; text-decoration: none;
  display: flex; align-items: center; gap: 10px;
}
.navbar-brand img { height: 32px; width: auto; }
.navbar-brand span { color: var(--accent2); }
.navbar-user {
  display: flex; align-items: center; gap: 16px;
  font-size: .85rem; color: #94a3b8;
}
.navbar-user strong { color: #e2e8f0; font-weight: 500; }
.btn-logout {
  font-family: var(--font-body); font-size: .82rem; font-weight: 500;
  color: #94a3b8; background: transparent; border: 1px solid #334155;
  border-radius: 6px; padding: 5px 14px; cursor: pointer; text-decoration: none;
  transition: all .2s;
}
.btn-logout:hover { color: #fff; border-color: #64748b; background: #1e2a45; }

/* --- Main wrapper --- */
.main-wrapper {
  padding-top: 80px; padding-bottom: 48px;
  max-width: 860px; margin: 0 auto; padding-left: 20px; padding-right: 20px;
}

/* --- Page title --- */
.page-header { text-align: center; margin-bottom: 32px; }
.page-header h1 {
  font-family: var(--font-head); font-size: 1.3rem; font-weight: 800;
  color: var(--navy); letter-spacing: .02em; text-transform: uppercase; line-height: 1.4;
}
.page-header p { font-size: .88rem; color: var(--muted); margin-top: 6px; }

/* --- Card --- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px 32px; margin-bottom: 24px;
  animation: fadeUp .3s ease;
}
.card-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 22px; padding-bottom: 14px; border-bottom: 2px solid var(--bg);
}
.card-header h2 {
  font-family: var(--font-head); font-size: .95rem; font-weight: 700;
  color: var(--navy); text-transform: uppercase; letter-spacing: .05em;
}
.badge {
  font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 20px;
  letter-spacing: .05em;
}
.badge-a { background: var(--navy); color: #fff; }
.badge-b { background: var(--accent); color: #fff; }

/* --- Form fields --- */
.field-group { display: flex; flex-direction: column; }
.field-row {
  display: grid; grid-template-columns: 1fr 180px; align-items: center;
  gap: 12px; padding: 11px 0; border-bottom: 1px solid #f1f5f9;
}
.field-row:last-child { border-bottom: none; }
.field-label {
  font-size: .875rem; color: var(--text); line-height: 1.4;
  display: flex; align-items: center; gap: 6px;
}
.tooltip-wrap { position: relative; display: inline-flex; }
.tooltip-icon {
  width: 17px; height: 17px; border-radius: 50%;
  background: #e2e8f0; color: var(--muted);
  font-size: .65rem; font-weight: 700; cursor: default;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.tooltip-text {
  display: none; position: absolute; left: 24px; top: -4px;
  background: #1e293b; color: #f8fafc; font-size: .78rem;
  padding: 7px 11px; border-radius: 6px; z-index: 10;
  line-height: 1.4; width: 250px; box-shadow: var(--shadow-md);
}
.tooltip-wrap:hover .tooltip-text { display: block; }

.field-sign {
  font-family: var(--font-head); font-size: .7rem; font-weight: 700;
  padding: 2px 7px; border-radius: 4px; letter-spacing: .03em; flex-shrink: 0;
}
.sign-plus  { background: #dcfce7; color: #15803d; }
.sign-minus { background: #fee2e2; color: #b91c1c; }

.input-euro { position: relative; display: flex; align-items: center; }
.input-euro span {
  position: absolute; left: 11px; color: var(--muted); font-size: .9rem; pointer-events: none;
}
.input-euro input[type="number"] {
  width: 100%; padding: 9px 10px 9px 26px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-family: var(--font-body); font-size: .95rem; color: var(--text);
  background: #f8fafc; transition: border-color .2s, background .2s;
  -moz-appearance: textfield;
}
.input-euro input[type="number"]::-webkit-inner-spin-button,
.input-euro input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
.input-euro input[type="number"]:focus {
  outline: none; border-color: var(--accent); background: #fff;
  box-shadow: 0 0 0 3px rgba(2,132,199,.12);
}

/* --- Form actions --- */
.form-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; gap: 12px; flex-wrap: wrap;
}
.btn {
  font-family: var(--font-head); font-size: .88rem; font-weight: 700;
  border: none; border-radius: 8px; cursor: pointer;
  padding: 12px 28px; letter-spacing: .04em; transition: all .2s;
  text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 4px 12px rgba(2,132,199,.3);
}
.btn-primary:hover { background: #0369a1; transform: translateY(-1px); }
.btn-secondary {
  background: #f1f5f9; color: var(--muted); border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: #e2e8f0; color: var(--text); }
.btn-outline-accent {
  background: transparent; color: var(--accent); border: 1.5px solid var(--accent);
}
.btn-outline-accent:hover { background: var(--accent); color: #fff; }

/* --- Risultato KPI grid --- */
.result-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px;
}
.result-kpi {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; text-align: center;
}
.kpi-label {
  font-family: var(--font-head); font-size: .72rem; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 8px;
}
.kpi-value {
  font-family: var(--font-body); font-size: 1.35rem; font-weight: 600; color: var(--navy);
}
.kpi-value.kpi-ratio { font-size: 2rem; color: var(--accent); }

/* --- Verdetto semaforo --- */
.verdict-card {
  border-radius: var(--radius); padding: 36px 32px; text-align: center;
  border: 2px solid; animation: fadeUp .5s ease;
}
.verdict-card.verde  { background: var(--green-bg);  border-color: var(--green-border); }
.verdict-card.giallo { background: var(--yellow-bg); border-color: var(--yellow-border); }
.verdict-card.rosso  { background: var(--red-bg);    border-color: var(--red-border); }

.verdict-dot {
  width: 22px; height: 22px; border-radius: 50%; display: inline-block; margin-bottom: 14px;
  box-shadow: 0 0 0 6px rgba(0,0,0,.07);
}
.verde  .verdict-dot { background: var(--green-text); }
.giallo .verdict-dot { background: var(--yellow-text); }
.rosso  .verdict-dot { background: var(--red-text); }

.verdict-title {
  font-family: var(--font-head); font-size: 1.5rem; font-weight: 800; margin-bottom: 14px;
}
.verde  .verdict-title { color: var(--green-text); }
.giallo .verdict-title { color: var(--yellow-text); }
.rosso  .verdict-title { color: var(--red-text); }

.verdict-text {
  font-size: .92rem; color: var(--text); line-height: 1.65;
  max-width: 600px; margin: 0 auto;
}

.result-actions {
  display: flex; justify-content: center; gap: 16px; margin-top: 28px; flex-wrap: wrap;
}

/* --- Login page --- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0c1445 0%, #0f2167 50%, #1a3a8f 100%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 16px; padding: 44px 40px;
  width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 52px; width: auto; margin-bottom: 14px; }
.login-logo h1 {
  font-family: var(--font-head); font-size: .82rem; font-weight: 700;
  color: var(--navy); text-transform: uppercase; letter-spacing: .07em; line-height: 1.45;
}
.login-logo p { font-size: .77rem; color: var(--muted); margin-top: 5px; }
.login-divider { height: 2px; background: var(--bg); margin-bottom: 26px; }
.login-field { margin-bottom: 18px; }
.login-field label {
  display: block; font-family: var(--font-head); font-size: .77rem; font-weight: 700;
  color: var(--navy); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 7px;
}
.login-field input {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-family: var(--font-body); font-size: .95rem; color: var(--text); background: #f8fafc;
  transition: border-color .2s, background .2s;
}
.login-field input:focus {
  outline: none; border-color: var(--accent); background: #fff;
  box-shadow: 0 0 0 3px rgba(2,132,199,.12);
}
.login-error {
  background: var(--red-bg); color: var(--red-text); border: 1px solid var(--red-border);
  border-radius: 8px; padding: 10px 14px; font-size: .85rem; margin-bottom: 18px;
  display: flex; align-items: center; gap: 8px;
}
.btn-login {
  width: 100%; padding: 13px; background: var(--navy); color: #fff;
  font-family: var(--font-head); font-size: .9rem; font-weight: 700; letter-spacing: .06em;
  border: none; border-radius: 8px; cursor: pointer; transition: all .2s; text-transform: uppercase;
}
.btn-login:hover { background: #1a2a6b; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(12,20,69,.3); }

/* --- Animations --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Print styles (fallback) --- */
@media print {
  .navbar, .form-actions, .result-actions { display: none !important; }
  .main-wrapper { padding-top: 0; }
  body { background: white; }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .navbar { padding: 0 16px; }
  .navbar-brand { font-size: .8rem; }
  .navbar-brand img { height: 26px; }
  .main-wrapper { padding-top: 72px; padding-left: 14px; padding-right: 14px; }
  .card { padding: 18px 14px; }
  .field-row { grid-template-columns: 1fr; gap: 6px; }
  .result-grid { grid-template-columns: 1fr; }
  .login-card { padding: 30px 22px; }
  .page-header h1 { font-size: 1.05rem; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; justify-content: center; }
  .verdict-card { padding: 24px 16px; }
  .verdict-title { font-size: 1.2rem; }
  .result-actions { flex-direction: column; align-items: center; }
  .result-actions .btn { width: 100%; justify-content: center; }
}
