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

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Decoración de fondo animada mejorada */
.background-decoration {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    animation: float 10s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.7), transparent);
    top: -250px;
    left: -250px;
    animation-delay: 0s;
}

.orb-2 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.6), transparent);
    bottom: -200px;
    right: -200px;
    animation-delay: 3s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.5), transparent);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 6s;
}

@keyframes float {
    0%, 100% { 
        transform: translate(0, 0) scale(1);
        opacity: 0.5;
    }
    33% { 
        transform: translate(40px, -40px) scale(1.15);
        opacity: 0.6;
    }
    66% { 
        transform: translate(-30px, 30px) scale(0.95);
        opacity: 0.4;
    }
}

.grid-pattern {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.6;
    animation: grid-move 20s linear infinite;
}

@keyframes grid-move {
    0% { transform: translate(0, 0); }
    100% { transform: translate(60px, 60px); }
}

/* Container principal mejorado */
.login-container {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-box {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    padding: 55px 50px;
    border-radius: 28px;
    width: 100%;
    max-width: 460px;
    box-shadow: 
        0 30px 90px rgba(0, 0, 0, 0.6),
        0 0 1px rgba(255, 255, 255, 0.3) inset,
        0 10px 40px rgba(102, 126, 234, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.18);
    position: relative;
    animation: box-entrance 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes box-entrance {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(102, 126, 234, 0.8), 
        rgba(168, 85, 247, 0.8), 
        transparent
    );
    border-radius: 28px 28px 0 0;
}

/* Logo y encabezado mejorado */
.logo-section {
    text-align: center;
    margin-bottom: 45px;
}

.logo-container {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #a855f7 100%);
    border-radius: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 
        0 20px 40px rgba(102, 126, 234, 0.5),
        0 0 60px rgba(168, 85, 247, 0.3);
    animation: pulse-logo 4s ease-in-out infinite;
    position: relative;
    transform-style: preserve-3d;
}

.logo-container::before {
    content: '';
    position: absolute;
    inset: -3px;
    background: linear-gradient(135deg, #667eea, #764ba2, #a855f7);
    border-radius: 26px;
    z-index: -1;
    opacity: 0;
    animation: glow 4s ease-in-out infinite;
}

.logo-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.3), transparent);
    border-radius: 24px;
    opacity: 0.5;
}

@keyframes pulse-logo {
    0%, 100% { 
        transform: scale(1) rotateY(0deg);
        box-shadow: 0 20px 40px rgba(102, 126, 234, 0.5);
    }
    50% { 
        transform: scale(1.08) rotateY(5deg);
        box-shadow: 0 25px 50px rgba(168, 85, 247, 0.6);
    }
}

@keyframes glow {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.5; }
}

.logo-container svg {
    width: 45px;
    height: 45px;
    color: white;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.login-box h1 {
    color: #ffffff;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.8px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.subtitle {
    color: rgba(255, 255, 255, 0.75);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.4px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Mensaje de error mejorado */
.login-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.2));
    backdrop-filter: blur(10px);
    color: #fecaca;
    padding: 16px 18px;
    border-radius: 14px;
    margin-bottom: 28px;
    font-size: 14px;
    font-weight: 500;
    border: 1.5px solid rgba(239, 68, 68, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: shake 0.5s ease-in-out, error-glow 2s ease-in-out infinite;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
}

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

@keyframes error-glow {
    0%, 100% { box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2); }
    50% { box-shadow: 0 4px 25px rgba(239, 68, 68, 0.4); }
}

.error-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: #fca5a5;
    filter: drop-shadow(0 2px 4px rgba(239, 68, 68, 0.3));
}

/* Formulario mejorado */
.login-form {
    margin-bottom: 35px;
}

.input-group {
    margin-bottom: 24px;
}

.input-group label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 18px;
    width: 22px;
    height: 22px;
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.login-box input {
    width: 100%;
    padding: 16px 20px 16px 54px;
    border-radius: 14px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    font-size: 15px;
    font-family: inherit;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.login-box input::placeholder {
    color: rgba(255, 255, 255, 0.35);
    font-weight: 400;
}

.login-box input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.8);
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.2),
        0 8px 20px rgba(102, 126, 234, 0.25);
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.input-wrapper:focus-within .input-icon {
    color: rgba(102, 126, 234, 1);
    transform: scale(1.1);
}

/* Botón mejorado con efecto glassmorphism */
.login-button {
    width: 100%;
    padding: 17px 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 6px 20px rgba(102, 126, 234, 0.4),
        0 0 40px rgba(102, 126, 234, 0.2);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 14px;
}

.login-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.login-button::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    padding: 2px;
    background: linear-gradient(135deg, rgba(255,255,255,0.4), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.login-button:hover {
    background: linear-gradient(135deg, #764ba2 0%, #a855f7 100%);
    box-shadow: 
        0 8px 30px rgba(118, 75, 162, 0.5),
        0 0 60px rgba(168, 85, 247, 0.4);
    transform: translateY(-3px) scale(1.02);
}

.login-button:hover::before {
    left: 100%;
}

.login-button:hover::after {
    opacity: 1;
}

.login-button:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 
        0 4px 15px rgba(102, 126, 234, 0.4),
        0 0 30px rgba(102, 126, 234, 0.3);
}

.button-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-button:hover .button-icon {
    transform: translateX(6px);
}

.login-button.loading {
    pointer-events: none;
    opacity: 0.7;
}

.login-button.loading .button-text {
    opacity: 0.5;
}

.login-button.loading .button-icon {
    animation: spin 1s linear infinite;
}

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

/* Aviso de seguridad mejorado */
.security-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 500;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.security-notice svg {
    width: 18px;
    height: 18px;
    color: #10b981;
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.5));
    animation: shield-pulse 3s ease-in-out infinite;
}

@keyframes shield-pulse {
    0%, 100% { 
        transform: scale(1);
        filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.5));
    }
    50% { 
        transform: scale(1.1);
        filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.7));
    }
}

/* Efectos de partículas flotantes */
.login-box::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.15), transparent);
    border-radius: 50%;
    top: -100px;
    right: -100px;
    pointer-events: none;
    animation: particle-float 8s ease-in-out infinite;
}

@keyframes particle-float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-20px, -20px); }
}

/* Responsive mejorado */
@media (max-width: 480px) {
    .login-box {
        padding: 45px 35px;
        border-radius: 24px;
        max-width: 95%;
    }

    .login-box h1 {
        font-size: 28px;
    }

    .logo-container {
        width: 80px;
        height: 80px;
    }

    .logo-container svg {
        width: 40px;
        height: 40px;
    }

    .login-button {
        padding: 15px 24px;
        font-size: 13px;
    }

    .login-box input {
        padding: 14px 18px 14px 50px;
    }
}

/* Animación de entrada de elementos */
.input-group {
    animation: slide-up 0.6s ease-out backwards;
}

.input-group:nth-child(1) { animation-delay: 0.1s; }
.input-group:nth-child(2) { animation-delay: 0.2s; }
.login-button { animation: slide-up 0.6s ease-out 0.3s backwards; }
.security-notice { animation: fade-in 0.8s ease-out 0.4s backwards; }

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}