/* ============================================================
   LOGIN GRS — Réplica del diseño App Android (Compose)
   Paleta: BrandDark #090909, Surface #121217, Gold #BFA76F
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --gold: #BFA76F;
    --gold-hover: #D9C98E;
    --bg-dark: #090909;
    --bg-surface: #121217;
    --bg-surface2: #1A1A22;
    --glass: #121217;
    --glass-border: rgba(191,167,111,.15);
    --text: #ffffff;
    --text-muted: #7A7A8A;
    --error: #D95555;
    --ok: #4A9E6A;
    --warning: #D4A843;
    --gold-12: rgba(191,167,111,.12);
    --gold-15: rgba(191,167,111,.15);
    --gold-40: rgba(191,167,111,.40);
    --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; outline: none; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
    -webkit-font-smoothing: antialiased;
}

/* ---------- Fondo: glow dorado lateral (como BrandBackground de la app) ---------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bg-photo { display: none; }
.bg-veil { position: absolute; inset: 0; background: var(--bg-dark); }
.orb {
    position: absolute; border-radius: 50%; filter: blur(120px);
    mix-blend-mode: screen; will-change: transform;
}
.o1 {
    width: 600px; height: 600px; top: -100px; left: -250px;
    background: radial-gradient(circle, rgba(191,167,111,.25), transparent 70%);
    opacity: .6;
}
.o2 { display: none; }
.o3 { display: none; }
.particles { display: none; }

/* Menos movimiento */
@media (prefers-reduced-motion: reduce) {
    .orb { animation: none !important; }
}

/* ---------- Tarjeta de login ---------- */
.login-card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 400px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 36px 28px 28px;
    box-shadow: 0 20px 50px rgba(0,0,0,.5);
    animation: cardIn .5s cubic-bezier(.2,.8,.2,1);
    overflow: hidden;
    transition: transform .5s ease, opacity .5s ease;
}
.login-card.done { transform: scale(0.96); opacity: 0; }
.login-card::before { display: none; }

