/* Miglioramenti per accessibilità AAA - Palette chiara */
body {
  font-family: freightsans_prolight, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  letter-spacing: -.16px;
  font-variant: lining-nums;
}

/* Font personalizzato Erickson per tutti i testi */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
p, span, label, a, button,
.form-control, .form-floating label,
.btn, .help-links, .footer {
  font-family: freightsans_prolight, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.main-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.8);
  border: 1px solid #e2e8f0;
  max-width: 400px;
  width: 100%;
  backdrop-filter: blur(10px);
}

.logo-container {
  text-align: center;
  margin-bottom: 2rem;
}

.logo {
  width: 80px;
  height: 80px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  font-weight: bold;
}

.form-floating label {
  color: #475569;
}

.form-floating .form-control:focus ~ label {
  color: rgb(181, 22, 26);
}

.form-control:focus {
  border-color: rgb(181, 22, 26);
  box-shadow: 0 0 0 0.2rem rgba(181, 22, 26, 0.15);
  background-color: #ffffff;
}

.btn-primary {
  background: linear-gradient(135deg, rgb(181, 22, 26) 0%, rgb(150, 18, 22) 100%);
  border: none;
  border-radius: 0.75rem;
  padding: 0.875rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 14px 0 rgba(181, 22, 26, 0.25);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px -5px rgba(181, 22, 26, 0.4);
  background: linear-gradient(135deg, rgb(150, 18, 22) 0%, rgb(120, 15, 18) 100%);
  color: white;
}

.btn-primary:focus {
  box-shadow: 0 0 0 0.2rem rgba(181, 22, 26, 0.4);
  color: white;
}

.help-links {
  text-align: center;
  margin-top: 1.5rem;
}

.help-links a {
  color: rgb(181, 22, 26);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.3s ease;
  padding: 0.5rem 0.25rem;
  border-radius: 0.5rem;
}

.help-links a:hover {
  color: rgb(150, 18, 22);
  text-decoration: underline;
  background-color: rgba(181, 22, 26, 0.05);
}

.help-links a:focus {
  outline: 2px solid rgb(181, 22, 26);
  outline-offset: 2px;
  background-color: rgba(181, 22, 26, 0.1);
}

.register-link {
  border-top: 1px solid #e2e8f0;
  padding-top: 1rem;
  padding: 1rem 0.5rem 0.5rem;
  font-size: 0.9rem;
  color: rgb(181, 22, 26) !important;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
}

.register-link:hover {
  color: rgb(150, 18, 22) !important;
  text-decoration: underline;
  background-color: rgba(181, 22, 26, 0.05);
}

.register-link strong {
  font-weight: 600;
}

.footer {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  color: #475569;
  padding: 2rem 0;
  text-align: center;
  font-size: 0.875rem;
  border-top: 1px solid #e2e8f0;
}

.footer a {
  color: #64748b;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer a:hover {
  color: rgb(181, 22, 26);
}

/* Miglioramenti per contrasto AAA */
.text-muted {
  color: #64748b !important;
}

/* Miglioramenti per form elements */
.form-control {
  border-color: #e2e8f0;
  background-color: #f8fafc;
  transition: all 0.3s ease;
}

.form-control:focus {
  background-color: #ffffff;
}

.form-check-input:checked {
  background-color: rgb(181, 22, 26);
  border-color: rgb(181, 22, 26);
}

.form-check-input:focus {
  border-color: rgb(181, 22, 26);
  box-shadow: 0 0 0 0.2rem rgba(181, 22, 26, 0.15);
}

/* Miglioramenti per titoli */
.logo-container h1 {
  color: #1e293b;
  font-weight: 700;
}

/* Focus indicator per accessibilità */
.form-control:focus,
.btn:focus,
a:focus {
  outline: 2px solid rgb(181, 22, 26);
  outline-offset: 2px;
}

/* Stili per le icone Bootstrap */
.help-links .bi,
.register-link .bi,
.footer .bi {
  color: inherit;
}

.help-links a .bi {
  color: rgb(181, 22, 26);
}

.register-link .bi {
  color: rgb(181, 22, 26);
}

