/* ============================================================
   FAST Confsal — Votazioni Congressuali
   app.css — Variabili globali, reset, tipografia, utilities
   ============================================================ */

/* Tema scuro (default) */
:root, [data-theme="dark"] {
  --bg:          #0F1419;
  --surface:     #1A2029;
  --surface-alt: #1E2733;
  --border:      #2E3A48;
  --text:        #E8ECF1;
  --text-muted:  #8899AA;
  --text-dim:    #556677;
  --accent:      #3B82F6;
  --accent-hover:#2563EB;
  --success:     #10B981;
  --success-bg:  #0F2922;
  --error:       #EF4444;
  --error-bg:    #2A1215;
  --warning:     #F59E0B;
  --warning-bg:  #2A2210;
  --radius:      8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --shadow:      0 4px 24px rgba(0,0,0,0.3);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.2);
  --transition:  all 0.2s ease;
  --font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:   'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* Tema chiaro */
[data-theme="light"] {
  --bg:          #F0F2F5;
  --surface:     #FFFFFF;
  --surface-alt: #F7F8FA;
  --border:      #D8DCE2;
  --text:        #1A1D23;
  --text-muted:  #6B7280;
  --text-dim:    #9CA3AF;
  --accent:      #2563EB;
  --accent-hover:#1D4ED8;
  --success:     #059669;
  --success-bg:  #ECFDF5;
  --error:       #DC2626;
  --error-bg:    #FEF2F2;
  --warning:     #D97706;
  --warning-bg:  #FFFBEB;
  --shadow:      0 4px 24px rgba(0,0,0,0.08);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.05);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; height: auto; }

/* Tipografia */
h1 { font-size: 1.625rem; font-weight: 700; line-height: 1.3; }
h2 { font-size: 1.25rem; font-weight: 600; line-height: 1.35; }
h3 { font-size: 1.1rem; font-weight: 600; line-height: 1.4; }

/* Form globali */
label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 5px;
}

input, select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text);
  font-size: 0.9375rem;
  font-family: var(--font);
  outline: none;
  transition: var(--transition);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
select { cursor: pointer; }

input.readonly {
  background: var(--bg);
  color: var(--success);
  border-color: var(--success);
  cursor: not-allowed;
  font-weight: 600;
}

/* Pulsanti */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary   { background: var(--accent);  color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #059669; }

.btn-danger    { background: var(--error);   color: #fff; }
.btn-danger:hover:not(:disabled) { background: #DC2626; }

.btn-ghost     { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface); color: var(--text); }

.btn-lg { padding: 16px 32px; font-size: 1rem; font-weight: 700; letter-spacing: 0.5px; }
.btn-sm { padding: 8px 16px; font-size: 0.8125rem; }
.btn-block { width: 100%; }

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.badge-error   { background: var(--error-bg);   color: var(--error);   border: 1px solid rgba(239,68,68,0.3); }
.badge-info    { background: rgba(59,130,246,0.1); color: var(--accent); border: 1px solid rgba(59,130,246,0.3); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-header {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 16px;
}
.alert-error   { background: var(--error-bg);   border: 1px solid var(--error);   color: var(--error); }
.alert-success { background: var(--success-bg); border: 1px solid var(--success); color: var(--success); }
.alert-warning { background: var(--warning-bg); border: 1px solid var(--warning); color: var(--warning); }

/* Layout helpers */
.row  { display: flex; gap: 12px; }
.row > * { flex: 1; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-error   { color: var(--error); }
.hidden { display: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Responsive */
@media (max-width: 640px) {
  .row { flex-direction: column; gap: 0; }
  h1 { font-size: 1.375rem; }
}
