/* ── Auth Gate (Login / Register / Forgot Password Modal) ── */
#auth-gate {
  display: none;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 40px 36px;
  border-radius: 20px;
  background: rgba(18, 18, 23, 0.95);
  border: 1px solid var(--glass-border);
}

.auth-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.2s, border-color 0.2s;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-close:hover {
  background: #1a1a1a;
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 36px;
}

.auth-logo-icon {
  color: var(--accent);
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.auth-logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.auth-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ── Form toggle ── */
.auth-form { display: none; }
.auth-form.active { display: block; }

/* ── Fields ── */
.auth-field {
  margin-bottom: 16px;
}

.auth-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.auth-field input,
.auth-field select {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

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

.auth-field input:focus,
.auth-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239898b4' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.auth-field select option {
  background: #1a1a24;
  color: var(--text-main);
}

/* ── Password toggle (hold to reveal) ── */
.auth-password-wrap {
  position: relative;
}

.auth-password-wrap input {
  width: 100%;
  padding-right: 42px;
}

.auth-pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
  user-select: none;
}

.auth-pw-toggle:hover {
  color: var(--text-dim);
}

.auth-hint {
  font-weight: 400;
  color: var(--text-faint);
  font-size: 0.75rem;
}

/* ── Error message ──
   Banner diferenciado: visible solo cuando hay contenido.
   :empty → margin/padding 0 (no genera saltos de layout cuando aparece/desaparece).
   :not(:empty) → fondo rojo translúcido + borde sutil + centrado + espaciado.
   Paleta `error` autorizada en .rules/manual_ux_marca.md §2.4. */
.auth-error {
  color: var(--error);
  font-size: 0.82rem;
  text-align: center;
  margin: 12px 0;
  line-height: 1.4;
}
.auth-error:empty {
  margin: 0;
  min-height: 0;
}
.auth-error:not(:empty) {
  background: rgba(248, 113, 113, 0.10);
  border: 1px solid rgba(248, 113, 113, 0.30);
  border-radius: 8px;
  padding: 10px 14px;
}

/* ── Buttons ── */
.auth-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.auth-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

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

.auth-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.auth-btn.secondary {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-dim);
  box-shadow: none;
}

.auth-btn.secondary:hover {
  background: var(--glass-hover);
  color: var(--text-main);
}

/* ── Switch link ── */
.auth-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* ── Forgot password link ── */
.auth-forgot-link {
  text-align: center;
  margin-top: 8px;
}
.auth-forgot-link a {
  color: #a78bfa;
  font-size: 0.8rem;
  text-decoration: none;
}
.auth-forgot-link a:hover {
  color: #c4b5fd;
  text-decoration: underline;
}
.auth-forgot-back {
  text-align: center;
  margin-top: 12px;
}
.auth-forgot-back a {
  color: #8b949e;
  font-size: 0.8rem;
  text-decoration: none;
}
.auth-forgot-back a:hover {
  color: #e6edf3;
}
.auth-modal-desc {
  font-size: 0.84rem;
  color: var(--text-dim);
  margin-bottom: 16px;
  text-align: center;
  line-height: 1.5;
}
.auth-modal-desc strong {
  color: var(--accent, #a78bfa);
  font-weight: 600;
}

/* ── Forgot password form layout ── */
#auth-form-forgot .auth-title {
  text-align: center;
  margin-bottom: 8px;
}
#auth-form-forgot .auth-field {
  margin-bottom: 16px;
}
#auth-form-forgot .auth-field label {
  margin-bottom: 6px;
  display: block;
}
#auth-form-forgot .auth-btn {
  margin-top: 8px;
}
#auth-form-forgot .auth-error {
  text-align: center;
  margin-bottom: 8px;
}

/* ── Privacy link in auth modal ── */
.auth-privacy-link {
  text-align: center;
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0.7;
}
.auth-privacy-link a {
  color: var(--text-dim);
  text-decoration: none;
}
.auth-privacy-link a:hover {
  color: var(--accent);
  text-decoration: underline;
}
