/* ============================================
   AUTH.CSS — Login / Registrazione
============================================ */

/* === BACKGROUND === */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  top: -200px;
  left: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* === LAYOUT === */
.auth-container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* === BRAND PANEL === */
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--bg-base) 0%, var(--bg-card) 100%);
}

.auth-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(0, 212, 255, 0.06) 0%, transparent 55%);
  border-right: 1px solid var(--border-card);
}

.brand-inner {
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo img {
  height: 256px;
  width: auto;
}

.brand-logo span {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-brand h1 {
  font-size: clamp(2rem, 3.5vw, 2.8rem);
  line-height: 1.15;
  color: var(--text-primary);
}

.auth-brand p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 380px;
}

/* STATS */
.brand-stats {
  display: flex;
  gap: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* === AUTH PANEL === */
.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--bg-secondary);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-card);
}

/* === TABS === */
.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 28px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
}

.auth-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
}

/* === FORM === */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-form.hidden { display: none; }

.form-header {
  margin-bottom: 4px;
}

.form-header h3 {
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.form-header p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* PASSWORD TOGGLE */
.input-wrapper {
  position: relative;
}

.input-wrapper .input-field {
  padding-right: 44px;
}

.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition-fast);
}

.toggle-pw:hover { color: var(--neon-cyan); }

/* FASE 25 — l'icona segue lo stato aria-pressed:
   occhio = password nascosta (premi per mostrare),
   occhio barrato = password visibile (premi per nascondere) */
.toggle-pw svg { display: block; }
.toggle-pw .icon-eye-off { display: none; }
.toggle-pw[aria-pressed="true"] .icon-eye { display: none; }
.toggle-pw[aria-pressed="true"] .icon-eye-off { display: block; }

/* PASSWORD STRENGTH */
.pw-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.pw-bar {
  flex: 1;
  height: 3px;
  background: var(--border-subtle);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.pw-bar::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: var(--strength, 0%);
  background: var(--strength-color, var(--neon-cyan));
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
}

.pw-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 50px;
}

/* CHECKBOX */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--neon-cyan);
  width: 14px;
  height: 14px;
}

.forgot-link {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.forgot-link:hover { color: var(--neon-cyan); }

/* FULL WIDTH */
.full-width { width: 100%; }

/* ERROR — animato: espansione + shake discreto (FASE 16) */
.error-msg {
  font-size: 0.78rem;
  color: var(--neon-red);
  background: var(--danger-dim);
  border: 1px solid var(--neon-red);
  border-radius: 6px;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  border-width: 0;
  transition: all var(--transition-base);
}

.error-msg.visible {
  padding: 10px 14px;
  max-height: 80px;
  border-width: 1px;
  animation: shakeX 0.3s ease;
}

/* === STEP INDICATOR === */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 4px;
}

.step {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--transition-base);
}

.step.active {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
}

.step.done {
  background: var(--neon-cyan);
  border-color: var(--neon-cyan);
  color: var(--bg-primary);
}

.step-line {
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
  transition: background var(--transition-base);
}

.step-line.active {
  background: var(--neon-cyan);
}

.step-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.reg-step {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.reg-step.hidden { display: none; }

/* === PIANO === */
.plan-card {
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition-base);
}

.plan-card.selected {
  border-color: var(--border-active);
  background: var(--neon-cyan-dim);
  box-shadow: var(--shadow-neon);
}

.plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.plan-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.plan-price {
  margin-bottom: 16px;
}

.price-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
}

.price-period {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plan-features li {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.plan-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 10px 14px;
  background: var(--bg-card-2);
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.plan-note svg { flex-shrink: 0; margin-top: 2px; }

/* === PAGAMENTO === */
.payment-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.payment-mock-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.secure-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--neon-green);
  opacity: 0.8;
}

/* BTN ROW */
.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-row .btn:first-child { flex-shrink: 0; }
.btn-row .btn:last-child  { flex: 1; min-width: 0; white-space: normal; text-align: center; font-size: 0.82rem; }

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .auth-container {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    display: none;
  }

  .auth-panel {
    padding: 24px 16px;
    min-height: 100vh;
  }
}

/* === FASE 3 — RESPONSIVE === */
@media (max-width: 767px) {
  /* Pannello decorativo nascosto, form a tutta larghezza */
  .auth-brand { display: none; }

  .auth-panel {
    width: 100%;
    padding: 24px 16px;
    min-height: 100vh;
  }

  .auth-card {
    max-width: 100%;
    padding: 24px 20px;
    box-shadow: none;
  }

  /* Form: 1 colonna */
  .form-grid { grid-template-columns: 1fr !important; }
  .form-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  /* Input full width + 16px per evitare zoom iOS */
  .auth-form .input-field,
  .auth-card .input-field,
  .auth-form select {
    width: 100%;
    font-size: 16px;
  }

  /* Bottoni: a tutta larghezza */
  .auth-form .btn,
  .btn.full-width {
    width: 100%;
  }

  .btn-row {
    flex-direction: column;
  }
  .btn-row .btn { width: 100%; }
}

/* ═══════════════════════════════════════════════
   FASE 16 — Redesign login: hero curato + micro-animazioni
   (solo presentazione: nessun selettore esistente rimosso)
═══════════════════════════════════════════════ */

/* Aurora morbida dietro al pannello brand */
.auth-brand::after {
  content: '';
  position: absolute;
  bottom: -180px;
  right: -180px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--node-builder-dim) 0%, transparent 65%);
  pointer-events: none;
}

/* Entrata scaglionata del pannello brand */
.brand-inner > * {
  animation: fadeInUp 0.5s var(--ease-out) backwards;
}
.brand-inner > *:nth-child(1) { animation-delay: 0.05s; }
.brand-inner > *:nth-child(2) { animation-delay: 0.12s; }
.brand-inner > *:nth-child(3) { animation-delay: 0.19s; }
.brand-inner > *:nth-child(4) { animation-delay: 0.26s; }
.brand-inner > *:nth-child(5) { animation-delay: 0.33s; }

/* Card auth: entrata morbida (sostituisce il solo fadeInUp) */
.auth-card {
  animation: scaleIn 0.35s var(--ease-out);
}

/* Visual di rete (SVG decorativo, placeholder finché non
   arrivano gli asset brand generati da Cowork) */
.brand-visual {
  width: 100%;
  max-width: 380px;
  opacity: 0.9;
}
.brand-visual .bv-line { stroke: var(--border-active); }
.brand-visual .bv-node { fill: var(--neon-cyan-dim); stroke: var(--neon-cyan); }
.brand-visual .bv-node-builder { fill: var(--node-builder-dim); stroke: var(--node-builder); }

/* Logo brand: piccola elevazione al passaggio */
.brand-logo img {
  border-radius: 0;
  box-shadow: none;
  transition: transform var(--transition-base);
}
.brand-logo:hover img {
  transform: translateY(-2px);
}

/* Stat del brand: cifre in font display */
.stat-value { font-family: var(--font-display); }

/* Successo step registrazione: spunta animata */
.step.done {
  animation: scaleIn 0.25s var(--ease-out);
}

/* Tab auth: indicatore più morbido */
.auth-tab { cursor: pointer; }
.auth-tab:hover:not(.active) { color: var(--text-secondary); }