/* DARK MODE SUPPORT */
@media (prefers-color-scheme: dark) {
  /* Background principale */
  body {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #404040 100%);
    color: #e2e8f0;
  }

  /* Card principale */
  .login-card {
    background: linear-gradient(145deg, #2d2d2d 0%, #1a1a1a 100%);
    border: 1px solid #404040;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5),
      0 0 0 1px rgba(255, 255, 255, 0.1);
  }

  /* Testi */
  .text-muted {
    color: #94a3b8 !important;
  }

  .text-secondary {
    color: #94a3b8 !important;
  }

  .logo-container h1,
  .logo-container h2 {
    color: #f1f5f9 !important;
  }

  /* Form elements */
  .form-control {
    background-color: #374151;
    border-color: #4b5563;
    color: #f9fafb;
  }

  .form-control:focus {
    background-color: #4b5563;
    border-color: rgb(181, 22, 26);
    color: #f9fafb;
  }

  .form-floating label {
    color: #d1d5db;
  }

  .form-floating .form-control:focus ~ label {
    color: rgb(181, 22, 26);
  }

  .form-check-input {
    background-color: #374151;
    border-color: #4b5563;
  }

  .form-check-input:checked {
    background-color: rgb(181, 22, 26);
    border-color: rgb(181, 22, 26);
  }

  .form-check-label {
    color: #d1d5db;
  }

  /* Password rules */
  .password-rules {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
  }

  .password-rules h4 {
    color: #d1d5db;
  }

  .password-rule {
    color: #9ca3af;
  }

  .password-rule.valid {
    color: #34d399;
  }

  .password-rule.invalid {
    color: #f87171;
  }

  /* Info box */
  .info-box {
    background: rgba(13, 110, 253, 0.15);
    border: 1px solid rgba(13, 110, 253, 0.4);
  }

  .info-box .text-primary {
    color: #60a5fa !important;
  }

  /* Footer */
  .footer {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: #9ca3af;
    border-top: 1px solid #374151;
  }

  .footer a {
    color: #d1d5db;
  }

  .footer a:hover {
    color: rgb(181, 22, 26);
  }

  /* Link di aiuto */
  .help-links a {
    color: rgb(181, 22, 26);
  }

  .help-links a:hover {
    background-color: rgba(181, 22, 26, 0.1);
    color: rgb(220, 50, 54);
  }

  .register-link {
    border-top: 1px solid #374151;
    color: rgb(181, 22, 26) !important;
  }

  .register-link:hover {
    background-color: rgba(181, 22, 26, 0.1);
    color: rgb(220, 50, 54) !important;
  }

  /* Bottoni outline per dark mode */
  .btn-outline-primary {
    color: rgb(181, 22, 26);
    border-color: rgb(181, 22, 26);
  }

  .btn-outline-primary:hover {
    background-color: rgb(181, 22, 26);
    border-color: rgb(181, 22, 26);
    color: white;
  }

  .btn-outline-secondary {
    color: #9ca3af;
    border-color: #6b7280;
  }

  .btn-outline-secondary:hover {
    background-color: #6b7280;
    border-color: #6b7280;
    color: white;
  }

  .btn-outline-dark {
    color: #d1d5db;
    border-color: #9ca3af;
  }

  .btn-outline-dark:hover {
    background-color: #374151;
    border-color: #374151;
    color: white;
  }

  /* Tabelle */
  .table {
    color: #e5e7eb;
  }

  .table-light {
    background-color: #374151;
  }

  .table th {
    border-top: 2px solid rgb(181, 22, 26);
    color: #d1d5db;
    background-color: #374151;
  }

  .table td {
    border-color: #4b5563;
    background-color: #1f2937;
  }

  .table code {
    background-color: rgba(181, 22, 26, 0.2);
    color: #fca5a5;
  }

  /* Privacy content */
  .privacy-content p,
  .privacy-content li {
    color: #d1d5db;
  }

  .privacy-content strong {
    color: #f9fafb;
  }

  .privacy-content a {
    color: rgb(181, 22, 26);
  }

  .privacy-content a:hover {
    color: rgb(220, 50, 54);
  }

  /* Alert success per dark mode */
  .alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #a7f3d0;
  }

  .alert-success .bi-check-circle-fill {
    color: #34d399;
  }

  /* Focus indicators per dark mode */
  .form-control:focus,
  .btn:focus,
  a:focus {
    outline: 2px solid rgb(181, 22, 26);
    outline-offset: 2px;
  }

  /* Icone */
  .help-links a .bi,
  .register-link .bi {
    color: rgb(181, 22, 26);
  }

  /* Skip link per dark mode */
  .skip-link {
    background: #374151;
    color: #f9fafb;
  }

  /* Privacy list */
  .privacy-list li {
    color: #d1d5db;
  }

  /* Text lead */
  .lead {
    color: #e5e7eb;
  }

  /* Homepage specific dark mode */
  .text-center.mb-4 strong {
    color: #f9fafb;
  }

  /* Homepage info caratteristiche */
  .info-box h4,
  .info-box .h6 {
    color: #f9fafb;
  }

  .info-box .text-success {
    color: #34d399 !important;
  }

  .list-unstyled li {
    color: #d1d5db;
  }
}
