/* ============================================================================
   SULLANA-BUNKER-V8 | auth.css
   UI Login/OTP - Glassmorphism Dark, Mobile-First
   ============================================================================ */

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

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-deep:       #080E1A;
    --bg-surface:    #0F172A;
    --bg-card:       rgba(15, 23, 42, 0.85);
    --bg-input:      rgba(30, 41, 59, 0.8);
    --border:        rgba(99, 102, 241, 0.2);
    --border-focus:  rgba(99, 102, 241, 0.7);
    --primary:       #6366F1;
    --primary-dark:  #4F46E5;
    --primary-glow:  rgba(99, 102, 241, 0.35);
    --accent:        #8B5CF6;
    --success:       #22C55E;
    --warning:       #F59E0B;
    --danger:        #EF4444;
    --text-1:        #F1F5F9;
    --text-2:        #CBD5E1;
    --text-3:        #94A3B8;
    --text-muted:    #64748B;
    --radius-sm:     8px;
    --radius-md:     14px;
    --radius-lg:     22px;
    --radius-xl:     28px;
    --shadow-lg:     0 25px 60px rgba(0,0,0,0.5);
    --shadow-glow:   0 8px 32px var(--primary-glow);
    --transition:    all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-1);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    overflow-x: hidden;
}

/* ── Fondo animado con orbs ──────────────────────────────── */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
    animation: orb-float 8s ease-in-out infinite alternate;
}
.bg-orb-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(99,102,241,0.18) 0%, transparent 70%);
    top: -100px; left: -150px;
    animation-delay: 0s;
}
.bg-orb-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(139,92,246,0.14) 0%, transparent 70%);
    bottom: -80px; right: -100px;
    animation-delay: -3s;
}
.bg-orb-3 {
    width: 250px; height: 250px;
    background: radial-gradient(circle, rgba(34,197,94,0.08) 0%, transparent 70%);
    top: 40%; right: 20%;
    animation-delay: -5s;
}
@keyframes orb-float {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(30px, -20px) scale(1.05); }
}

/* ── Contenedor principal ────────────────────────────────── */
.auth-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* ── Logo / Brand ────────────────────────────────────────── */
.brand {
    text-align: center;
    animation: brand-in 0.6s ease both;
}
@keyframes brand-in {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.brand-icon {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem;
    margin: 0 auto 1rem;
    box-shadow: var(--shadow-glow);
    transition: var(--transition);
    animation: icon-pulse 3s ease-in-out infinite;
}
@keyframes icon-pulse {
    0%, 100% { box-shadow: var(--shadow-glow); }
    50%       { box-shadow: 0 8px 48px rgba(99, 102, 241, 0.55); }
}
.brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-1);
}
.brand-subtitle {
    font-size: 0.8rem;
    color: var(--text-3);
    margin-top: 2px;
    letter-spacing: 0.02em;
}

/* ── Card ────────────────────────────────────────────────── */
.auth-card {
    width: 100%;
    background: var(--bg-card);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.25rem 2rem;
    box-shadow: var(--shadow-lg);
    animation: card-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}
@keyframes card-in {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.card-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 0.35rem;
    letter-spacing: -0.025em;
}
.card-desc {
    font-size: 0.875rem;
    color: var(--text-3);
    margin-bottom: 1.75rem;
    line-height: 1.5;
}

/* ── Form Elements ───────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}
.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 0.5rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
    font-size: 1.1rem;
    transition: var(--transition);
}
.form-input {
    width: 100%;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-1);
    font-family: inherit;
    font-size: 1rem;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    outline: none;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: rgba(30, 41, 59, 0.95);
}
.form-input:focus + .input-icon,
.input-wrapper:focus-within .input-icon { color: var(--primary); }

/* ── OTP Input ───────────────────────────────────────────── */
.otp-inputs {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    margin: 1.5rem 0;
}
.otp-digit {
    width: 52px; height: 64px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-1);
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    outline: none;
    font-family: 'Inter', monospace;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
    caret-color: var(--primary);
    letter-spacing: 0;
}
.otp-digit:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(30, 41, 59, 0.95);
    transform: scale(1.05);
}
.otp-digit.filled {
    border-color: rgba(99, 102, 241, 0.5);
    color: var(--primary);
}
.otp-digit.shake {
    animation: shake 0.5s ease;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60%  { transform: translateX(-6px); }
    40%, 80%  { transform: translateX(6px); }
}

