/* ============================================================
   auth.css — Estilos compartidos Login + 2FA · equilibRHa ACP
   Diseño consistente con las páginas SSO existentes (dark theme)
   ============================================================ */

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

:root {
  --bg:          #0d1b2a;
  --surface:     #1b2e4a;
  --surface-2:   #243a5f;
  --border:      #2d4a7a;
  --border-2:    #3d5a8a;
  --text:        #e8eef5;
  --text-muted:  #9fb3c8;
  --text-dim:    #5a7a9a;
  --accent:      #1858AC;
  --accent-dim:  rgba(24,88,172,.20);
  --accent-mid:  rgba(24,88,172,.35);
  --accent-light:#1a62c4;
  --success:     #30d158;
  --success-dim: rgba(48,209,88,.15);
  --error:       #ff453a;
  --error-dim:   rgba(255,69,58,.15);
  --warning:     #ff9f0a;
  --warning-dim: rgba(255,159,10,.15);
  --radius-card: 20px;
  --radius-el:   10px;
  --shadow-card: 0 24px 64px rgba(0,0,0,.5);
  --transition:  180ms ease;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  padding: 1.5rem;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 60% 40% at 20% 20%, rgba(24,88,172,.25), transparent),
    radial-gradient(ellipse 50% 50% at 80% 80%, rgba(24,88,172,.15), transparent);
}

/* ─── Page wrapper ─── */
.page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  animation: pageIn 320ms ease both;
}

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

/* ─── Brand ─── */
.brand { text-align: center; }

.brand-logo-img {
  width: 240px;
  max-width: 80%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* Logo colocado DENTRO de la ficha (login/olvido): separación con el título */
.card-logo {
  margin-bottom: 1.5rem;
}

/* Marca (logo + subtítulo) dentro de la ficha en SecretDrop */
.card-brand {
  margin-bottom: 1.5rem;
}

.brand-wordmark {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 20px rgba(0,0,0,.28);
}

.brand-mark svg { width: 28px; height: 28px; color: #1b3870; }

.brand-logo-text {
  font-size: 2.15rem;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
}

.brand-logo-text .wm-eq { color: #fff; }
.brand-logo-text .wm-pulse { color: #8a97c4; }

.brand-by {
  margin-top: .55rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--text-muted);
}

.brand-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 18px;
  background: linear-gradient(135deg, #1858AC, #1a62c4);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px var(--accent-mid);
}

.brand-icon svg { width: 34px; height: 34px; }

.brand-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}

.brand-name span { color: var(--accent); }

.brand-subtitle {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-top: 0.25rem;
}

/* ─── Card ─── */
.card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 2rem;
}

.card-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition);
}

.icon-wrap svg { width: 26px; height: 26px; color: var(--accent); }
.icon-wrap.success { background: var(--success-dim); }
.icon-wrap.success svg { color: var(--success); }

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: .375rem;
}

.card-subtitle {
  font-size: .875rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

/* ─── Form ─── */
.form-group { margin-bottom: 1.125rem; }

label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .375rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.input-wrap { position: relative; }

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: .6875rem .875rem;
  background: var(--bg);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-el);
  font-size: .9375rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input::placeholder { color: var(--text-muted); opacity: .5; }

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

input.has-toggle { padding-right: 2.75rem; }

input.input-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px var(--error-dim);
}

.input-toggle {
  position: absolute;
  right: .625rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: .25rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}
.input-toggle:hover { color: var(--text); }
.input-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ─── Buttons ─── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: .75rem 1rem;
  border: none;
  border-radius: var(--radius-el);
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition), background-color var(--transition);
  margin-top: .5rem;
  font-family: inherit;
}

.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-light); }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
}
.btn-ghost:hover:not(:disabled) { background: var(--border-2); }

.btn-text {
  background: transparent;
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 500;
  margin-top: .625rem;
}
.btn-text:hover:not(:disabled) { color: var(--text); }

