/* ==========================================================================
   AJBranch - Authentication & Onboarding Stylesheet (auth.css)
   Oxford Design System · Responsive 2-Column Desktop / Mobile · Anti-FOUC
   ========================================================================== */

.auth-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-app);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.auth-card-container {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 28px 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
  transition: max-width 0.2s ease, padding 0.2s ease;
}

@media (min-width: 600px) {
  .auth-card-container {
    max-width: 520px;
    padding: 32px 30px;
  }
}

.auth-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 540px) {
  .auth-row-2col {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.auth-brand-box {
  text-align: center;
  margin-bottom: 24px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 4px 0 0 0;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  gap: 8px;
}

.auth-tab-btn {
  flex: 1;
  padding: 10px 4px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.auth-tab-btn.active {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
}

/* Encabezados de campo con Badges Requerido / Opcional */
.auth-field-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.auth-tag-badge {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
}

.auth-tag-req {
  background: rgba(6, 182, 212, 0.12);
  color: var(--status-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.auth-tag-opt {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* Wrapper para inputs con botón de ojo integrado */
.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.auth-input-wrapper .form-input {
  padding-right: 42px;
  width: 100%;
}

.auth-pwd-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 6px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  transition: color 0.15s ease;
  z-index: 2;
}

.auth-pwd-toggle-btn:hover {
  color: var(--text-primary);
}

/* Anular colores de autofill / autocompletado del navegador */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active,
input:autofill,
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover, 
.form-input:-webkit-autofill:focus,
.form-input:-webkit-autofill:active,
.form-input:autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
  box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  color: var(--text-primary) !important;
  caret-color: var(--text-primary) !important;
  transition: background-color 5000000s ease-in-out 0s !important;
}

/* Iluminación visual de inputs en tiempo real */
.form-input.input-has-success {
  border-color: var(--status-emerald) !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.22), 0 0 8px rgba(16, 185, 129, 0.15) !important;
  background-color: var(--bg-card) !important;
}

.form-input.input-has-error {
  border-color: var(--status-crimson) !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2) !important;
  background-color: var(--bg-card) !important;
}

/* Feedback en línea para validaciones instantáneas */
.auth-field-feedback {
  font-size: 11px;
  margin-top: 4px;
  min-height: 15px;
  line-height: 1.35;
  display: none;
}

.auth-field-feedback.feedback-error {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--status-crimson);
  font-weight: 600;
}

.auth-field-feedback.feedback-success {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--status-emerald);
  font-weight: 600;
}

.auth-link-text {
  font-size: 11.5px;
  color: var(--accent-gold);
  text-decoration: none;
  font-weight: 600;
}

.auth-link-text:hover {
  text-decoration: underline;
}

.auth-remember-row {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.auth-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.auth-checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-gold);
  cursor: pointer;
  border-radius: 3px;
}

.auth-checkbox-text {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  transition: color 0.15s ease;
}

.auth-checkbox-label:hover .auth-checkbox-text {
  color: var(--text-primary);
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 18px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-subtle);
}

.auth-divider span {
  padding: 0 10px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.auth-alert-box {
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  margin-bottom: 16px;
  line-height: 1.4;
}

.auth-alert-error {
  background: var(--badge-crimson-bg);
  color: var(--status-crimson);
  border: 1px solid var(--status-crimson);
}

.auth-alert-success {
  background: var(--badge-emerald-bg);
  color: var(--status-emerald);
  border: 1px solid var(--status-emerald);
}

/* Card y Checklist de Fortaleza de Contraseña */
.password-rules-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
}

.strength-meter-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.strength-bar-track {
  flex: 1;
  height: 4px;
  background: var(--border-subtle);
  border-radius: 2px;
  overflow: hidden;
}

.strength-bar-fill {
  height: 100%;
  transition: width 0.25s ease, background-color 0.25s ease;
}

.strength-status-text {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.pass-rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
}

.pass-rule-item {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.2s ease;
}

.pass-rule-item .rule-bullet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
}

.pass-rule-item.unfulfilled {
  color: var(--text-muted);
}

.pass-rule-item.unfulfilled .rule-bullet svg {
  stroke: var(--status-crimson);
}

.pass-rule-item.fulfilled {
  color: var(--status-emerald);
  font-weight: 600;
}

.pass-rule-item.fulfilled .rule-bullet svg {
  stroke: var(--status-emerald);
}

