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

body, html {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    overflow: hidden;
    background: #0a0e27;
}

/* === FONDO ANIMADO === */

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(72, 52, 212, 0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 219, 222, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, rgba(131, 56, 236, 0.15) 0%, transparent 50%);
    animation: bgShift 15s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes bgShift {
    0%   { transform: translate(0, 0) rotate(0deg); }
    50%  { transform: translate(-3%, 2%) rotate(1deg); }
    100% { transform: translate(2%, -1%) rotate(-1deg); }
}

/* === PARTICULAS === */

.particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    animation: floatUp linear infinite;
}

.particle:nth-child(1) { left: 10%; animation-duration: 12s; animation-delay: 0s; width: 3px; height: 3px; }
.particle:nth-child(2) { left: 25%; animation-duration: 15s; animation-delay: 2s; width: 5px; height: 5px; }
.particle:nth-child(3) { left: 40%; animation-duration: 10s; animation-delay: 4s; }
.particle:nth-child(4) { left: 55%; animation-duration: 18s; animation-delay: 1s; width: 6px; height: 6px; }
.particle:nth-child(5) { left: 70%; animation-duration: 14s; animation-delay: 3s; width: 3px; height: 3px; }
.particle:nth-child(6) { left: 85%; animation-duration: 11s; animation-delay: 5s; }
.particle:nth-child(7) { left: 15%; animation-duration: 16s; animation-delay: 6s; width: 5px; height: 5px; }
.particle:nth-child(8) { left: 65%; animation-duration: 13s; animation-delay: 2s; width: 3px; height: 3px; }

@keyframes floatUp {
    0%   { transform: translateY(110vh) scale(0); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* === ESCENA 3D === */

.scene {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1200px;
}

/* === TARJETA LOGIN 3D === */

.login-card {
    position: relative;
    width: 420px;
    padding: 50px 40px 40px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    transform-style: preserve-3d;
    transform: rotateX(0deg) rotateY(0deg);
    transition: transform 0.1s ease-out, box-shadow 0.3s ease;
    will-change: transform;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.5),
        0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    animation: cardEntrance 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

@keyframes cardEntrance {
    0%   { opacity: 0; transform: translateY(60px) rotateX(10deg) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) rotateX(0deg) scale(1); }
}

.login-card:hover {
    box-shadow:
        0 35px 80px rgba(0, 0, 0, 0.6),
        0 0 1px rgba(255, 255, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* === BRILLO REFLEJO === */

.card-shine {
    position: absolute;
    inset: 0;
    border-radius: 24px;
    overflow: hidden;
    pointer-events: none;
    z-index: 10;
}

.card-shine::before {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: radial-gradient(
        circle at var(--shine-x, 50%) var(--shine-y, 50%),
        rgba(255, 255, 255, 0.06) 0%,
        transparent 60%
    );
    transition: none;
}

/* === ICONO === */

.card-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateZ(30px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.35);
    animation: iconFloat 4s ease-in-out infinite;
}

.card-icon svg {
    width: 28px;
    height: 28px;
    color: #fff;
}

@keyframes iconFloat {
    0%, 100% { transform: translateZ(30px) translateY(0); }
    50%      { transform: translateZ(30px) translateY(-6px); }
}

/* === TITULOS === */

.card-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
    transform: translateZ(20px);
}

.card-subtitle {
    text-align: center;
    font-size: 14px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 36px;
    transform: translateZ(15px);
}

/* === INPUTS === */

.input-group {
    position: relative;
    margin-bottom: 24px;
    transform: translateZ(10px);
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    transition: color 0.3s;
}

.input-icon svg {
    width: 18px;
    height: 18px;
    color: rgba(255, 255, 255, 0.3);
    transition: color 0.3s;
}

.input-group input {
    width: 100%;
    height: 52px;
    padding: 0 18px 0 48px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.input-group input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.input-group input:focus ~ .input-icon svg,
.input-group:focus-within .input-icon svg {
    color: #818cf8;
}

.input-line {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #a78bfa);
    border-radius: 2px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateX(-50%);
}

.input-group input:focus ~ .input-line {
    width: 92%;
}

/* === ERROR === */

.error-msg {
    text-align: center;
    color: #f87171;
    font-size: 13px;
    font-weight: 500;
    min-height: 20px;
    margin-bottom: 8px;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.3s;
}

.error-msg.show {
    opacity: 1;
    transform: translateY(0);
}

/* === BOTON === */

.btn-login {
    position: relative;
    width: 100%;
    height: 52px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    overflow: hidden;
    transform: translateZ(15px);
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.btn-login::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-login:hover {
    transform: translateZ(15px) translateY(-2px);
    box-shadow: 0 12px 35px rgba(99, 102, 241, 0.45);
}

.btn-login:hover::before {
    opacity: 1;
}

.btn-login:active {
    transform: translateZ(15px) translateY(0);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.btn-text {
    position: relative;
    z-index: 1;
    transition: opacity 0.3s;
}

.btn-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    opacity: 0;
    z-index: 1;
}

.btn-login.loading .btn-text {
    opacity: 0;
}

.btn-login.loading .btn-loader {
    opacity: 1;
    animation: spin 0.6s linear infinite;
}

.btn-login.loading {
    pointer-events: none;
}

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

/* === SHAKE === */

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

.shake {
    animation: shake 0.5s ease;
}

/* === FOOTER === */

.card-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 28px;
    transform: translateZ(5px);
}

.card-footer span {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.25);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #34d399;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4); }
    50%      { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
}

/* === RESPONSIVE === */

@media (max-width: 480px) {
    .login-card {
        width: calc(100% - 32px);
        padding: 40px 24px 32px;
        border-radius: 20px;
    }

    .card-title {
        font-size: 24px;
    }
}
