/* css/login.css */
:root {
    --primary: #349FC6;
    --primary-hover: #32467F;
    --secondary: #8C1D82;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent-cyan: #0FF2AA;
    --accent-lime: #8CF20F;
}

body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* --- FONDO 1: CANVAS INTERACTIVO (Logos) --- */
canvas#interactive-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    /* Detrás del contenido, frente a las estrellas */
}

/* --- FONDO 2: ESPACIO PROFUNDO (Estrellas) --- */
.space-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -5;
    /* Muy atrás */
    overflow: hidden;
    background: linear-gradient(to bottom, #0f172a, #1e1b4b);
}

.nebula {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: pulseNebula 10s infinite alternate;
}

.nebula-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: #8C1D82;
}

.nebula-2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: #349FC6;
    animation-delay: -5s;
}

@keyframes pulseNebula {
    0% {
        transform: scale(1);
        opacity: 0.3;
    }

    100% {
        transform: scale(1.2);
        opacity: 0.5;
    }
}

.star {
    position: absolute;
    top: 50%;
    left: 50%;
    height: 2px;
    background: linear-gradient(-45deg, #fff, rgba(0, 0, 255, 0));
    filter: drop-shadow(0 0 6px #fff);
    animation: tail 3000ms ease-in-out infinite, shooting 3000ms ease-in-out infinite;
}

.star::before,
.star::after {
    content: '';
    position: absolute;
    top: calc(50% - 1px);
    right: 0;
    height: 2px;
    background: linear-gradient(-45deg, rgba(0, 0, 255, 0), #fff, rgba(0, 0, 255, 0));
    border-radius: 100%;
    transform: translateX(50%) rotateZ(45deg);
    animation: shining 3000ms ease-in-out infinite;
}

.star::after {
    transform: translateX(50%) rotateZ(-45deg);
}

/* Posiciones Estrellas */
.star:nth-child(3) {
    top: 20%;
    left: 20%;
    animation-delay: 1.2s;
}

.star:nth-child(4) {
    top: 60%;
    left: 80%;
    animation-delay: 2.4s;
}

.star:nth-child(5) {
    top: 80%;
    left: 30%;
    animation-delay: 3.6s;
}

.star:nth-child(6) {
    top: 30%;
    left: 70%;
    animation-delay: 4.8s;
}

.star:nth-child(7) {
    top: 90%;
    left: 10%;
    animation-delay: 6s;
}

@keyframes tail {
    0% {
        width: 0;
    }

    30% {
        width: 100px;
    }

    100% {
        width: 0;
    }
}

@keyframes shining {
    0% {
        width: 0;
    }

    50% {
        width: 30px;
    }

    100% {
        width: 0;
    }
}

@keyframes shooting {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(300px);
    }
}

/* --- LOGIN WRAPPER --- */
.login-wrapper {
    position: relative;
    width: 100%;
    max-width: 380px;
    padding-top: 60px;
}

/* --- AVATAR BOX --- */
.avatar-box {
    width: 130px;
    height: 130px;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.3));
}

#avatar-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* --- TARJETA --- */
.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3.5rem 2.5rem 2.5rem;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
}

h2 {
    margin: 0 0 5px;
    font-weight: 600;
    font-size: 1.5rem;
}

p {
    color: #94a3b8;
    margin: 0 0 2rem;
    font-size: 0.9rem;
}

/* --- INPUTS --- */
.input-group {
    position: relative;
    margin-bottom: 1.2rem;
}

.input-group input {
    width: 100%;
    padding: 12px 40px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-size: 0.95rem;
    box-sizing: border-box;
    outline: none;
    transition: all 0.3s;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    background: rgba(15, 23, 42, 0.8);
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
}

.toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    cursor: pointer;
    padding: 5px;
    z-index: 20;
    pointer-events: auto;
    user-select: none;
    transition: color 0.3s;
}

.toggle-password:hover {
    color: var(--text-main);
}

/* --- BOTÓN --- */
button#login-btn {
    width: 100%;
    padding: 14px;
    margin-top: 1rem;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

button#login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px rgba(140, 29, 130, 0.5);
}

button#login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* --- ESTILOS DEL NUEVO AVATAR ROBOT --- */

