/* ─────────────────────────────────────────────────────────────────────────
   LaCode Pagos — Auth (login/registro)
   Un solo acento (--pg-purple, azul marca). Motion motivado: feedback de
   validación, transición de tabs, estado de carga. Todo con reduced-motion.
───────────────────────────────────────────────────────────────────────── */

.pg-authpage {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  background: var(--pg-bg);
  position: relative;
  overflow: hidden;
}

/* ─── Ambient backdrop (sutil, no aurora ruidosa) ─── */
.pg-auth-ambient {
  position: absolute; inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.pg-auth-ambient__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.16;
  background: radial-gradient(circle, var(--pg-purple) 0%, transparent 70%);
}
.pg-auth-ambient__glow--1 { width: 520px; height: 520px; top: -180px; left: -140px; }
.pg-auth-ambient__glow--2 { width: 420px; height: 420px; bottom: -160px; left: 30%; opacity: 0.10; }

@media (prefers-reduced-motion: no-preference) {
  .pg-auth-ambient__glow { animation: pg-glow-drift 22s ease-in-out infinite alternate; }
  .pg-auth-ambient__glow--2 { animation-delay: -9s; }
}
@keyframes pg-glow-drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(24px, -16px) scale(1.06); }
  100% { transform: translate(-16px, 20px) scale(0.96); }
}

/* ─── Panels ─── */
.pg-authpage__panel {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px 64px;
}

.pg-authpage__panel--form {
  max-width: 620px;
}