/* ── Botón principal ─────────────────────────────────────── */
.btn-primary {
    width: 100%;
    padding: 0.95rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px var(--primary-glow);
}
.btn-primary::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: var(--transition);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px var(--primary-glow); }
.btn-primary:hover::before { opacity: 1; }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ── Botón secundario ────────────────────────────────────── */
.btn-secondary {
    width: 100%;
    padding: 0.95rem 1.5rem;
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--text-1);
    background: rgba(99, 102, 241, 0.1);
}

/* ── Estado de loading en botón ──────────────────────────── */
.btn-primary .spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mensajes de alerta ──────────────────────────────────── */
.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    animation: alert-in 0.3s ease both;
    line-height: 1.5;
}
@keyframes alert-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.alert-error   { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3);  color: #FCA5A5; }
.alert-success { background: rgba(34,197,94,0.12);  border: 1px solid rgba(34,197,94,0.3);  color: #86EFAC; }
.alert-warning { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3); color: #FDE68A; }
.alert-info    { background: rgba(99,102,241,0.12); border: 1px solid rgba(99,102,241,0.3); color: #A5B4FC; }
.alert-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }

/* ── Timer countdown ─────────────────────────────────────── */
.otp-timer {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-3);
    margin-bottom: 1rem;
}
.timer-ring {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(99,102,241,0.1);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 20px;
    padding: 4px 14px;
}
.timer-value { color: var(--primary); font-weight: 600; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.timer-value.urgent { color: var(--danger); animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.5; } }

/* ── Links y acciones secundarias ────────────────────────── */
.auth-link {
    background: none;
    border: none;
    color: var(--primary);
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    font-weight: 500;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: var(--transition);
}
.auth-link:hover { color: var(--accent); }
.auth-link:disabled { color: var(--text-muted); cursor: not-allowed; text-decoration: none; }

.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

/* ── Divider ─────────────────────────────────────────────── */
.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: 0.78rem;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Security badge ──────────────────────────────────────── */
.security-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}
.security-dot {
    width: 6px; height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
    50%       { opacity: 0.7; box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}

/* ── Paso a paso (steps indicator) ──────────────────────── */
.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.75rem;
}
.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.step-circle {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-input);
    transition: var(--transition);
}
.step.active .step-circle   { border-color: var(--primary); color: #fff; background: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); }
.step.done .step-circle     { border-color: var(--success);  color: #fff; background: var(--success); }
.step-label { font-size: 0.65rem; color: var(--text-muted); white-space: nowrap; }
.step.active .step-label { color: var(--primary); }
.step.done .step-label   { color: var(--success); }
.step-line { width: 40px; height: 2px; background: var(--border); margin: 0 4px; margin-bottom: 18px; transition: var(--transition); }
.step-line.done { background: var(--success); }

/* ── Sidebar / footer ────────────────────────────────────── */
.auth-footer {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
    z-index: 1;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 440px) {
    .auth-card { padding: 1.75rem 1.25rem; border-radius: var(--radius-lg); }
    .otp-digit { width: 44px; height: 56px; font-size: 1.4rem; }
    .brand-icon { width: 60px; height: 60px; font-size: 1.9rem; }
}
@media (max-width: 360px) {
    .otp-digit { width: 38px; height: 50px; font-size: 1.2rem; }
    .otp-inputs { gap: 0.4rem; }
}