/* ─── Spinner ─── */
.spinner {
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
  flex-shrink: 0;
}

.spinner-lg {
  width: 28px;
  height: 28px;
  border-width: 3px;
  border-color: var(--surface-2);
  border-top-color: var(--accent);
  margin: 0 auto;
}

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

/* ─── Alerts ─── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: .625rem;
  padding: .75rem .875rem;
  border-radius: var(--radius-el);
  font-size: .875rem;
  line-height: 1.5;
  margin-bottom: 1.125rem;
}

.alert[hidden] { display: none; }
.alert svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: .175rem; }

.alert-error   { background: var(--error-dim);   border: 1px solid rgba(255,69,58,.25);  color: #ff6b63; }
.alert-success { background: var(--success-dim); border: 1px solid rgba(48,209,88,.25);  color: #34d468; }
.alert-warning { background: var(--warning-dim); border: 1px solid rgba(255,159,10,.25); color: #ff9f0a; }

/* ─── OTP input boxes ─── */
.otp-group {
  display: flex;
  gap: .5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.otp-box {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-el);
  outline: none;
  caret-color: transparent;
  transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
  font-family: inherit;
}

.otp-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.otp-box.filled {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.otp-box.otp-error {
  border-color: var(--error) !important;
  animation: shake .35s ease;
}

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

/* ─── Countdown timer ─── */
.timer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  font-size: .8125rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.timer-val {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
  transition: color var(--transition);
}

.timer-val.urgent { color: var(--error); }

/* ─── QR code box ─── */
.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .875rem;
  padding: 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 1.25rem;
}

.qr-box p {
  font-size: .8125rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.55;
}

/* Secret key row */
.secret-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-el);
  padding: .625rem .875rem;
  margin-bottom: 1.375rem;
}

.secret-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: .375rem;
}

.secret-val {
  flex: 1;
  font-family: 'SF Mono', 'Fira Code', 'Menlo', 'Consolas', monospace;
  font-size: .8rem;
  color: var(--text);
  letter-spacing: .1em;
  word-break: break-all;
}

.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: .25rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color var(--transition);
}
.copy-btn:hover { color: var(--accent); }
.copy-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ─── Steps indicator ─── */
.steps {
  display: flex;
  align-items: center;
  margin-bottom: 1.75rem;
}

.step {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8125rem;
  font-weight: 500;
  white-space: nowrap;
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .6875rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: background-color var(--transition), color var(--transition);
}

.step.active  { color: var(--text); }
.step.active  .step-num { background: var(--accent);  color: #fff; }
.step.done    { color: var(--success); }
.step.done    .step-num { background: var(--success); color: #fff; }
.step.pending { color: var(--text-muted); }
.step.pending .step-num { background: var(--surface-2); color: var(--text-muted); }

.step-line { flex: 1; height: 1px; background: var(--border-2); margin: 0 .75rem; }

/* ─── Loading placeholder ─── */
.loading-placeholder {
  text-align: center;
  padding: 2rem 0;
}

.loading-placeholder p {
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: .875rem;
}

/* ─── Promo de la app iOS (login) ─── */
.app-promo {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 1.375rem;
  background:
    linear-gradient(135deg, rgba(24,88,172,.16), transparent 55%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 12px 36px rgba(0,0,0,.35);
}

.app-promo-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-light);
}

.app-promo-eyebrow svg { width: 13px; height: 13px; }

.app-promo-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
  margin-top: .3rem;
}

.app-promo-desc {
  font-size: .8125rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: .25rem;
}

/* Badge oficial «Consíguelo en el App Store» */
.app-badge {
  display: inline-block;
  margin-top: .875rem;
  border-radius: 8px;
  line-height: 0;
  transition: transform var(--transition), box-shadow var(--transition);
}

.app-badge svg {
  display: block;
  height: 42px;
  width: auto;
}

