/* ============================================================
   VISION 151 — Stili globali  |  Brand Book 2026
   Font: Outfit Bold (titoli) · Poppins (body)
   v3 — logo ufficiale, Outfit + Poppins
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Palette ufficiale Vision 151 — Brand Book 2026 */
  --favi:    #1A1A1A;   /* PRIMARIO | FAVI */
  --miele:   #F5C518;   /* PRIMARIO | MIELE */
  --nettare: #F8B133;   /* SECONDARIO | NETTARE */
  --crema:   #FEF8EA;   /* PRIMARIO | CREMA */
  --verde:   #1A5B42;   /* COMPLEMENTARE | NATURE */
  /* Grigi UI */
  --gray1:   #242424;
  --gray2:   #2E2E2E;
  --gray3:   #3A3A3A;
  --gray4:   #555;
  --gray5:   #888;
  --gray6:   #B3B3B3;
  --white:   #FFFFFF;
  --danger:  #D9534F;
  --success: #3CB371;
  /* Font brand */
  --font-brand: 'Outfit', -apple-system, sans-serif;
  --font-body:  'Poppins', -apple-system, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  font-weight: 300;
  background: var(--favi);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--miele); text-decoration: none; }
a:hover { color: var(--nettare); }

/* ─── LAYOUT APP ─────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: #0F0F0F;
  border-right: 1px solid var(--gray3);
  padding: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

/* Logo ufficiale nella sidebar */
.sidebar-brand {
  padding: 18px 20px;
  border-bottom: 1px solid var(--gray3);
  display: flex;
  align-items: center;
}
.sidebar-logo {
  width: 130px;
  height: auto;
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sidebar-nav a {
  color: var(--gray6);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 9px;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.2px;
}
.sidebar-nav a:hover { background: var(--gray2); color: var(--white); }
.sidebar-nav a.active { background: var(--miele); color: var(--favi); font-weight: 600; }
.sidebar-nav .section {
  font-size: 9.5px;
  letter-spacing: 1.6px;
  color: var(--gray4);
  text-transform: uppercase;
  padding: 14px 12px 5px;
  font-weight: 500;
}

.sidebar-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--gray3);
  font-size: 12px;
  color: var(--gray5);
  font-weight: 400;
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: var(--gray1);
  border-bottom: 1px solid var(--gray3);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-title {
  font-family: var(--font-brand);
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  text-transform: lowercase;
}
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--gray5); font-weight: 400; }
.topbar-user a { color: var(--gray5); font-size: 12px; }
.topbar-user a:hover { color: var(--miele); }

.content { padding: 32px; flex: 1; }

