/* =========================================================
   Deturnos — auth.css
   Login y recuperación de contraseña (sistema visual v1).
   Layout "card centrada sobre fondo claro" (mockup C).
   Usa los tokens de deturnos-tokens.css.
   ========================================================= */

@view-transition { navigation: auto; }

body.dt-auth {
  margin: 0;
  min-height: 100vh;
  background: var(--dt-bg);
  color: var(--dt-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 48px 16px 24px;
  box-sizing: border-box;
}
body.dt-auth .site-footer { display: none; }

.dt-auth__brand { display: inline-flex; align-items: center; gap: 10px; color: var(--dt-text); text-decoration: none; }
.dt-auth__brand:hover { color: var(--dt-text); }
.dt-auth__brand span { font-size: 22px; font-weight: 800; letter-spacing: -0.045em; line-height: 1; }

.dt-auth__card {
  width: 100%;
  max-width: 360px;
  box-sizing: border-box;
  background: var(--dt-surface);
  border: 1px solid var(--dt-border);
  border-radius: var(--dt-radius-md);
  box-shadow: var(--dt-shadow-sm);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: dt-auth-in .35s ease both;
}
@keyframes dt-auth-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .dt-auth__card { animation: none; } }

.dt-auth__card form { display: flex; flex-direction: column; gap: 16px; margin: 0; }
.dt-auth__head { display: flex; flex-direction: column; gap: 4px; }
.dt-auth__title { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: var(--dt-text); text-wrap: balance; }
.dt-auth__sub { margin: 0; color: var(--dt-text-muted); }
.dt-auth__text { margin: 0; color: var(--dt-text-muted); line-height: 1.55; }

/* Campos */
.dt-auth-field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.dt-auth-field__row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.dt-auth-field label { margin: 0; font-weight: 700; font-size: var(--dt-fs-small); color: var(--dt-text); }
.dt-auth-field .dt-input { width: 100%; box-sizing: border-box; height: var(--dt-control-h); padding: 0 12px; border-radius: var(--dt-radius-sm); font-size: var(--dt-fs-body); }
.dt-auth-field .dt-input:focus { border: 2px solid var(--dt-color-primary); padding: 0 11px; box-shadow: 0 0 0 4px var(--dt-color-primary-soft); }
.dt-auth-field__error { color: var(--dt-danger-text); font-size: var(--dt-fs-caption); font-weight: 600; }

.dt-pwd { position: relative; display: flex; }
.dt-auth-field .dt-pwd .dt-input { padding-right: 48px; }
.dt-pwd__toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: transparent; color: var(--dt-text-muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.dt-pwd__toggle:hover { background: var(--dt-surface-2); color: var(--dt-text); }

.dt-auth__link { font-size: var(--dt-fs-small); font-weight: 700; text-decoration: none; }
.dt-auth__check { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--dt-ink-700); font-weight: 600; cursor: pointer; }
.dt-auth__check input { width: 16px; height: 16px; margin: 0; accent-color: var(--dt-color-primary); }

/* Botones */
.dt-auth .dt-btn { width: 100%; justify-content: center; }
.dt-auth .dt-btn--lg { height: 40px; font-size: 13px; }
.dt-auth .dt-btn { position: relative; }
.dt-auth .dt-btn-spinner {
  display: none; position: absolute; top: 50%; left: 50%;
  width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%;
  animation: dt-auth-spin .6s linear infinite;
}
.dt-auth .dt-btn.is-loading .dt-btn-text { opacity: 0; }
.dt-auth .dt-btn.is-loading .dt-btn-spinner { display: block; }
@keyframes dt-auth-spin { to { transform: rotate(360deg); } }

.dt-auth__divider { display: flex; align-items: center; gap: 12px; color: var(--dt-ink-500); font-size: var(--dt-fs-caption); font-weight: 700; }
.dt-auth__divider::before, .dt-auth__divider::after { content: ""; flex: 1; height: 1px; background: var(--dt-border); }
.dt-auth__status:empty { display: none; }
.dt-auth__status { min-height: 18px; margin: -8px 0 0; font-size: var(--dt-fs-caption); text-align: center; color: var(--dt-text-muted); }
.dt-auth__status.is-error { color: var(--dt-danger-text); }

/* Avisos: el ícono acompaña al color */
.dt-auth__alert {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 14px; border-radius: var(--dt-radius-sm);
  font-size: var(--dt-fs-small); line-height: 1.45;
}
.dt-auth__alert .dt-icon { font-size: 18px; flex: none; }
.dt-auth__alert--error { background: var(--dt-danger-bg); color: var(--dt-danger-text); border: 1px solid #F3B4B5; }
.dt-auth__alert--warn  { background: var(--dt-warning-bg); color: var(--dt-warning-text); border: 1px solid #F5D49A; }
.dt-auth__alert a { color: inherit; font-weight: 700; text-decoration: underline; }

/* Estados de confirmación (mail enviado, contraseña cambiada) */
.dt-auth__icon {
  width: 48px; height: 48px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--dt-color-primary-tint); color: var(--dt-color-primary);
}
.dt-auth__icon .dt-icon { font-size: 24px; }
.dt-auth__icon--ok { background: var(--dt-success-bg); color: var(--dt-success); }
.dt-auth__icon--warn { background: var(--dt-warning-bg); color: var(--dt-warning-text); }

.dt-auth__back { display: inline-flex; align-items: center; gap: 4px; align-self: center; font-size: var(--dt-fs-small); font-weight: 700; text-decoration: none; }
.dt-auth__back .dt-icon { font-size: 18px; }

.dt-auth__legal { margin: 0; font-size: var(--dt-fs-caption); color: var(--dt-text-muted); text-align: center; }
.dt-auth__legal a { color: var(--dt-text-muted); }
.dt-auth__legal a:hover { color: var(--dt-text); }

/* Transición de salida al ingresar */
.dt-auth__overlay { position: fixed; inset: 0; background: var(--dt-bg); opacity: 0; pointer-events: none; z-index: 9999; transition: opacity .3s ease; }
.dt-auth__overlay.show { opacity: 1; pointer-events: auto; }

@media (max-width: 480px) {
  body.dt-auth { justify-content: flex-start; padding-top: 56px; }
  .dt-auth__card { padding: 24px 20px; }
  .dt-auth__title { font-size: 22px; }
  .dt-auth-field .dt-input { height: 44px; font-size: 16px; }  /* 16px: iOS no hace zoom al enfocar */
  .dt-auth .dt-btn--lg { height: 44px; font-size: 14px; }
  .dt-pwd__toggle { width: 44px; height: 44px; right: 2px; }
  .dt-auth__check { min-height: 44px; }
}

/* Bienvenida: card más ancha con los pasos del onboarding */
.dt-auth__card--wide { max-width: 440px; }
.dt-auth__steps { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.dt-auth__steps li { display: flex; align-items: flex-start; gap: 12px; }
.dt-auth__step-num {
  width: 26px; height: 26px; flex: none; border-radius: 999px;
  background: var(--dt-color-primary-tint); color: var(--dt-blue-700);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--dt-fs-small); font-weight: 800;
}
.dt-auth__step-title { margin: 2px 0 0; font-weight: 700; color: var(--dt-text); }
.dt-auth__step-desc { margin: 2px 0 0; font-size: var(--dt-fs-small); color: var(--dt-text-muted); line-height: 1.45; }
.dt-auth__step-desc strong { white-space: nowrap; color: var(--dt-text); }