/* Badge oficial «Disponible en Google Play» (PNG servido como data-URI) */
.app-badge-img {
  display: block;
  height: 42px;
  width: auto;
}

.app-badge:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.45); }
.app-badge:active { transform: translateY(0); }
.app-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Columna del QR */
.app-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .85rem;
}

.app-qr-frame {
  padding: .5rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
  line-height: 0;
  transition: transform var(--transition), box-shadow var(--transition);
}

.app-qr-frame:hover { transform: scale(1.04); box-shadow: 0 10px 26px rgba(0,0,0,.5); }

.app-qr-frame svg {
  display: block;
  width: 96px;
  height: 96px;
  color: #0d1b2a;
}

.app-qr-caption {
  font-size: .6875rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.4;
  max-width: 110px;
}

.app-qr-hint {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text-dim);
  text-align: center;
}

.app-qr-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
}

/* ─── Trigger + Modal de descarga de la app móvil ─── */
.app-modal-trigger {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .625rem 1.05rem;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-card);
  color: #fff;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition);
}
.app-modal-trigger svg { width: 18px; height: 18px; color: #fff; }
.app-modal-trigger:hover { transform: translateY(-1px); background: var(--accent-light); border-color: var(--accent-light); box-shadow: 0 8px 24px var(--accent-mid); }
.app-modal-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.app-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(92vw, 440px);
  height: fit-content;
  max-height: 90vh;
  overflow: auto;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.app-modal::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(3px); }
.app-modal[open] { animation: appModalIn .18s ease; }
@keyframes appModalIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

.app-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.app-modal-title { font-size: 1.15rem; font-weight: 700; color: var(--text); letter-spacing: -.01em; margin-top: .3rem; }
.app-modal-close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.app-modal-close svg { width: 18px; height: 18px; }
.app-modal-close:hover { background: rgba(255,255,255,.06); color: var(--text); }
.app-modal-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* La promo, dentro del modal, se reordena en FILAS por plataforma (App Store / Google Play).
   display:contents aplana .app-promo-info y .app-qr para intercalar QR + badge en cada fila,
   sin mover ningún <svg> (ni el badge de Apple ni los QR). */
.app-modal .app-promo {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1.1rem 1.25rem;
  margin-top: 1.25rem;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}
.app-modal .app-promo-info,
.app-modal .app-qr { display: contents; }
.app-modal .app-qr-hint { display: none; }

/* Fila 1 — App Store / iPhone */
.app-modal .app-qr-item:nth-of-type(1) { grid-column: 1; grid-row: 1; margin: 0; }
.app-modal .app-badge:not(.app-badge--gplay) { grid-column: 2; grid-row: 1; justify-self: start; margin: 0; }
/* Fila 2 — Google Play / Android */
.app-modal .app-qr-item:nth-of-type(2) { grid-column: 1; grid-row: 2; margin: 0; }
.app-modal .app-badge--gplay { grid-column: 2; grid-row: 2; justify-self: start; margin: 0; }

/* ─── Footer ─── */
footer {
  font-size: .75rem;
  color: var(--text-dim);
  text-align: center;
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
  /* En móvil el QR no sirve (no puedes escanear tu propia pantalla): solo los badges, en columna */
  .app-modal .app-promo { grid-template-columns: 1fr; justify-items: center; }
  .app-modal .app-qr-item { display: none; }
  .app-modal .app-badge:not(.app-badge--gplay) { grid-column: 1; grid-row: 1; }
  .app-modal .app-badge--gplay { grid-column: 1; grid-row: 2; }
}

@media (max-width: 420px) {
  .card { padding: 1.5rem 1.125rem; }
  .otp-box { width: 40px; height: 50px; font-size: 1.25rem; gap: .375rem; }
  .otp-group { gap: .375rem; }
}

@media (prefers-reduced-motion: reduce) {
  .app-badge, .app-qr-frame { transition: none; }
  .app-badge:hover, .app-qr-frame:hover { transform: none; }
}
