/**
 * Animación de puerta de entrada - Login LR Medicina Laboral
 * El formulario de login se abre como puertas con efecto 3D
 */

/* Wrapper con perspectiva para efecto 3D */
.login-wrapper {
    perspective: 2000px;
    position: relative;
}

/* Estado de apertura del login-card */
.login-card.door-opening {
    position: relative;
}

/* Las dos partes del login (foto y formulario) actúan como puertas */
.login-card .login-photo,
.login-card .login-body {
    transition: transform 1.4s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                opacity 1s ease;
    transform-origin: center;
    backface-visibility: visible;
}

/* Apertura de la parte izquierda (foto) */
.login-card.door-opening .login-photo {
    transform: translateX(-120%) rotateY(-25deg) scale(0.9);
    opacity: 0;
}

/* Apertura de la parte derecha (formulario) */
.login-card.door-opening .login-body {
    transform: translateX(120%) rotateY(25deg) scale(0.9);
    opacity: 0;
}

/* Overlay de efectos médicos */
.door-effects-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.door-effects-overlay.active {
    opacity: 1;
}

/* Mensaje de bienvenida central */
.welcome-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    opacity: 0;
    animation: fadeInWelcome 0.8s ease 0.6s forwards;
}

.door-effects-overlay.active .welcome-message {
    animation: fadeInWelcome 0.8s ease 0.6s forwards,
               floatWelcome 2s ease-in-out 1.4s infinite;
}

.welcome-message-title {
    font-size: 3.5rem;
    font-weight: 700;
    color: #1ea899;
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 20px rgba(30, 168, 153, 0.3);
    filter: drop-shadow(0 0 30px rgba(30, 168, 153, 0.5));
}

.welcome-message-subtitle {
    font-size: 1.5rem;
    color: #16857a;
    font-weight: 300;
}

.welcome-icon {
    font-size: 4rem;
    color: #1ea899;
    margin-bottom: 1rem;
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes fadeInWelcome {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

@keyframes floatWelcome {
    0%, 100% {
        transform: translate(-50%, -50%);
    }
    50% {
        transform: translate(-50%, -55%);
    }
}

@keyframes heartbeat {
    0%, 100% { 
        transform: scale(1); 
    }
    10%, 30% { 
        transform: scale(1.15); 
    }
    20%, 40% { 
        transform: scale(1); 
    }
}

/* Partículas médicas flotantes */
.medical-particle {
    position: absolute;
    font-size: 2.5rem;
    color: #1ea899;
    opacity: 0;
    filter: drop-shadow(0 0 20px rgba(30, 168, 153, 0.6));
    animation: floatParticle 4s ease-in-out infinite;
}

.door-effects-overlay.active .medical-particle {
    animation: floatParticle 4s ease-in-out infinite,
               fadeInParticle 0.8s ease forwards;
}

@keyframes floatParticle {
    0%, 100% {
        transform: translateY(0) rotate(0deg) scale(1);
    }
    25% {
        transform: translateY(-30px) rotate(10deg) scale(1.1);
    }
    50% {
        transform: translateY(-15px) rotate(-5deg) scale(1);
    }
    75% {
        transform: translateY(20px) rotate(5deg) scale(0.95);
    }
}

@keyframes fadeInParticle {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    100% {
        opacity: 0.8;
        transform: scale(1);
    }
}

/* Posicionamiento de partículas - distribuidas en la pantalla */
.medical-particle:nth-child(1) { 
    top: 15%; 
    left: 15%; 
    animation-delay: 0.4s; 
    color: #1ea899;
}
.medical-particle:nth-child(2) { 
    top: 20%; 
    right: 20%; 
    animation-delay: 0.6s; 
    color: #16c5b4;
}
.medical-particle:nth-child(3) { 
    bottom: 25%; 
    left: 20%; 
    animation-delay: 0.8s; 
    color: #0d9d8e;
}
.medical-particle:nth-child(4) { 
    bottom: 20%; 
    right: 18%; 
    animation-delay: 1s; 
    color: #1ea899;
}
.medical-particle:nth-child(5) { 
    top: 45%; 
    left: 8%; 
    animation-delay: 1.2s; 
    color: #16857a;
}
.medical-particle:nth-child(6) { 
    top: 50%; 
    right: 12%; 
    animation-delay: 1.4s; 
    color: #1ea899;
}

/* Ondas de energía expansivas */
.energy-wave {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border: 4px solid #1ea899;
    border-radius: 50%;
    opacity: 0;
}

.door-effects-overlay.active .energy-wave {
    animation: expandWave 2.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.energy-wave:nth-child(8) { animation-delay: 0.3s; }
.energy-wave:nth-child(9) { animation-delay: 0.6s; border-color: #16c5b4; }
.energy-wave:nth-child(10) { animation-delay: 0.9s; border-color: #0d9d8e; }

@keyframes expandWave {
    0% {
        width: 80px;
        height: 80px;
        opacity: 0.9;
    }
    100% {
        width: 1200px;
        height: 1200px;
        opacity: 0;
    }
}

/* Línea de ECG decorativa */
.ecg-line {
    position: absolute;
    bottom: 35%;
    left: 0;
    width: 100%;
    height: 3px;
    overflow: hidden;
    opacity: 0;
}

.door-effects-overlay.active .ecg-line {
    animation: fadeInECG 0.8s ease 0.5s forwards;
}

@keyframes fadeInECG {
    to {
        opacity: 0.7;
    }
}

.ecg-line-path {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1ea899;
    clip-path: polygon(
        0% 50%, 15% 50%, 17% 20%, 19% 80%, 21% 50%,
        23% 50%, 25% 10%, 27% 90%, 29% 50%, 100% 50%
    );
    animation: ecgSlide 4s linear infinite;
    filter: drop-shadow(0 0 8px rgba(30, 168, 153, 0.8));
}

@keyframes ecgSlide {
    from { 
        transform: translateX(-100%); 
    }
    to { 
        transform: translateX(200%); 
    }
}

/* Partículas brillantes pequeñas */
.sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #1ea899;
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 10px #1ea899;
}

.door-effects-overlay.active .sparkle {
    animation: sparkleAnimation 2s ease-in-out infinite;
}

.sparkle:nth-child(12) { top: 30%; left: 25%; animation-delay: 0.5s; }
.sparkle:nth-child(13) { top: 65%; left: 70%; animation-delay: 0.8s; }
.sparkle:nth-child(14) { top: 40%; right: 30%; animation-delay: 1.1s; }
.sparkle:nth-child(15) { bottom: 40%; left: 15%; animation-delay: 1.4s; }

@keyframes sparkleAnimation {
    0%, 100% {
        opacity: 0;
        transform: scale(0);
    }
    50% {
        opacity: 1;
        transform: scale(3);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .welcome-message-title {
        font-size: 2rem;
    }
    
    .welcome-message-subtitle {
        font-size: 1.2rem;
    }
    
    .welcome-icon {
        font-size: 2.5rem;
    }
    
    .medical-particle {
        font-size: 1.8rem;
    }
}
