/* auth-design.css — DashProyectos auth (login + signup + verify)
 *
 * Implementación del rediseño de Claude Design (DashProyectos Auth.html).
 * Filosofía: "Donde todo se conecta." — visualizado en 5 capas:
 *   1) Glow ambient (CSS)
 *   2) Particle network con hubs/team/data + pulses + ripples + magnet (canvas)
 *   3) Card glassmorphic con backdrop-blur + edge-glow para conector
 *   4) Toggles internos = cross-fade limpio (mismo card)
 *   5) Card-to-card = slide-out + connector bezier (entre páginas reales se simula)
 *
 * Las páginas auth NO cargan components.css ni variables.css del dashboard
 * para evitar choques de selectores (.card, .input, .btn, etc.) — todos los
 * tokens que necesitamos están en :root acá.
 */

/* ───────── tokens ───────── */
:root {
    --bg: #09090b;
    --surface: rgba(24, 24, 27, 0.7);
    --surface-2: rgba(39, 39, 42, 0.6);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #fafafa;
    --text-2: #a1a1aa;
    --muted: #52525b;
    --accent-a: #8b5cf6;
    --accent-b: #06b6d4;
    --success: #4ade80;
    --success-glow: rgba(34, 197, 94, 0.22);
    --error: #fca5a5;
    --error-glow: rgba(239, 68, 68, 0.18);
    --radius-card: 16px;
    --radius-input: 10px;
    --shadow-card: 0 24px 48px -12px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
    --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html.auth-html {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
}

body.auth-body {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    font-feature-settings: "ss01", "cv11";
    letter-spacing: -0.005em;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
}

::selection { background: rgba(139, 92, 246, 0.4); color: #fff; }

/* ───────── shared background layers ───────── */
.bg-stack {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.bg-base { position: absolute; inset: 0; background: var(--bg); }

.bg-glow {
    position: absolute;
    inset: -10%;
    filter: blur(120px);
    opacity: 1;
}
.bg-glow::before, .bg-glow::after {
    content: "";
    position: absolute;
    width: 60vmax;
    height: 60vmax;
    border-radius: 50%;
    will-change: transform;
}
.bg-glow::before {
    top: -22vmax; left: -18vmax;
    background: radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.45) 0%, rgba(139, 92, 246, 0) 60%);
    animation: drift1 42s ease-in-out infinite alternate;
}
.bg-glow::after {
    top: -26vmax; right: -20vmax;
    background: radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.40) 0%, rgba(6, 182, 212, 0) 60%);
    animation: drift2 38s ease-in-out infinite alternate;
}
@keyframes drift1 {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(6vw, 4vh, 0) scale(1.08); }
}
@keyframes drift2 {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(-5vw, 6vh, 0) scale(1.06); }
}

.bg-grain {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 3px 3px;
    opacity: 0.5;
    mix-blend-mode: overlay;
}