@keyframes cardIn {
    from { opacity: 0; transform: translateY(20px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Brand / Logo ---------- */
.brand { text-align: center; margin-bottom: 28px; }
.logo { max-width: 200px; max-height: 100px; filter: drop-shadow(0 4px 14px rgba(0,0,0,.4)); }

.wordmark { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.wm-emblem {
    width: 62px; height: 62px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 800; letter-spacing: 1px; color: #000;
    background: linear-gradient(135deg, var(--gold), var(--gold-hover));
    box-shadow: 0 6px 18px rgba(191,167,111,.3);
}
.wm-name { font-size: 12px; font-weight: 700; letter-spacing: 3px; color: var(--gold); }

/* ---------- Pasos (steps) ---------- */
.step { display: none; }
.step.active { display: block; animation: stepIn .35s cubic-bezier(.2,.8,.2,1); }
@keyframes stepIn {
    from { opacity: 0; transform: translateX(18px); }
    to   { opacity: 1; transform: translateX(0); }
}
.step.active > * { animation: childUp .4s cubic-bezier(.2,.8,.2,1) both; }
.step.active > *:nth-child(2) { animation-delay: .05s; }
.step.active > *:nth-child(3) { animation-delay: .1s; }
.step.active > *:nth-child(4) { animation-delay: .15s; }
.step.active > *:nth-child(5) { animation-delay: .2s; }
@keyframes childUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.step-title {
    font-size: 22px; font-weight: 700; text-align: center; letter-spacing: -.3px;
}
.step-title span { color: var(--gold); }
.step-sub {
    text-align: center; color: var(--text-muted); font-size: 14px;
    margin: 6px 0 24px; line-height: 1.5;
}
.gold { color: var(--gold); font-weight: 600; }

/* ---------- Avatar (como BrandLogo de la app) ---------- */
.avatar {
    position: relative;
    width: 80px; height: 80px; border-radius: 50%;
    margin: 0 auto 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; font-weight: 700; color: #000;
    background: linear-gradient(135deg, var(--gold), var(--gold-hover));
    box-shadow: 0 6px 18px rgba(191,167,111,.3);
}
.avatar::after {
    content: "";
    position: absolute; inset: -4px;
    border-radius: 50%;
    border: 1.5px solid rgba(191,167,111,.35);
}

/* ---------- Campos (como BrandTextField de la app) ---------- */
.field { position: relative; margin-bottom: 14px; }
input[type=email], input[type=password], input[type=text], input[type=tel] {
    width: 100%;
    padding: 16px 18px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    transition: border-color .2s, background .2s, box-shadow .2s;
}
input:focus {
    border-color: var(--gold);
    background: rgba(255,255,255,.06);
    box-shadow: 0 0 0 3px var(--gold-12);
}
input::placeholder { color: var(--text-muted); }

.eye {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: var(--text-muted);
    padding: 8px 10px; opacity: .7; line-height: 1; transition: color .2s, opacity .2s;
}
.eye svg { width: 20px; height: 20px; display: block; }
.eye:hover { opacity: 1; color: var(--gold); }

.capslock {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    background: rgba(212,168,67,.1);
    border: 1px solid rgba(212,168,67,.3);
    color: var(--warning);
    border-radius: 10px;
    font-size: 12px;
    padding: 8px 12px;
    margin: -4px 0 12px;
    animation: stepIn .25s ease;
}
.capslock[hidden] { display: none; }

/* ---------- Botones (como GoldButton / GoldOutlineButton de la app) ---------- */
.btn {
    position: relative;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #9E813F, #CFB070, #BFA76F);
    color: #090909;
    font-weight: 700;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: background .2s, transform .15s;
    margin-top: 6px;
    touch-action: manipulation;
    min-height: 50px;
    overflow: hidden;
}
.btn::after { display: none; }
.btn:hover:not(:disabled) { background: linear-gradient(135deg, #B08D45, #D9C98E, #CFB070); }
.btn:active:not(:disabled) { transform: scale(.985); }
.btn:disabled { opacity: .6; cursor: default; }

.btn-ghost {
    background: transparent;
    border: 1px solid var(--gold-40);
    color: var(--gold);
    margin-top: 12px;
}
.btn-ghost:hover:not(:disabled) { background: var(--gold-12); border-color: var(--gold); }

.spinner {
    position: absolute; top: 50%; left: 50%;
    width: 20px; height: 20px; margin: -10px 0 0 -10px;
    border: 2.5px solid rgba(0,0,0,.2);
    border-top-color: #000;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Enlace crear cuenta (como GoldOutlineButton) */
.link-create {
    background: none; border: none; cursor: pointer;
    display: block; width: 100%; text-align: center;
    margin-top: 18px; padding: 10px 0 2px;
    font-size: 13px; color: var(--text-muted);
    border-top: 1px solid rgba(255,255,255,.06);
    font-family: inherit;
    transition: color .2s;
}
.link-create b { color: var(--gold); font-weight: 600; }
.link-create:hover { color: var(--text); }

/* ---------- Medidor de contraseña ---------- */
.pw-meter { display: flex; align-items: center; gap: 10px; margin: -4px 2px 12px; }
.pw-meter[hidden] { display: none; }
.pw-bar { flex: 1; height: 4px; border-radius: 4px; background: rgba(255,255,255,.06); overflow: hidden; }
.pw-bar span { display: block; height: 100%; border-radius: 4px; width: 0; transition: width .3s, background .3s; }
.pw-bar span.w { width: 33%; background: var(--error); }
.pw-bar span.m { width: 66%; background: var(--warning); }
.pw-bar span.s { width: 100%; background: var(--ok); }
.pw-label { font-size: 11px; font-weight: 600; min-width: 62px; text-align: right; }

/* ---------- Links de navegación ---------- */
.link-back, .link-resend {
    background: none; border: none; color: var(--text-muted);
    font-size: 13px; cursor: pointer; margin-top: 16px;
    display: block; width: 100%; text-align: center;
    font-family: inherit;
    transition: color .2s;
}
.link-back:hover, .link-resend:hover { color: var(--gold); }
.link-resend { color: var(--gold); font-weight: 600; margin-top: 4px; }

/* ---------- OTP ---------- */
.otp-icon {
    width: 60px; height: 60px; border-radius: 50%; margin: 0 auto 14px;
    display: flex; align-items: center; justify-content: center; font-size: 26px;
    background: var(--gold-12); color: var(--gold);
    border: 1px solid rgba(191,167,111,.25);
}
.otp-inputs { display: flex; gap: 8px; justify-content: center; margin-bottom: 18px; }
.otp-inputs input {
    width: 46px; height: 56px; padding: 0; text-align: center;
    font-size: 22px; font-weight: 700; border-radius: 12px;
}
.otp-inputs input:focus { transform: translateY(-2px); }
.otp-inputs input.filled {
    border-color: var(--gold);
    background: rgba(191,167,111,.06);
}
.resend { text-align: center; margin-top: 14px; font-size: 12px; color: var(--text-muted); }

/* ---------- Toast ---------- */
.toast {
    max-height: 0; opacity: 0; overflow: hidden;
    background: rgba(217,85,85,.12);
    border: 1px solid rgba(217,85,85,.3);
    color: #fca5a5;
    border-radius: 12px;
    font-size: 13px;
    text-align: center;
    transition: max-height .3s, opacity .3s, margin .3s, padding .3s;
    margin-bottom: 0; padding: 0 12px;
}
.toast.show { max-height: 90px; opacity: 1; margin-bottom: 16px; padding: 12px; animation: shake .35s; }
@keyframes shake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ---------- SSO ---------- */
.sso-notice {
    background: var(--gold-12);
    border: 1px solid rgba(191,167,111,.2);
    color: var(--text);
    padding: 12px 16px; border-radius: 12px; margin-bottom: 18px;
    font-size: 13px; text-align: center;
}
.sso-notice strong { color: var(--gold); }
.sso-avatar {
    width: 72px; height: 72px; border-radius: 50%;
    margin: 0 auto 16px; display: block;
    box-shadow: 0 0 0 2px rgba(191,167,111,.3), 0 6px 16px rgba(0,0,0,.4);
}
.sso-app-name { font-size: 17px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.sso-permissions {
    text-align: left; background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06); border-radius: 12px;
    padding: 14px 16px; margin: 18px 0; font-size: 13px; color: var(--text-muted);
}
.sso-permissions li { list-style: none; padding: 5px 0; display: flex; align-items: center; gap: 10px; }
.sso-permissions li::before { content: "✓"; color: var(--gold); font-weight: 700; }

/* ---------- Éxito ---------- */
.success-overlay {
    position: absolute; inset: 0; z-index: 20;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    background: var(--bg-surface);
    border-radius: inherit;
    opacity: 0; pointer-events: none;
    transition: opacity .3s ease;
}
.success-overlay.show { opacity: 1; pointer-events: auto; }
.success-overlay svg { width: 80px; height: 80px; }
.success-overlay p { font-size: 17px; font-weight: 700; color: var(--gold); }
.ck-circle {
    stroke: var(--gold); stroke-width: 2.5;
    stroke-dasharray: 145; stroke-dashoffset: 145;
    transform-origin: center; transform: rotate(-90deg);
}
.ck-check {
    stroke: var(--gold); stroke-width: 4;
    stroke-linecap: round; stroke-linejoin: round;
    stroke-dasharray: 48; stroke-dashoffset: 48;
}
.success-overlay.show .ck-circle { animation: draw .5s ease-out forwards; }
.success-overlay.show .ck-check  { animation: draw .3s ease-out .4s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Footer ---------- */
.guard-badge {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-top: 22px; font-size: 11px; color: var(--text-muted);
}
.guard-badge svg { width: 13px; height: 13px; color: var(--gold); flex-shrink: 0; }
.guard-badge b { color: var(--gold); font-weight: 600; }
.footer-links { margin-top: 6px; font-size: 11px; color: var(--text-muted); text-align: center; }
.footer-links a { color: var(--text-muted); text-decoration: none; transition: color .2s; margin: 0 5px; }
.footer-links a:hover { color: var(--gold); }

/* ---------- App approval step ---------- */
.app-pulse{position:relative;width:96px;height:96px;margin:4px auto 16px}
.app-core{position:absolute;inset:28px;display:flex;align-items:center;justify-content:center;background:var(--gold-12);border:1px solid rgba(191,167,111,.4);border-radius:50%}
.app-ring{position:absolute;inset:0;border-radius:50%;border:2px solid rgba(191,167,111,.4);animation:appPulse 1.9s ease-out infinite}
.app-ring.d2{animation-delay:.95s}
@keyframes appPulse{0%{transform:scale(.42);opacity:.8}80%{opacity:0}100%{transform:scale(1);opacity:0}}
.app-wait{color:var(--gold);font-size:13px;margin:0 0 12px;letter-spacing:.3px;text-align:center}
.app-dots i{font-style:normal;animation:appBlink 1.4s infinite both}
.app-dots i:nth-child(2){animation-delay:.2s}
.app-dots i:nth-child(3){animation-delay:.4s}
@keyframes appBlink{0%,100%{opacity:.2}50%{opacity:1}}
.app-msg{font-size:12px;min-height:16px;margin:8px 0 4px;color:var(--ok);text-align:center}
#app-resend{display:inline-block;margin:2px auto 8px}
.app-num{font-size:48px;font-weight:800;color:var(--gold);letter-spacing:4px;line-height:1;margin:6px auto 14px;text-align:center;text-shadow:0 2px 10px rgba(191,167,111,.2)}

/* ---------- Responsive ---------- */
@media (max-width: 430px) {
    body { align-items: center; }
    .login-card { padding: 28px 20px 22px; border-radius: 20px; }
    .logo { max-width: 160px; }
    .step-title { font-size: 20px; }
    .otp-inputs { gap: 6px; }
    .otp-inputs input { width: 42px; height: 52px; font-size: 20px; }
}
@media (max-width: 360px) {
    .otp-inputs input { width: 38px; height: 48px; font-size: 18px; }
}
@media (max-height: 640px) {
    body { align-items: center; }
}
