/**
 * SecureFlow Login Suite - Animations
 *
 * @package SecureFlowLoginSuite
 */

/* Keyframes */
@keyframes secureflow-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes secureflow-scale-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes secureflow-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes secureflow-glow {
    0%, 100% {
        box-shadow: 0 0 5px var(--secureflow-color-primary, #2563eb);
    }
    50% {
        box-shadow: 0 0 20px var(--secureflow-color-primary, #2563eb);
    }
}

@keyframes secureflow-gradient-flow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes secureflow-shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

@keyframes secureflow-rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes secureflow-bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -30px, 0);
    }
    70% {
        transform: translate3d(0, -15px, 0);
    }
    90% {
        transform: translate3d(0, -4px, 0);
    }
}

/* Apply animations */
.secureflow-container {
    animation: secureflow-fade-in 0.6s ease-out;
}

.secureflow-form-wrapper {
    animation: secureflow-scale-in 0.4s ease-out;
}

.secureflow-form-group {
    animation: secureflow-slide-up 0.5s ease-out;
}

.secureflow-form-group:nth-child(1) {
    animation-delay: 0.1s;
}

.secureflow-form-group:nth-child(2) {
    animation-delay: 0.2s;
}

.secureflow-form-group:nth-child(3) {
    animation-delay: 0.3s;
}

.secureflow-form-group:nth-child(4) {
    animation-delay: 0.4s;
}

/* Button animations */
.secureflow-button {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.secureflow-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.secureflow-button:active::before {
    width: 300px;
    height: 300px;
}

.secureflow-button:hover {
    animation: secureflow-pulse 0.3s ease-in-out;
}

/* Input focus animations */
.secureflow-input {
    transition: all 0.3s ease;
}

.secureflow-input:focus {
    animation: secureflow-glow 0.3s ease-in-out;
}

/* Error animation */
.secureflow-error {
    animation: secureflow-shake 0.5s ease-in-out;
}

/* Success animation */
.secureflow-success {
    animation: secureflow-bounce 0.6s ease-in-out;
}

/* Loading animation */
.secureflow-loading {
    position: relative;
    pointer-events: none;
}

.secureflow-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: secureflow-rotate 1s linear infinite;
}

/* Logo animations */
.secureflow-logo {
    animation: secureflow-fade-in 0.8s ease-out;
}

.secureflow-site-title {
    animation: secureflow-slide-up 0.6s ease-out;
}

.secureflow-site-tagline {
    animation: secureflow-slide-up 0.7s ease-out;
}

/* Gradient background animation */
.secureflow-container.gradient-flow {
    background-size: 400% 400%;
    animation: secureflow-gradient-flow var(--secureflow-background-duration, 15s) ease infinite;
}

/* Glassmorphism effect */
.secureflow-form-wrapper.glass {
    background: var(--secureflow-color-surface, rgba(255, 255, 255, 0.1));
    backdrop-filter: var(--secureflow-effect-backdrop-blur, blur(20px));
    border: 1px solid var(--secureflow-color-surface-border, rgba(255, 255, 255, 0.2));
    box-shadow: var(--secureflow-effect-box-shadow, 0 8px 32px rgba(0, 0, 0, 0.1));
}

/* Dark theme animations */
@media (prefers-color-scheme: dark) {
    .secureflow-container {
        background: var(--secureflow-color-background, linear-gradient(135deg, #1e293b 0%, #0f172a 100%));
    }
    
    .secureflow-form-wrapper {
        background: var(--secureflow-color-surface, rgba(30, 41, 59, 0.8));
        backdrop-filter: var(--secureflow-effect-backdrop-blur, blur(20px));
    }
}

/* Dark Pro theme glow effects */
.secureflow-container.dark-pro .secureflow-button-primary {
    box-shadow: var(--secureflow-effect-glow-primary, 0 0 20px rgba(0, 212, 255, 0.5));
}

.secureflow-container.dark-pro .secureflow-button-primary:hover {
    box-shadow: var(--secureflow-effect-glow-primary, 0 0 30px rgba(0, 212, 255, 0.7));
}

.secureflow-container.dark-pro .secureflow-site-title {
    text-shadow: var(--secureflow-effect-text-glow, 0 0 10px rgba(0, 212, 255, 0.3));
}

/* Hover animations */
.secureflow-link {
    position: relative;
    overflow: hidden;
}

.secureflow-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width 0.3s ease;
}

.secureflow-link:hover::after {
    width: 100%;
}

/* Focus animations */
.secureflow-input:focus,
.secureflow-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Micro-interactions */
.secureflow-checkbox:hover .secureflow-checkbox-indicator {
    transform: scale(1.05);
}

.secureflow-password-toggle:hover {
    transform: scale(1.1);
}

/* Page transition animations */
.secureflow-page-transition-enter {
    opacity: 0;
    transform: translateX(20px);
}

.secureflow-page-transition-enter-active {
    opacity: 1;
    transform: translateX(0);
    transition: all 0.3s ease;
}

.secureflow-page-transition-exit {
    opacity: 1;
    transform: translateX(0);
}

.secureflow-page-transition-exit-active {
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s ease;
}

/* Responsive animations */
@media (max-width: 768px) {
    .secureflow-container {
        animation: secureflow-fade-in 0.4s ease-out;
    }
    
    .secureflow-form-wrapper {
        animation: secureflow-slide-up 0.5s ease-out;
    }
}