.pg-authpage__panel--visual {
  max-width: none;
  background: linear-gradient(165deg, var(--pg-surface-2) 0%, #EAEEFB 100%);
  align-items: center;
  border-radius: 28px 0 0 28px;
  margin: 18px 18px 18px 0;
  transition: border-radius 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Mirror mode: panels swap sides on signup ─── */
.pg-authpage {
  transition: flex-direction 0s;
}
.pg-authpage.is-signup {
  flex-direction: row-reverse;
}
.pg-authpage.is-signup .pg-authpage__panel--visual {
  border-radius: 0 28px 28px 0;
  margin: 18px 0 18px 18px;
}
@media (prefers-reduced-motion: reduce) {
  .pg-authpage__panel--visual { transition: none; }
}

.pg-authform {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

/* ─── Tabs with sliding pill ─── */
.pg-tabs {
  position: relative;
  display: inline-flex;
  background: var(--pg-surface-2);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 32px;
}
.pg-tab {
  position: relative;
  z-index: 1;
  border: none;
  background: transparent;
  padding: 9px 22px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--pg-muted);
  cursor: pointer;
  transition: color 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.pg-tab.active { color: #fff; }

.pg-tab-indicator {
  position: absolute;
  top: 4px; bottom: 4px; left: 4px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--pg-purple) 0%, var(--pg-purple-light) 100%);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1), width 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (prefers-reduced-motion: reduce) {
  .pg-tab-indicator { transition: none; }
}

/* ─── View switch (crossfade + slide, no display:none jump) ─── */
.pg-auth-view {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}
.pg-auth-view > * { grid-area: 1 / 1; }

.pg-auth-panel {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1), transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
.pg-auth-panel.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
@media (prefers-reduced-motion: reduce) {
  .pg-auth-panel { transition: opacity 0.15s linear; transform: none; }
}

.pg-auth-title {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  line-height: 1.15;
  color: var(--pg-text);
  margin-bottom: 8px;
}
.pg-auth-subtitle { color: var(--pg-muted); font-size: 0.92rem; margin-bottom: 28px; }

/* ─── Floating-label fields ─── */
.pg-ffield {
  position: relative;
  margin-bottom: 22px;
}

.pg-ffield__input {
  width: 100%;
  background: var(--pg-surface);
  border: 1.5px solid var(--pg-border);
  border-radius: 12px;
  color: var(--pg-text);
  font-family: inherit;
  font-size: 0.96rem;
  padding: 22px 16px 10px 44px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.pg-ffield__input::placeholder { color: transparent; }

.pg-ffield__input:hover:not(:focus) { border-color: var(--pg-border-hover); }

.pg-ffield__icon {
  position: absolute;
  left: 15px; top: 50%;
  transform: translateY(-50%);
  color: var(--pg-muted);
  pointer-events: none;
  display: flex;
  transition: color 0.2s ease;
}
.pg-ffield__icon svg { width: 18px; height: 18px; }

.pg-ffield__label {
  position: absolute;
  left: 44px; top: 17px;
  font-size: 0.96rem;
  color: var(--pg-muted);
  pointer-events: none;
  transform-origin: left top;
  transition: top 0.18s cubic-bezier(0.4, 0, 0.2, 1), font-size 0.18s ease, color 0.18s ease;
}

.pg-ffield__input:focus,
.pg-ffield__input:not(:placeholder-shown) {
  border-color: var(--pg-purple);
  background: var(--pg-surface);
  box-shadow: 0 0 0 4px var(--pg-glow, rgba(37, 99, 235, 0.14));
}

.pg-ffield__input:focus ~ .pg-ffield__icon,
.pg-ffield__input:not(:placeholder-shown) ~ .pg-ffield__icon {
  color: var(--pg-purple);
}

.pg-ffield__input:focus ~ .pg-ffield__label,
.pg-ffield__input:not(:placeholder-shown) ~ .pg-ffield__label {
  top: 8px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pg-purple);
}

.pg-ffield__toggle {
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: var(--pg-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  transition: color 0.2s ease;
}
.pg-ffield__toggle:hover { color: var(--pg-purple); }
.pg-ffield__toggle svg { width: 18px; height: 18px; }

/* Phone: prefix + number */
.pg-phone-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.pg-phone-prefix {
  flex-shrink: 0;
  width: 106px;
  height: 54px;
  background: var(--pg-surface);
  border: 1.5px solid var(--pg-border);
  border-radius: 12px;
  color: var(--pg-text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0 30px 0 14px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.2s ease;
}
.pg-phone-prefix:hover { border-color: var(--pg-border-hover); }
.pg-phone-prefix:focus {
  border-color: var(--pg-purple);
  box-shadow: 0 0 0 4px var(--pg-glow, rgba(37, 99, 235, 0.14));
}
.pg-phone-row .pg-ffield { flex: 1; margin-bottom: 0; }
.pg-phone-row .pg-ffield__input { height: 54px; }

.pg-char-count {
  position: absolute;
  right: 15px; bottom: -19px;
  font-size: 0.7rem;
  color: var(--pg-muted);
  font-variant-numeric: tabular-nums;
}

/* ─── Requirement checklist (draw-in check, like acuerdos success icon) ─── */
.pg-req-list {
  list-style: none;
  margin: 10px 0 18px;
  padding: 12px 14px;
  background: var(--pg-surface-2);
  border-radius: 10px;
  display: grid;
  gap: 7px;
}

.pg-req-item {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.78rem;
  color: var(--pg-muted);
  transition: color 0.25s ease;
}
.pg-req-item.met { color: var(--pg-success, #16A34A); font-weight: 500; }

.pg-req-icon {
  flex-shrink: 0;
  width: 16px; height: 16px;
}
.pg-req-icon circle {
  fill: none;
  stroke: var(--pg-border-hover);
  stroke-width: 1.6;
  transition: stroke 0.25s ease;
}
.pg-req-icon polyline {
  fill: none;
  stroke: var(--pg-success, #16A34A);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 10;
  stroke-dashoffset: 10;
  transition: stroke-dashoffset 0.28s ease 0.05s;
}
.pg-req-item.met .pg-req-icon circle { stroke: var(--pg-success, #16A34A); }
.pg-req-item.met .pg-req-icon polyline { stroke-dashoffset: 0; }

/* ─── Field-level validity glow (email, etc.) ─── */
.pg-ffield.is-valid .pg-ffield__input { border-color: var(--pg-success, #16A34A); }
.pg-ffield.is-invalid .pg-ffield__input { border-color: var(--pg-error); }
.pg-ffield__check {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%) scale(0.6);
  opacity: 0;
  color: var(--pg-success, #16A34A);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.pg-ffield.is-valid .pg-ffield__check { opacity: 1; transform: translateY(-50%) scale(1); }
.pg-ffield__check svg { width: 18px; height: 18px; display: block; }

/* ─── Buttons ─── */
.pg-auth-submit {
  position: relative;
  width: 100%;
  padding: 14px 24px;
  margin-top: 6px;
  background: linear-gradient(135deg, var(--pg-purple) 0%, var(--pg-purple-light) 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.28);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, opacity 0.2s ease;
}
.pg-auth-submit:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(37, 99, 235, 0.38); }
.pg-auth-submit:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.pg-auth-submit:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; transform: none; }

.pg-auth-submit__label { transition: opacity 0.15s ease; }
.pg-auth-submit.is-loading .pg-auth-submit__label { opacity: 0; }

.pg-btn-spinner {
  position: absolute;
  left: 50%; top: 50%;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.pg-auth-submit.is-loading .pg-btn-spinner { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .pg-btn-spinner { animation: pg-spin 0.7s linear infinite; }
}
@keyframes pg-spin { to { transform: rotate(360deg); } }

.pg-btn-back {
  margin-top: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--pg-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s ease, gap 0.2s ease;
}
.pg-btn-back svg { width: 14px; height: 14px; transition: transform 0.2s ease; }
.pg-btn-back:hover { color: var(--pg-purple); }
.pg-btn-back:hover svg { transform: translateX(-3px); }

/* ─── Visual panel: floating mock cards with parallax ─── */
.pg-visual-stage {
  position: relative;
  width: 340px;
  max-width: 70%;
  height: 300px;
  perspective: 1200px;
}

.pg-visual-card {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out;
}

.pg-visual-card__mock {
  position: absolute;
  left: 20px; right: 20px; top: 40px;
  border-radius: 16px;
  background: var(--pg-surface);
  box-shadow: 0 30px 60px -20px rgba(30, 41, 59, 0.25), 0 4px 12px rgba(30, 41, 59, 0.08);
  overflow: hidden;
}

.pg-visual-card__topbar {
  height: 34px;
  background: linear-gradient(135deg, var(--pg-purple) 0%, var(--pg-purple-light) 100%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
}
.pg-visual-card__topbar span {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,0.55);
}

.pg-visual-card__body { padding: 18px; display: grid; gap: 10px; }
.pg-visual-card__bar { height: 9px; border-radius: 5px; background: var(--pg-surface-2); }
.pg-visual-card__bar--60 { width: 60%; }
.pg-visual-card__bar--90 { width: 90%; }
.pg-visual-card__bar--40 { width: 40%; }

.pg-visual-card__cta {
  margin-top: 4px;
  width: 76px; height: 20px; border-radius: 999px;
  background: linear-gradient(135deg, var(--pg-purple) 0%, var(--pg-purple-light) 100%);
}

.pg-visual-badge {
  position: absolute;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--pg-success, #16A34A);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 14px 30px -8px rgba(22, 163, 74, 0.35);
}
.pg-visual-badge--check { right: 6px; bottom: 30px; }
.pg-visual-badge svg { width: 26px; height: 26px; color: var(--pg-success, #16A34A); }

.pg-visual-badge--profile {
  right: -6px; top: 8px;
  border-color: var(--pg-purple);
  box-shadow: 0 14px 30px -8px rgba(37, 99, 235, 0.35);
}
.pg-visual-badge--profile svg { color: var(--pg-purple); }

@media (prefers-reduced-motion: no-preference) {
  .pg-visual-card__mock { animation: pg-float 6s ease-in-out infinite; }
  .pg-visual-badge { animation: pg-float 6s ease-in-out infinite; animation-delay: -1.4s; }
}
@keyframes pg-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.pg-visual-caption {
  margin-top: 34px;
  color: var(--pg-muted);
  font-size: 0.92rem;
  text-align: center;
  max-width: 300px;
}

/* ─── Mobile: form only, no visual panel ─── */
@media (max-width: 860px) {
  .pg-authpage { flex-direction: column; }
  .pg-authpage__panel { padding: 40px 22px; }
  .pg-authpage__panel--form { max-width: none; }
  .pg-authpage__panel--visual { display: none; }
}

@media (max-width: 400px) {
  .pg-authpage__panel { padding: 32px 16px; }
}