#particles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}
@media (max-width: 600px) { #particles { display: none; } }

/* ───────── card-to-card connector overlay ───────── */
#card-connector {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* card slide-out / slide-in for page transitions */
.auth-card.is-leaving-left  { animation: card-leave-left  520ms cubic-bezier(.4, .0, .2, 1) forwards; }
.auth-card.is-leaving-right { animation: card-leave-right 520ms cubic-bezier(.4, .0, .2, 1) forwards; }
.auth-card.is-arriving-left { animation: card-arrive-left 520ms cubic-bezier(.16, 1, .3, 1) both; }
.auth-card.is-arriving-right{ animation: card-arrive-right 520ms cubic-bezier(.16, 1, .3, 1) both; }
@keyframes card-leave-left  { to { transform: translateX(-6px); opacity: 0.6; } }
@keyframes card-leave-right { to { transform: translateX( 6px); opacity: 0.6; } }
@keyframes card-arrive-left { from { transform: translateX( 6px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes card-arrive-right{ from { transform: translateX(-6px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* (edge-glow eliminado — ya no se usa el haz inter-páginas) */

/* ───────── stage ───────── */
.auth-stage {
    position: relative;
    z-index: 6;
    flex: 1;
    display: grid;
    place-items: center;
    padding: 48px 20px 80px;
    min-height: 100dvh;
}
@media (max-width: 600px) {
    .auth-stage { padding: 24px 14px 64px; }
}

/* ───────── card ───────── */
.auth-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 36px 32px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    overflow: hidden;
}
.auth-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 40%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* (internal beam eliminado — el haz de llegada inter-páginas ya no se usa) */

@media (max-width: 600px) {
    .auth-card { padding: 28px 22px 22px; max-width: 100%; }
}

.auth-screen { display: none; }
.auth-screen.is-active { display: block; width: 100%; max-width: 420px; }

/* ───────── brand pill ───────── */
.brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px 5px 9px;
    border: 1px solid var(--border);
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.025);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--text-2);
    text-transform: uppercase;
    margin-bottom: 22px;
}
.brand-pill .gd {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.7);
}

/* ───────── headline ───────── */
.h1 {
    font-size: 26px;
    font-weight: 500;
    letter-spacing: -0.025em;
    margin: 0 0 6px;
    color: var(--text);
}
.slogan {
    font-size: 14.5px;
    font-weight: 500;
    font-style: italic;
    letter-spacing: -0.01em;
    margin: 0 0 14px;
    background: linear-gradient(95deg, #c4b5fd 0%, #a5f3fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.sub {
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.5;
    margin: 0 0 22px;
}
.micro-tag {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: center;
    margin: 4px 0 18px;
    opacity: 0.85;
}

/* ───────── tabs (segmented control Entrar/Crear) ───────── */
.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 22px;
    position: relative;
    isolation: isolate;
}
.tabs .seg-cvs {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    border-radius: 7px;
}
.tab {
    appearance: none;
    border: 0;
    cursor: pointer;
    background: transparent;
    color: var(--text-2);
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 500;
    padding: 9px 0;
    border-radius: 7px;
    transition: background 200ms ease, color 200ms ease, box-shadow 200ms ease;
    position: relative;
    z-index: 1;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}
.tab.is-energize, .tab.is-receive { color: #fff !important; }
.tab.is-receive { animation: receive-pulse 480ms ease-out 1; }
@keyframes receive-pulse {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* ───────── form fields ───────── */
.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 14px;
}
.label {
    font-size: 12px;
    color: var(--text-2);
    font-weight: 450;
    letter-spacing: 0.005em;
}
.input {
    appearance: none;
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    padding: 11px 13px;
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.input::placeholder { color: var(--muted); }
.input:hover { border-color: var(--border-strong); }
.input:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.6);
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.14);
}

/* ───────── buttons ───────── */
.btn {
    appearance: none;
    border: 0;
    cursor: pointer;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 500;
    padding: 12px 16px;
    border-radius: var(--radius-input);
    transition: transform 120ms ease, background 160ms ease, box-shadow 160ms ease, opacity 160ms ease, color 160ms ease;
    letter-spacing: -0.005em;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: #fafafa;
    color: #09090b;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 8px 18px -8px rgba(255, 255, 255, 0.25);
}
.btn-primary:hover {
    background: #fff;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 10px 24px -8px rgba(255, 255, 255, 0.35);
}
.btn-primary[disabled], .btn-primary.is-loading {
    opacity: 0.7;
    cursor: not-allowed;
}
.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-strong);
}
.btn-outline:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.22);
}

/* ───────── inline link / toggle button ───────── */
.toggle-link {
    margin-top: 14px;
    width: 100%;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 10px 14px;
    border-radius: var(--radius-input);
    font-family: var(--sans);
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}
.toggle-link:hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, 0.025);
}

/* ───────── card footer ───────── */
.card-footer {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.06em;
    color: var(--muted);
    text-transform: uppercase;
}
.card-footer .dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success-glow);
    margin-right: 6px;
    vertical-align: 1px;
}
.card-footer a, .card-footer button {
    color: var(--muted);
    text-decoration: none;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font: inherit;
    transition: color 160ms ease;
}
.card-footer a:hover, .card-footer button:hover { color: var(--text-2); }

