/* ==========================================================================
   Dentisti — Pagine di Autenticazione (Login / Registrazione)
   Layout split-screen moderno, animato e dinamico.
   Ispirato ai gestionali della famiglia software29, con palette Dentisti.
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.auth-page {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Struttura split-screen ──────────────────────────────── */
.auth-wrapper {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 100vh;
}

/* ==========================================================================
   PANNELLO BRAND (sinistra)
   ========================================================================== */
.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 5vw, 5rem);
  color: #fff;
  background: linear-gradient(135deg, #0369a1 0%, #0ea5e9 45%, #06b6d4 100%);
  isolation: isolate;
}

/* Sfere luminose animate sullo sfondo del pannello */
.auth-brand::before,
.auth-brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  z-index: -1;
}

.auth-brand::before {
  width: 460px;
  height: 460px;
  top: -140px;
  right: -120px;
  background: radial-gradient(circle at 30% 30%, #7dd3fc, transparent 70%);
  animation: authOrbA 16s ease-in-out infinite;
}

.auth-brand::after {
  width: 520px;
  height: 520px;
  bottom: -180px;
  left: -140px;
  background: radial-gradient(circle at 60% 60%, #22d3ee, transparent 70%);
  animation: authOrbB 20s ease-in-out infinite;
}

/* Griglia decorativa sottile */
.auth-brand-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
}

@keyframes authOrbA {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-40px, 40px) scale(1.12); }
}

@keyframes authOrbB {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(50px, -30px) scale(1.08); }
}

.auth-brand-inner {
  position: relative;
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.6rem;
  color: #fff;
  text-decoration: none;
  margin-bottom: 2.5rem;
}

.auth-logo-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  font-size: 1.5rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  animation: authFloat 5s ease-in-out infinite;
}

@keyframes authFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.auth-brand-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(1.9rem, 3vw, 2.6rem);
  line-height: 1.15;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}

.auth-brand-subtitle {
  font-size: 1.05rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 2.5rem;
}

/* Lista funzionalità (login) */
.auth-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
}

.auth-features li {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 1.02rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
  opacity: 0;
  animation: authSlideIn 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

.auth-features li i {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1.05rem;
}

/* Step numerati (registrazione) */
.auth-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.auth-step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  opacity: 0;
  animation: authSlideIn 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

.auth-step-num {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: #0369a1;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.auth-step-body h4 {
  margin: 0 0 0.25rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
}

.auth-step-body p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
}

@keyframes authSlideIn {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Ritardi sfalsati */
.auth-stagger-1 { animation-delay: 0.15s; }
.auth-stagger-2 { animation-delay: 0.28s; }
.auth-stagger-3 { animation-delay: 0.41s; }
.auth-stagger-4 { animation-delay: 0.54s; }
.auth-stagger-5 { animation-delay: 0.67s; }
.auth-stagger-6 { animation-delay: 0.80s; }

/* ==========================================================================
   PANNELLO FORM (destra)
   ========================================================================== */
.auth-main {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3.5rem);
  background: var(--bg-primary);
  overflow: hidden;
}

/* Blob morbido dietro alla card */
.auth-main::before {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  top: -160px;
  right: -140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.12), transparent 70%);
  animation: authOrbA 18s ease-in-out infinite;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  animation: authCardIn 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes authCardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-card-head {
  margin-bottom: 2rem;
}

.auth-card-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.85rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.4rem;
  color: var(--text-primary);
}

.auth-card-subtitle {
  margin: 0;
  font-size: 0.98rem;
  color: var(--text-secondary);
}

/* Logo mobile (visibile solo quando il pannello brand è nascosto) */
.auth-mobile-logo {
  display: none;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--primary);
  margin-bottom: 1.75rem;
  text-decoration: none;
}

