/* ══════════════════════════════════════════════════════════
   ARST STYLE GUIDE — v1.0
   Guida stile unificata per tutte le web app ARST SIAT

   Come usare:
   1. Copiare questo file nel progetto
   2. <link rel="stylesheet" href="arst-style-guide.css">
   3. Usare le classi e variabili documentate

   Basato su: app-incentivi (Tailwind/React → vanilla CSS)
   ══════════════════════════════════════════════════════════ */


/* ── VARIABILI ──────────────────────────────────────────── */
:root {
  /* Brand */
  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a8a;

  /* Stato */
  --green-100: #dcfce7;
  --green-600: #16a34a;
  --green-700: #15803d;

  --yellow-100: #fef3c7;
  --yellow-600: #ca8a04;
  --yellow-700: #a16207;

  --red-100: #fee2e2;
  --red-600: #dc2626;
  --red-700: #b91c1c;

  --orange-100: #ffedd5;
  --orange-500: #f97316;
  --orange-700: #c2410c;

  --purple-100: #f3e8ff;
  --purple-700: #7c3aed;

  /* Gray scale */
  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Semantiche */
  --primary:       var(--blue-700);
  --primary-hover:  var(--blue-800);
  --primary-light:  var(--blue-50);
  --primary-accent: var(--blue-600);

  --success:       var(--green-600);
  --success-bg:    var(--green-100);
  --danger:        var(--red-600);
  --danger-bg:     var(--red-100);
  --warning:       var(--yellow-600);
  --warning-bg:    var(--yellow-100);
  --info:          var(--blue-600);
  --info-bg:       var(--blue-100);

  /* Layout */
  --max-width:     80rem;  /* 1280px */
  --radius-sm:     0.375rem;
  --radius:        0.5rem;
  --radius-lg:     0.75rem;
  --radius-xl:     1rem;

  /* Shadows */
  --shadow-sm:     0 1px 2px rgba(0,0,0,0.05);
  --shadow:        0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg:     0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --shadow-xl:     0 20px 25px rgba(0,0,0,0.1), 0 8px 10px rgba(0,0,0,0.04);

  /* Font */
  --font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif,
                 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
}


/* ── RESET & BASE ───────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-accent); text-decoration: none; }
a:hover { text-decoration: underline; }


/* ══════════════════════════════════════════════════════════
   NAVBAR
   ══════════════════════════════════════════════════════════ */
.navbar {
  background: var(--primary);
  color: white;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-right: 24px;
  text-decoration: none;
  color: white;
}

.navbar .brand img {
  height: 36px;
  width: auto;
  filter: brightness(0) invert(1);
}

.navbar .subtitle {
  font-size: 13px;
  opacity: 0.8;
}

.navbar nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.navbar nav a {
  color: rgba(255,255,255,0.85);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.navbar nav a:hover {
  background: rgba(255,255,255,0.1);
  color: white;
  text-decoration: none;
}

.navbar nav a.active {
  background: rgba(255,255,255,0.15);
  color: white;
  font-weight: 600;
}

/* Navbar responsive */
@media (max-width: 640px) {
  .navbar { flex-wrap: wrap; height: auto; padding: 12px 16px; }
  .navbar nav { width: 100%; margin-top: 8px; margin-left: 0; }
}


/* ══════════════════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════════════════ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 12px;
}

@media (min-width: 640px) {
  .container { padding: 24px 16px; }
}

.container.narrow { max-width: 640px; }
.container.medium { max-width: 800px; }


/* ══════════════════════════════════════════════════════════
   CARD
   ══════════════════════════════════════════════════════════ */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.card-padded { padding: 24px; }

.card-shadow { box-shadow: var(--shadow-sm); }
.card-elevated { box-shadow: var(--shadow-xl); border: none; }

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
}


/* ══════════════════════════════════════════════════════════
   FORM
   ══════════════════════════════════════════════════════════ */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-family: var(--font-family);
  color: var(--gray-800);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--gray-300);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--blue-300);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-group input.is-error,
.form-group select.is-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-group .hint {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
}

.form-group .error-msg {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}


/* ══════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
  text-decoration: none;
  line-height: 1.4;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary: bg-blue-600 → hover bg-blue-700 */
.btn-primary {
  background: var(--primary-accent);
  color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--primary); }

/* Secondary: white + border */
.btn-secondary {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}
.btn-secondary:hover:not(:disabled) { background: var(--gray-50); }

/* Success */
.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover:not(:disabled) { background: var(--green-700); }

/* Danger */
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover:not(:disabled) { background: var(--red-700); }

/* Sizes */
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; font-weight: 600; }
.btn-block { width: 100%; }


/* ══════════════════════════════════════════════════════════
   BADGE / STATUS
   ══════════════════════════════════════════════════════════ */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.badge-approvata,
.badge-success   { background: var(--success-bg); color: var(--green-700); }

.badge-inviata,
.badge-attesa,
.badge-warning   { background: var(--warning-bg); color: var(--yellow-700); }