/* Efecto de brillo para los ojos digitales */
.bot-eye-glow {
    filter: drop-shadow(0 0 5px #0FF2AA);
}

/* Un pequeño destello en las articulaciones de las manos */
.bot-joint-glow {
    filter: drop-shadow(0 0 2px #8CF20F);
}

/* Asegurar que el SVG respete los límites */
#avatar-svg {
    overflow: visible;
}

/* =========================================
   SISTEMA DE FONDO ESPECTACULAR - 5 CAPAS
   ========================================= */

/* === CAPA 1: GRADIENTE ANIMADO DE FONDO === */
.animated-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -10;
    background: linear-gradient(-45deg,
            #0f172a,
            #1e1b4b,
            #312e81,
            #1e293b);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* === CAPA 2: CAMPO ESTELAR DENSO === */
.starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -9;
    overflow: hidden;
}

.stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background: transparent;
}

/* Crear estrellas con múltiples sombras */
.stars::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 2px;
    background: transparent;
    box-shadow:
        100px 200px #fff, 300px 100px #fff, 500px 300px #fff,
        700px 150px #fff, 200px 400px #fff, 600px 250px #fff,
        150px 500px #fff, 450px 450px #fff, 800px 350px #fff,
        250px 150px #fff, 550px 550px #fff, 350px 250px #fff,
        900px 200px #fff, 400px 600px #fff, 650px 100px #fff,
        50px 300px #fff, 750px 450px #fff, 850px 500px #fff,
        180px 50px #fff, 280px 580px #fff, 480px 180px #fff,
        680px 380px #fff, 120px 420px #fff, 520px 220px #fff,
        820px 120px #fff, 220px 520px #fff, 420px 420px #fff,
        720px 220px #fff, 920px 420px #fff, 320px 620px #fff,
        /* Estrellas de colores de la paleta */
        380px 280px #0FF2AA, 580px 480px #8CF20F, 180px 680px #349FC6,
        380px 80px #8C1D82, 780px 280px #32467F, 980px 80px #0FF2AA,
        80px 480px #8C1D82, 280px 280px #349FC6, 480px 80px #8CF20F,
        680px 480px #32467F, 880px 280px #0FF2AA, 580px 180px #8C1D82,
        /* Más estrellas blancas */
        40px 140px #fff, 340px 540px #fff, 540px 340px #fff,
        740px 140px #fff, 940px 540px #fff, 140px 740px #fff,
        440px 940px #fff, 640px 740px #fff, 840px 940px #fff,
        110px 210px #fff, 310px 410px #fff, 510px 610px #fff,
        710px 810px #fff, 910px 110px #fff, 210px 910px #fff;
    animation: sparkle 2s linear infinite;
}

.stars:nth-child(2)::before {
    box-shadow:
        150px 150px #fff, 350px 50px #fff, 550px 250px #fff,
        750px 100px #fff, 250px 350px #fff, 650px 200px #fff,
        200px 450px #fff, 500px 400px #fff, 850px 300px #fff,
        300px 200px #fff, 600px 500px #fff, 400px 300px #fff,
        950px 150px #fff, 450px 550px #fff, 700px 50px #fff,
        100px 250px #fff, 800px 400px #fff, 900px 450px #fff,
        /* Colores */
        430px 230px #8CF20F, 630px 430px #349FC6, 230px 630px #0FF2AA,
        430px 30px #32467F, 830px 230px #8C1D82, 1030px 30px #8CF20F,
        130px 430px #349FC6, 330px 230px #0FF2AA, 530px 30px #32467F,
        730px 430px #8C1D82, 930px 230px #8CF20F, 630px 130px #349FC6;
    animation: sparkle 3s linear infinite;
}

.stars:nth-child(3)::before {
    box-shadow:
        200px 100px #fff, 400px 200px #fff, 600px 400px #fff,
        800px 250px #fff, 300px 500px #fff, 700px 350px #fff,
        250px 600px #fff, 550px 550px #fff, 900px 450px #fff,
        350px 350px #fff, 650px 650px #fff, 450px 450px #fff,
        1000px 300px #fff, 500px 700px #fff, 750px 150px #fff,
        /* Colores brillantes */
        480px 380px #0FF2AA, 680px 580px #8C1D82, 280px 780px #8CF20F,
        480px 180px #349FC6, 880px 380px #32467F, 1080px 180px #0FF2AA;
    animation: sparkle 4s linear infinite;
}

@keyframes sparkle {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }
}

/* === CAPA 3: METEOROS === */
.meteors-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -8;
    overflow: hidden;
    pointer-events: none;
}

.meteor {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, #fff, transparent);
    filter: drop-shadow(0 0 6px #fff);
    animation: meteorFall linear forwards;
    transform: rotate(45deg);
}

.meteor::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px rgba(255, 255, 255, 0.5);
}