/* ── Campi ───────────────────────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  opacity: 0;
  animation: authFieldIn 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

@keyframes authFieldIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.auth-label .req { color: var(--danger); }

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-wrap > i.auth-input-icon {
  position: absolute;
  left: 14px;
  font-size: 1.05rem;
  color: var(--text-tertiary);
  pointer-events: none;
  transition: color var(--transition-normal);
}

.auth-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  outline: none;
  transition: border-color var(--transition-normal),
              box-shadow var(--transition-normal),
              background var(--transition-normal);
}

.auth-input::placeholder { color: var(--text-tertiary); }

.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.14);
  background: #fff;
}

.auth-input-wrap:focus-within > i.auth-input-icon {
  color: var(--primary);
}

/* Bottone mostra/nascondi password */
.auth-toggle-pass {
  position: absolute;
  right: 8px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: 8px;
  transition: color var(--transition-normal), background var(--transition-normal);
}

.auth-toggle-pass:hover {
  color: var(--primary);
  background: var(--primary-50);
}

/* Riga opzioni (ricordami / password dimenticata) */
.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

.auth-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.auth-check input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
  cursor: pointer;
}

.auth-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition-normal);
}

.auth-link:hover { color: var(--primary-dark); text-decoration: underline; }

/* ── Checkbox discipline / termini ───────────────────────── */
.auth-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.auth-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.auth-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.auth-chip:hover { border-color: var(--primary-300); }

.auth-chip:has(input:checked) {
  background: var(--primary-50);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.auth-terms {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.auth-terms input {
  margin-top: 2px;
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
  flex-shrink: 0;
  cursor: pointer;
}

/* ── Bottone primario con effetto shine ──────────────────── */
.auth-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.95rem 1.25rem;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  background: linear-gradient(120deg, var(--primary-dark), var(--primary) 55%, var(--accent));
  background-size: 180% auto;
  box-shadow: 0 10px 28px rgba(14, 165, 233, 0.35);
  transition: transform var(--transition-spring),
              box-shadow var(--transition-spring),
              background-position var(--transition-slow);
}

.auth-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  background-position: right center;
  box-shadow: 0 16px 38px rgba(14, 165, 233, 0.45);
}

.auth-btn:active:not(:disabled) { transform: translateY(0); }

.auth-btn:disabled { opacity: 0.75; cursor: not-allowed; }

/* Riflesso luminoso che attraversa il bottone */
.auth-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
}

.auth-btn:hover:not(:disabled)::after {
  animation: authShine 0.9s ease;
}

@keyframes authShine {
  from { left: -75%; }
  to   { left: 130%; }
}

.auth-btn .auth-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: authRotate 0.7s linear infinite;
}

@keyframes authRotate { to { transform: rotate(360deg); } }

/* ── Messaggi di stato ───────────────────────────────────── */
.auth-alert {
  display: none;
  align-items: center;
  gap: 0.55rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.88rem;
  font-weight: 500;
  animation: authFieldIn 0.35s ease both;
}

.auth-alert.active { display: flex; }

.auth-alert.error {
  color: #b91c1c;
  background: var(--danger-light);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.auth-alert.success {
  color: #047857;
  background: var(--success-light);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.auth-card.shake { animation: authShake 0.5s ease; }

@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

/* ── Footer card ─────────────────────────────────────────── */
.auth-foot {
  margin-top: 1.75rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.auth-note {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.auth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
  .auth-wrapper { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-mobile-logo { display: inline-flex; }
  .auth-main { min-height: 100vh; }
}

@media (max-width: 480px) {
  .auth-row { grid-template-columns: 1fr; }
  .auth-card-title { font-size: 1.55rem; }
}

/* ── Accessibilità: movimento ridotto ────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .auth-brand::before,
  .auth-brand::after,
  .auth-main::before,
  .auth-logo-icon,
  .auth-features li,
  .auth-step,
  .auth-field,
  .auth-card { animation: none !important; }

  .auth-features li,
  .auth-step,
  .auth-field,
  .auth-card { opacity: 1 !important; transform: none !important; }
}