/* Modal Emergente de Recuperación & Cambio de Contraseña */
.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;
}

.auth-modal-card {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 22px 20px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4);
  animation: modalFadeIn 0.2s ease-out;
  box-sizing: border-box;
}

@media (max-width: 480px) {
  .auth-modal-overlay {
    padding: 12px 8px;
    align-items: center;
  }
  .auth-modal-card {
    padding: 16px 14px;
    max-height: 88vh;
    max-height: 88dvh;
    border-radius: var(--radius-md);
  }
}

.auth-modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.auth-modal-close-btn:hover {
  color: var(--text-primary);
}

/* Estilos para el Modal de Bienvenida Onboarding (Flujo Progresivo de 2 Pasos) */
.welcome-modal-card {
  max-width: 620px;
  width: 95vw;
  border-top: 3px solid var(--accent-gold);
  border-radius: 0px !important;
}

.welcome-step-tracker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.welcome-tracker-pill {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 0px !important;
  transition: all 0.15s ease;
}

.welcome-tracker-pill.active {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
  background: var(--accent-gold-light);
}

.welcome-tracker-separator {
  width: 14px;
  height: 1px;
  background: var(--border-subtle);
}

.welcome-step-view {
  animation: modalFadeIn 0.2s ease-out;
}

.welcome-badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--badge-gold-bg);
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
  margin: 0 auto;
}

.welcome-features-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 4px;
}

.welcome-feature-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 0px !important;
}

.welcome-feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 0px !important;
  background: rgba(108, 15, 26, 0.1);
  color: var(--accent-crimson);
  margin-top: 2px;
}

[data-theme="dark"] .welcome-feature-icon {
  background: rgba(212, 175, 55, 0.12);
  color: var(--accent-gold);
}

.welcome-feature-body {
  flex: 1;
}

.welcome-feature-title {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.welcome-feature-text {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Acciones en los pasos */
.welcome-step-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  align-items: center;
}

.welcome-btn-skip {
  flex: 1;
  border-radius: 0px !important;
  font-size: 12.5px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.welcome-btn-next {
  flex: 1.25;
  border-radius: 0px !important;
  font-size: 12.5px;
  padding: 10px 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.welcome-step2-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.welcome-btn-back {
  flex: 0 0 auto;
  border-radius: 0px !important;
  font-size: 12px;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.welcome-btn-save {
  flex: 1.5;
  border-radius: 0px !important;
  font-size: 12.5px;
  padding: 10px 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

/* Grupos de personalización rápida */
.welcome-customizer-group {
  margin-top: 10px;
  padding: 9px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 0px !important;
}

.welcome-group-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.welcome-theme-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.welcome-choice-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: 0px !important;
}

.welcome-choice-card:hover {
  border-color: var(--accent-gold);
  background: var(--bg-card-hover);
}

.welcome-choice-card.active {
  border-color: var(--accent-gold);
  background: var(--accent-gold-light);
  box-shadow: var(--glow-gold-subtle);
}

.welcome-choice-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--bg-surface);
  color: var(--accent-gold);
  border: 1px solid var(--border-subtle);
  border-radius: 0px !important;
}

.welcome-choice-content {
  flex: 1;
}

.welcome-choice-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.welcome-choice-desc {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.2;
}

/* Swatches de Color */
.welcome-swatches-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.welcome-swatch-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: 0px !important;
}

.welcome-swatch-item:hover {
  border-color: var(--accent-gold);
}

.welcome-swatch-item.active {
  border-color: var(--accent-gold);
  background: var(--accent-gold-light);
  font-weight: 700;
}

.welcome-swatch-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.welcome-swatch-name {
  font-size: 11.5px;
  color: var(--text-primary);
}

/* Selector de Bordes */
.welcome-radius-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.welcome-radius-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  border-radius: 0px !important;
  transition: all 0.15s ease;
}

.welcome-radius-btn:hover {
  border-color: var(--accent-gold);
}

.welcome-radius-btn.active {
  border-color: var(--accent-gold);
  background: var(--accent-gold-light);
  color: var(--accent-gold);
  font-weight: 700;
}

/* Enlace a Configuración Avanzada */
.welcome-advanced-link-box {
  text-align: center;
  margin-top: 11px;
}

.welcome-advanced-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-gold);
  text-decoration: none;
  transition: opacity 0.15s;
}

.welcome-advanced-link:hover {
  text-decoration: underline;
  opacity: 0.9;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