@keyframes meteorFall {
    0% {
        transform: rotate(45deg) translateX(0);
        opacity: 1;
    }

    70% {
        opacity: 1;
    }

    100% {
        transform: rotate(45deg) translateX(1000px);
        opacity: 0;
    }
}

/* === CAPA 4: BURBUJAS GLASSMORPHISM === */
.bubbles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -7;
    overflow: hidden;
    pointer-events: none;
}

.glass-bubble {
    position: absolute;
    border-radius: 50%;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: floatBubble linear infinite;
}

@keyframes floatBubble {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0;
    }

    10% {
        opacity: 0.6;
    }

    90% {
        opacity: 0.6;
    }

    100% {
        transform: translate(calc(-50px + (var(--random-x, 0) * 100px)),
                -100vh) scale(0.8);
        opacity: 0;
    }
}

/* === CAPA 5: CANVAS DE PARTÍCULAS === */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -6;
    pointer-events: none;
}

/* === ASEGURAR QUE EL CONTENIDO ESTÉ SOBRE TODO === */
.login-wrapper {
    position: relative;
    z-index: 10;
}

/* =========================================
   RESPONSIVE DESIGN - MOBILE & TABLET
   ========================================= */

/* MOBILE (< 768px) */
@media (max-width: 767px) {
    body {
        padding: 1rem;
    }

    .login-wrapper {
        max-width: 100%;
        padding: 0 1rem;
        padding-top: 50px;
    }

    /* Avatar más pequeño en móvil */
    .avatar-box {
        width: 90px;
        height: 90px;
        top: -10px;
    }

    /* Tarjeta ajustada */
    .login-card {
        padding: 3rem 1.5rem 2rem;
        border-radius: 20px;
    }

    /* Títulos */
    h2 {
        font-size: 1.3rem;
    }

    p {
        font-size: 0.85rem;
        margin-bottom: 1.5rem;
    }

    /* Inputs más compactos */
    .input-group {
        margin-bottom: 1rem;
    }

    .input-group input {
        padding: 10px 35px;
        font-size: 0.9rem;
        border-radius: 10px;
    }

    .input-icon {
        left: 12px;
        font-size: 0.9rem;
    }

    .toggle-password {
        right: 12px;
        font-size: 0.9rem;
    }

    /* Botón */
    button#login-btn {
        padding: 12px;
        font-size: 0.95rem;
        border-radius: 10px;
        margin-top: 0.75rem;
    }

    /* Nebulas más suaves en móvil */
    .nebula {
        filter: blur(60px);
        opacity: 0.2;
    }

    /* Menos meteoros en móvil (performance) */
    .meteor:nth-child(n+4) {
        display: none;
    }

    /* Burbujas más pequeñas */
    .glass-bubble {
        transform: scale(0.7);
    }
}

/* MOBILE LANDSCAPE (< 768px altura) */
@media (max-width: 767px) and (orientation: landscape) {
    .login-wrapper {
        padding-top: 30px;
    }

    .avatar-box {
        width: 70px;
        height: 70px;
        top: -5px;
    }

    .login-card {
        padding: 2.5rem 1.5rem 1.5rem;
    }

    body {
        align-items: flex-start;
        padding-top: 2rem;
        overflow-y: auto;
    }
}

/* TABLET (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .login-wrapper {
        max-width: 420px;
        padding-top: 55px;
    }

    .avatar-box {
        width: 110px;
        height: 110px;
    }

    .login-card {
        padding: 3.2rem 2.2rem 2.2rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    .input-group input {
        padding: 11px 38px;
    }

    button#login-btn {
        padding: 13px;
    }
}

/* LARGE SCREENS (> 1440px) */
@media (min-width: 1440px) {
    .login-wrapper {
        max-width: 450px;
    }

    .avatar-box {
        width: 150px;
        height: 150px;
    }

    .login-card {
        padding: 4rem 3rem 3rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    p {
        font-size: 1rem;
    }

    .input-group input {
        padding: 14px 45px;
        font-size: 1rem;
    }

    button#login-btn {
        padding: 16px;
        font-size: 1.05rem;
    }
}

/* TOUCH DEVICES - Mejoras táctiles */
@media (hover: none) and (pointer: coarse) {
    .toggle-password {
        padding: 8px;
        min-width: 44px;
        min-height: 44px;
    }

    button#login-btn {
        min-height: 48px;
    }

    .input-group input:focus {
        border-width: 2px;
    }
}