/* ─── KPI CARDS ──────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.kpi-card {
  background: var(--gray1);
  border: 1px solid var(--gray3);
  border-radius: 14px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-label {
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--gray5);
  font-weight: 500;
}
.kpi-value {
  font-family: var(--font-brand);
  font-size: 32px;
  font-weight: 700;
  color: var(--white);
  text-transform: lowercase;
}
.kpi-value.miele { color: var(--miele); }
.kpi-value.verde { color: var(--success); }
.kpi-sub { font-size: 12px; color: var(--gray5); font-weight: 300; }

/* ─── PANEL ─────────────────────────────────────────── */
.panel {
  background: var(--gray1);
  border: 1px solid var(--gray3);
  border-radius: 14px;
  padding: 24px 28px;
  margin-bottom: 22px;
}
.panel h2 {
  font-family: var(--font-brand);
  font-size: 18px;
  font-weight: 700;
  text-transform: lowercase;
  margin-bottom: 16px;
  color: var(--white);
}
.panel-incentivi {
  background: linear-gradient(135deg, var(--gray1), #1F1A0A);
  border-color: rgba(245,197,24,0.3);
}

/* ─── FORM ──────────────────────────────────────────── */
.form-row { margin-bottom: 18px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--gray5);
  margin-bottom: 6px;
}
.form-label span { color: var(--miele); }
.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--gray2);
  border: 1px solid var(--gray3);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--gray4); }
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--miele);
  box-shadow: 0 0 0 3px rgba(245,197,24,0.12);
}
.form-textarea { resize: vertical; min-height: 90px; line-height: 1.6; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: none;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn-primary { background: var(--miele); color: var(--favi); }
.btn-primary:hover { background: var(--nettare); color: var(--favi); }
.btn-ghost { background: transparent; color: var(--gray5); border: 1px solid var(--gray3); }
.btn-ghost:hover { color: var(--white); border-color: var(--gray5); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-block { width: 100%; }

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
  font-weight: 400;
}
.alert-error   { background: rgba(217,83,79,0.12);  border: 1px solid rgba(217,83,79,0.3);  color: #FF8A85; }
.alert-success { background: rgba(60,179,113,0.12); border: 1px solid rgba(60,179,113,0.3); color: #79E0A8; }
.alert-info    { background: rgba(245,197,24,0.10); border: 1px solid rgba(245,197,24,0.3); color: var(--miele); }

/* ─── TABLES ────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gray5);
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray3);
  font-weight: 500;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray2);
  color: var(--gray6);
  font-weight: 300;
}
.table tr:hover td { background: rgba(255,255,255,0.02); color: var(--white); }
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-on  { background: rgba(60,179,113,0.18); color: #79E0A8; }
.badge-off { background: rgba(180,180,180,0.12); color: var(--gray5); }

/* ─── LOGIN ─────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--favi);
}
.login-card {
  background: var(--gray1);
  border: 1px solid var(--gray3);
  border-radius: 18px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.login-logo-img {
  width: 200px;
  height: auto;
  display: block;
}
.login-sub {
  text-align: center;
  color: var(--gray5);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 500;
}

/* ─── LOADING OVERLAY — step animation ──────────────── */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(10,10,10,0.96);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  z-index: 1000;
}
.loading-overlay.show { display: flex; }

/* Pittogramma che fluttua */
.loading-bee {
  width: 70px;
  height: auto;
  animation: bee-float 2.2s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(245,197,24,0.35));
}
@keyframes bee-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%       { transform: translateY(-10px) rotate(2deg); }
}

.loading-title {
  font-family: var(--font-brand);
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  text-align: center;
  text-transform: lowercase;
}
.loading-tagline {
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gray5);
  text-align: center;
  margin-top: -18px;
  font-weight: 500;
}

/* Progress bar */
.loading-bar-wrap {
  width: 340px;
  height: 3px;
  background: var(--gray2);
  border-radius: 2px;
  overflow: hidden;
}
.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--miele), var(--nettare));
  border-radius: 2px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Steps */
.loading-steps { display: flex; flex-direction: column; gap: 8px; width: 340px; }
.loading-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  transition: all 0.4s ease;
}
.loading-step.active { background: rgba(245,197,24,0.08); border-color: rgba(245,197,24,0.25); }
.loading-step.done   { background: rgba(60,179,113,0.06); border-color: rgba(60,179,113,0.18); }

.ls-icon  { font-size: 14px; width: 26px; text-align: center; flex-shrink: 0; }
.ls-label { flex: 1; font-size: 13px; color: var(--gray5); transition: color 0.4s; font-weight: 300; }
.loading-step.active .ls-label { color: var(--white); font-weight: 500; }
.loading-step.done   .ls-label { color: var(--success); }

.ls-status { width: 16px; height: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.ls-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(245,197,24,0.2);
  border-top-color: var(--miele);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}
.loading-step.active .ls-spinner { display: block; }
.loading-step.done   .ls-spinner { display: none; }
.ls-check { display: none; color: var(--success); font-size: 13px; font-weight: 600; }
.loading-step.done .ls-check { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── RESPONSIVE ────────────────────────────────────── */
@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .form-row-2 { grid-template-columns: 1fr; }
  .content { padding: 20px; }
  .loading-steps, .loading-bar-wrap { width: 90vw; }
}
