/* Schermata di accesso, registrazione e reset della password: la vede solo
   chi non ha ancora fatto login. Proprietari: auth-manager.js e
   utils/auth-email-flows.js. Solo l'app la carica, subito dopo ds-layout.css
   da cui viene (ADR-022 A1). */

/* ===========================================
   AUTENTICAZIONE
   ===========================================
   Una card centrata su una pagina vuota. Il filo di brand in cima e' lo stesso
   segno che portano le sezioni dell'app: la prima schermata deve gia'
   assomigliare a quello che c'e' dopo il login. */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: var(--space-6) var(--space-4);
  background:
    radial-gradient(circle at 15% 12%, var(--brand-50), transparent 55%),
    radial-gradient(circle at 85% 88%, var(--ink-50), transparent 55%),
    var(--surface-page);
}

.auth-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-block);
  width: 100%;
  max-width: var(--container-narrow);
  padding: var(--space-8) var(--space-6) var(--space-6);
  overflow: hidden;
  text-align: center;
  background-color: var(--surface-card);
  border: var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--elevation-3);
}

.auth-card::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 4px;
  background: var(--gradient-hairline);
}

.auth-card__mark {
  width: 56px;
  height: 56px;
}

.auth-card h1 {
  font-size: var(--text-2xl);
}

.auth-card > p {
  margin-top: calc(-1 * var(--space-3));
  font-size: var(--type-small-size);
}

.auth-card .language-selector {
  align-self: center;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--gap-field);
  width: 100%;
  text-align: left;
}

/* Bottone e hint della demo (ADR-018) restano una coppia stretta: senza
   questo, il gap-block di .auth-card li separerebbe come fossero due sezioni
   indipendenti invece che un comando e la sua spiegazione. */
.auth-demo-cta {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}

/* Shown by the auth flow (moved from style.css). Before the :empty rule
   below, which has to win over .show while the message is empty. */
.auth-error.show {
  display: block;
}

.reset-success.show {
  display: block;
}

/* Il messaggio d'errore resta invisibile finche' e' vuoto: un riquadro rosso
   sempre presente insegna a ignorarlo. */
.auth-error:empty {
  display: none;
}

.auth-error {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--type-small-size);
  text-align: left;
  color: var(--danger-text);
  background-color: var(--danger-surface);
  border: 1px solid var(--danger-border);
  border-left-width: 3px;
  border-radius: var(--radius-md);
}

.auth-consent {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  width: 100%;
  font-size: var(--type-small-size);
  line-height: var(--leading-snug);
  text-align: left;
  color: var(--fg-muted);
  cursor: pointer;
}

.auth-consent input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--brand-700);
}

.password-input-wrapper {
  position: relative;
  display: flex;
}

.password-input-wrapper .input {
  padding-right: var(--space-12);
}

/* Il :focus-visible globale alza l'elemento a fuoco perche' l'anello non
   finisca sotto i vicini. Qui il vicino sta DENTRO il campo: alzato, l'input
   copriva l'occhio, e dopo aver scritto la password il tocco andava al campo
   invece che al bottone. L'ordine del DOM basta a tenere l'occhio sopra. */
.password-input-wrapper .input:focus-visible {
  z-index: auto;
}

/* Il comando per mostrare la password: era un quadratino verde acqua senza
   contenuto visibile, perche' l'icona arrivava da uno pseudo-elemento che
   nessuna regola disegnava piu'. Ora e' un occhio, e cambia allo stato premuto. */
.toggle-password {
  position: absolute;
  inset-block: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-target);
  color: var(--fg-subtle);
  border-radius: var(--radius-sm);
  transition: var(--transition-colors);
}

/* L'occhio dello sprite, disegnato con una maschera: il bottone non ha figli
   (il suo nome sta in aria-label) e un'emoji cambierebbe disegno fra sistemi
   operativi e ignorerebbe il colore. */
.toggle-password::before {
  content: "";
  width: 20px;
  height: 20px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.06 12.35a1 1 0 0 1 0-.7 10.75 10.75 0 0 1 19.88 0 1 1 0 0 1 0 .7 10.75 10.75 0 0 1-19.88 0'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.06 12.35a1 1 0 0 1 0-.7 10.75 10.75 0 0 1 19.88 0 1 1 0 0 1 0 .7 10.75 10.75 0 0 1-19.88 0'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.toggle-password:hover {
  color: var(--fg-brand);
}

.toggle-password[aria-pressed="true"]::before,
.toggle-password.is-visible::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.06 12.35a1 1 0 0 1 0-.7 10.75 10.75 0 0 1 19.88 0 1 1 0 0 1 0 .7 10.75 10.75 0 0 1-19.88 0'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M3 3l18 18'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.06 12.35a1 1 0 0 1 0-.7 10.75 10.75 0 0 1 19.88 0 1 1 0 0 1 0 .7 10.75 10.75 0 0 1-19.88 0'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M3 3l18 18'/%3E%3C/svg%3E");
}

.forgot-password-link {
  text-align: center;
  font-size: var(--type-small-size);
}

/* Password reset modal (moved from style.css). */
/* Reset Password Modal Styles */
.reset-password-modal {
  background: var(--surface-card);
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
}

.reset-success {
  background: var(--success-surface);
  border: 1px solid var(--success-surface);
  color: var(--success-text);
  padding: 12px;
  border-radius: 8px;
  margin-top: 15px;
  text-align: center;
}

/* ===========================================
   AVVISO DI VERIFICA EMAIL
   Spostato da style.css (specs/009, Ondata G), poi da ds-layout.css (specs/010).
   =========================================== */
/* La coppia la impone design-tokens.css: --warning-text e' tarato sul proprio
   --warning-surface. Sopra --accent-400 lo stesso testo scendeva a 2.8:1. */
.email-verification-warning {
  background-color: var(--warning-surface);
  border: 2px solid var(--warning-border);
  border-radius: 12px;
  margin: 20px 0;
  padding: 15px;
  box-shadow: var(--elevation-2);
}

.warning-content {
  display: flex;
  align-items: center;
  gap: 15px;
}

.warning-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.warning-text {
  flex: 1;
}

.warning-text strong {
  display: block;
  color: var(--warning-text);
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.verification-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