/* ───────── status icons ───────── */
.status-wrap { text-align: center; padding: 8px 0 4px; }
.status-circle {
    --c: var(--success);
    --g: var(--success-glow);
    width: 64px;
    height: 64px;
    margin: 6px auto 18px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 70%);
    border: 1px solid color-mix(in oklab, var(--c) 35%, transparent);
    box-shadow:
        0 0 0 6px color-mix(in oklab, var(--c) 8%, transparent),
        0 0 32px var(--g),
        inset 0 0 24px color-mix(in oklab, var(--c) 12%, transparent);
    display: grid;
    place-items: center;
    color: var(--c);
    position: relative;
}
.status-circle.error { --c: var(--error); --g: var(--error-glow); }
.status-circle svg { width: 28px; height: 28px; }
.status-circle .check-path {
    stroke-dasharray: 32;
    stroke-dashoffset: 32;
    animation: draw 520ms cubic-bezier(.65, .05, .36, 1) 80ms forwards;
}
.status-circle .x-path {
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
    animation: draw 380ms cubic-bezier(.65, .05, .36, 1) 60ms forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.status-title {
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.02em;
    margin: 0 0 8px;
}
.status-title.success { color: var(--success); }
.status-title.error { color: var(--error); }
.status-text {
    font-size: 14px;
    color: var(--text-2);
    margin: 0 auto 10px;
    line-height: 1.55;
    max-width: 320px;
}
.status-hint {
    font-size: 12px;
    color: var(--muted);
    margin: 0 auto 22px;
    line-height: 1.55;
    max-width: 320px;
}
.status-hint .em { color: var(--text-2); }
.email-chip {
    display: inline-block;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 6px;
}

/* ───────── spinner ───────── */
.spinner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: rgba(255, 255, 255, 0.85);
    animation: spin 760ms linear infinite;
    margin: 6px auto 18px;
}
.spinner-inline {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: rgba(0, 0, 0, 0.85);
    animation: spin 720ms linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── error / alert ───────── */
.alert {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 9px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--error);
    font-size: 12.5px;
    display: none;
    align-items: flex-start;
    gap: 8px;
}
.alert.visible { display: flex; }
.alert svg { flex-shrink: 0; margin-top: 1px; }

.shake { animation: shake 360ms ease; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(2px); }
}

/* ───────── stagger entrance ───────── */
.auth-screen.is-active .stagger > * {
    opacity: 0;
    transform: translateY(24px);
    animation: rise 540ms cubic-bezier(.22, .61, .36, 1) forwards;
}
.auth-screen.is-active .stagger > *:nth-child(1) { animation-delay: 0.00s; }
.auth-screen.is-active .stagger > *:nth-child(2) { animation-delay: 0.07s; }
.auth-screen.is-active .stagger > *:nth-child(3) { animation-delay: 0.14s; }
.auth-screen.is-active .stagger > *:nth-child(4) { animation-delay: 0.21s; }
.auth-screen.is-active .stagger > *:nth-child(5) { animation-delay: 0.28s; }
.auth-screen.is-active .stagger > *:nth-child(6) { animation-delay: 0.35s; }
.auth-screen.is-active .stagger > *:nth-child(7) { animation-delay: 0.42s; }
.auth-screen.is-active .stagger > *:nth-child(8) { animation-delay: 0.49s; }
.auth-screen.is-active .stagger > *:nth-child(9) { animation-delay: 0.56s; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

/* tab content cross-fade (toggle interno mismo card) */
.panel { animation: fadein 300ms ease; }
@keyframes fadein {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* focus ring */
:focus-visible {
    outline: 2px solid rgba(139, 92, 246, 0.7);
    outline-offset: 2px;
    border-radius: 6px;
}
.input:focus-visible { outline: none; }
.btn:focus-visible { outline-offset: 3px; }

/* confetti canvas */
#confetti {
    position: fixed;
    inset: 0;
    z-index: 60;
    pointer-events: none;
}

/* ───────── reduced motion ───────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    .bg-glow::before, .bg-glow::after { animation: none !important; }
    .auth-screen.is-active .stagger > * { opacity: 1; transform: none; }
    .spinner { animation: none; border-top-color: rgba(255, 255, 255, 0.6); }
    .auth-card.is-leaving-left, .auth-card.is-leaving-right,
    .auth-card.is-arriving-left, .auth-card.is-arriving-right { animation: none !important; }
}