.badge-rifiutata,
.badge-respinta,
.badge-danger    { background: var(--danger-bg); color: var(--red-700); }

.badge-bozza,
.badge-default   { background: var(--gray-100); color: var(--gray-700); }

.badge-elaborata,
.badge-info      { background: var(--info-bg); color: var(--blue-800); }


/* ══════════════════════════════════════════════════════════
   TABELLA DATI
   ══════════════════════════════════════════════════════════ */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data-table thead {
  background: var(--gray-50);
}

table.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

table.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

table.data-table tbody tr:hover {
  background: var(--gray-50);
}

table.data-table .text-right { text-align: right; }


/* ══════════════════════════════════════════════════════════
   TABS
   ══════════════════════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: var(--gray-700); }

.tab.active {
  color: var(--primary-accent);
  border-bottom-color: var(--primary-accent);
  font-weight: 600;
}

.tab-content { display: none; }
.tab-content.active { display: block; }


/* ══════════════════════════════════════════════════════════
   FILTRI / TOOLBAR
   ══════════════════════════════════════════════════════════ */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filters input,
.filters select {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-family: var(--font-family);
  color: var(--gray-700);
}

.filters input:focus,
.filters select:focus {
  outline: none;
  border-color: var(--blue-300);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Filter pills (come incentivi) */
.pill {
  padding: 6px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  background: white;
  cursor: pointer;
  transition: all 0.15s;
}

.pill:hover {
  border-color: var(--blue-400);
  color: var(--primary-accent);
}

.pill.active {
  background: var(--primary-accent);
  color: white;
  border-color: var(--primary-accent);
}

@media (max-width: 640px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .filters { flex-direction: column; }
}


/* ══════════════════════════════════════════════════════════
   STAT CARDS
   ══════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  padding: 20px;
  text-align: center;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.stat-card .label {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.stat-card.green .value  { color: var(--success); }
.stat-card.red .value    { color: var(--danger); }
.stat-card.orange .value { color: var(--warning); }


/* ══════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════ */
.login-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue-700), var(--blue-900));
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 1rem;
  box-shadow: var(--shadow-xl);
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 24px;
  color: var(--gray-800);
}


/* ══════════════════════════════════════════════════════════
   TOAST / NOTIFICHE
   ══════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px;
  border-radius: var(--radius-lg);
  color: white;
  font-weight: 500;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transition: transform 0.3s ease;
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.info    { background: var(--primary-accent); }


/* ══════════════════════════════════════════════════════════
   SPINNER
   ══════════════════════════════════════════════════════════ */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: arst-spin 0.6s linear infinite;
}

.spinner-primary {
  border-color: var(--blue-100);
  border-top-color: var(--primary);
}

@keyframes arst-spin { to { transform: rotate(360deg); } }


/* ══════════════════════════════════════════════════════════
   SUCCESS SCREEN
   ══════════════════════════════════════════════════════════ */
.success-screen {
  text-align: center;
  padding: 48px 24px;
}

.success-screen .icon-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 28px;
  color: white;
}

.success-screen h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.success-screen p {
  color: var(--gray-500);
  font-size: 14px;
}


/* ══════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════ */
.footer {
  border-top: 1px solid var(--gray-200);
  margin-top: 32px;
  padding: 24px 16px;
  background: white;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--gray-400);
}

@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
  }
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-left img {
  height: 32px;
  width: auto;
  opacity: 0.4;
}

.footer-left .footer-text {
  font-size: 12px;
  color: var(--gray-400);
  line-height: 1.5;
}

.footer-left .footer-text strong {
  color: var(--gray-500);
  font-weight: 500;
}

.footer-right {
  font-size: 11px;
  color: var(--gray-400);
  text-align: right;
}

.footer-right a {
  color: var(--gray-400);
  text-decoration: none;
}

.footer-right a:hover {
  color: var(--gray-600);
  text-decoration: underline;
}


/* ══════════════════════════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════════════════════════ */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.font-bold   { font-weight: 700; }
.font-medium { font-weight: 500; }
.text-sm     { font-size: 14px; }
.text-xs     { font-size: 12px; }
.text-muted  { color: var(--gray-500); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.flex  { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none; }


/* ══════════════════════════════════════════════════════════
   USER BADGE — navbar (login)
   ══════════════════════════════════════════════════════════ */
.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: white;
  font-size: 14px;
}
.user-badge-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: white;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.user-badge-name {
  font-weight: 500;
  white-space: nowrap;
}
.user-badge-logout {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 6px;
}
.user-badge-logout:hover {
  background: rgba(255,255,255,0.15);
}
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px);
  padding: 20px;
}
.login-card {
  background: white;
  border-radius: 16px;
  padding: 48px 36px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.08);
  text-align: center;
  max-width: 400px;
  width: 100%;
}
.login-card img {
  height: 56px;
  margin-bottom: 16px;
}
.login-card h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}
.login-card p {
  color: var(--gray-500);
  font-size: 14px;
  margin-bottom: 28px;
}
#googleSignIn {
  display: flex;
  justify-content: center;
}
