/* ===== LOGO ANIMATION ENHANCEMENTS ===== */
/* Makhzoumi Foundation Logo Animation Styles for Login Page */
/* These styles override and enhance the base logo styles from Login.css */

/* Enhanced logo with entrance animation - Override base styles */
.login-header .logo-container .logo {
    width: 80px !important;
    height: 80px !important;
    border-radius: var(--radius-lg, 16px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.25s ease-in-out !important;
    position: relative;
    cursor: pointer;
    /* Initial state for animation */
    opacity: 0;
    transform: scale(0.3) rotate(-10deg) translateY(-20px);
    animation: logoEntrance 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    animation-delay: 0.5s;
}

/* Ensure logo stays visible after animation completes */
.login-header .logo-container .logo.animation-complete {
    opacity: 1 !important;
    transform: scale(1) rotate(0deg) translateY(0px) !important;
    animation: none !important;
}

/* Logo entrance animation with bounce effect */
@keyframes logoEntrance {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-15deg) translateY(-30px);
        filter: blur(4px);
    }
    30% {
        opacity: 0.6;
        transform: scale(1.2) rotate(8deg) translateY(5px);
        filter: blur(2px);
    }
    60% {
        opacity: 0.9;
        transform: scale(0.85) rotate(-3deg) translateY(-2px);
        filter: blur(1px);
    }
    80% {
        opacity: 1;
        transform: scale(1.08) rotate(2deg) translateY(0px);
        filter: blur(0px);
    }
    100% {
        opacity: 1 !important;
        transform: scale(1) rotate(0deg) translateY(0px) !important;
        filter: blur(0px);
    }
}

/* Hover effect enhancement - Override base hover */
.login-header .logo-container .logo:hover {
    transform: scale(1.08) rotate(3deg) !important;
    box-shadow: 0 8px 25px rgba(26, 92, 56, 0.4) !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

/* Subtle glow effect that appears after entrance */
.logo::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: radial-gradient(
        circle,
        rgba(26, 92, 56, 0.3) 0%,
        rgba(26, 92, 56, 0.1) 40%,
        transparent 70%
    );
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    transform: scale(0.8);
    animation: logoGlow 4s ease-in-out infinite alternate;
    animation-delay: 2s;
}

@keyframes logoGlow {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 0.6;
        transform: scale(1.3);
    }
}

/* Floating animation for subtle continuous movement */
.logo::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    z-index: -2;
    animation: logoFloat 8s ease-in-out infinite;
    animation-delay: 3s;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-3px) rotate(1deg);
    }
    50% {
        transform: translateY(0px) rotate(0deg);
    }
    75% {
        transform: translateY(-2px) rotate(-1deg);
    }
}

/* Click/tap effect */
.logo:active {
    transform: scale(0.92) rotate(-2deg);
    transition: transform 0.1s ease-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Focus effect for accessibility */
.logo:focus {
    outline: 3px solid #1a5c38;
    outline-offset: 6px;
    transform: scale(1.1);
    box-shadow: 0 0 0 6px rgba(26, 92, 56, 0.2);
}

/* Sparkle effect on hover */
.logo-container:hover .logo::before {
    animation: logoSparkle 1s ease-out, logoGlow 4s ease-in-out infinite alternate;
}

@keyframes logoSparkle {
    0% {
        opacity: 0.6;
        transform: scale(1.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.6);
    }
    100% {
        opacity: 0.6;
        transform: scale(1.3);
    }
}

/* Pulse effect on page load completion */
.logo.pulse-once {
    animation: logoEntrance 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards,
               logoPulseOnce 1s ease-out 2.5s;
}

@keyframes logoPulseOnce {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(0,0,0,.15);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 12px 30px rgba(26, 92, 56, 0.5);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(0,0,0,.15);
    }
}

/* Enhanced rotation effect for special occasions */
.logo.celebrate {
    animation: logoCelebrate 2s ease-in-out;
}

@keyframes logoCelebrate {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(90deg); }
    50% { transform: scale(1.2) rotate(180deg); }
    75% { transform: scale(1.1) rotate(270deg); }
    100% { transform: scale(1) rotate(360deg); }
}

/* Breathing effect for emphasis */
.logo.breathing {
    animation: logoBreathe 3s ease-in-out infinite;
}

@keyframes logoBreathe {
    0%, 100% {
        transform: scale(1) rotate(0deg) translateY(0px);
        opacity: 1;
    }
    50% {
        transform: scale(1.05) rotate(0deg) translateY(0px);
        opacity: 0.95;
    }
}

/* Shake effect for error states */
.logo.shake {
    animation: logoShake 0.6s ease-in-out;
}

@keyframes logoShake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px) rotate(-2deg); }
    20%, 40%, 60%, 80% { transform: translateX(3px) rotate(2deg); }
}

/* Success bounce effect */
.logo.success-bounce {
    animation: logoSuccessBounce 0.8s ease-out;
}

@keyframes logoSuccessBounce {
    0% { transform: scale(1); }
    30% { transform: scale(1.3); }
    50% { transform: scale(1.1); }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Loading spinner overlay for authentication */
.logo-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 96px;
    height: 96px;
    margin: -48px 0 0 -48px;
    border: 3px solid rgba(26, 92, 56, 0.2);
    border-top: 3px solid #1a5c38;
    border-radius: 50%;
    animation: logoLoadingSpin 1s linear infinite;
    z-index: 10;
}

@keyframes logoLoadingSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Staggered animation for logo and brand elements */
.login-header.animate-stagger .logo {
    animation-delay: 0.3s;
}

.login-header.animate-stagger .brand-name {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: 0.8s;
}

.login-header.animate-stagger .brand-subtitle {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: 1s;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Particle effect for special animations */
.logo-container.particles::before {
    content: '?';
    position: absolute;
    top: -10px;
    left: -10px;
    font-size: 12px;
    opacity: 0;
    animation: logoParticle1 2s ease-out infinite;
    animation-delay: 1s;
}

.logo-container.particles::after {
    content: '?';
    position: absolute;
    bottom: -10px;
    right: -10px;
    font-size: 10px;
    opacity: 0;
    animation: logoParticle2 2.5s ease-out infinite;
    animation-delay: 1.5s;
}

@keyframes logoParticle1 {
    0% {
        opacity: 0;
        transform: translateY(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: translateY(-20px) rotate(180deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px) rotate(360deg);
    }
}

@keyframes logoParticle2 {
    0% {
        opacity: 0;
        transform: translateY(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: translateY(20px) rotate(-180deg);
    }
    100% {
        opacity: 0;
        transform: translateY(40px) rotate(-360deg);
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .logo {
        animation: logoEntranceSimple 0.6s ease-out forwards;
        animation-delay: 0.2s;
    }
    
    .logo::before,
    .logo::after,
    .logo-container.particles::before,
    .logo-container.particles::after {
        animation: none !important;
        opacity: 0 !important;
    }
    
    .logo:hover {
        transform: scale(1.03);
        transition: transform 0.2s ease;
    }
    
    .logo.pulse-once,
    .logo.celebrate,
    .logo.breathing,
    .logo.shake,
    .logo.success-bounce {
        animation: none !important;
    }
    
    .login-header.animate-stagger .brand-name,
    .login-header.animate-stagger .brand-subtitle {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

@keyframes logoEntranceSimple {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
    .logo::before {
        display: none !important;
    }
    
    .logo:focus {
        outline: 4px solid #000000;
        outline-offset: 4px;
        box-shadow: none;
    }
    
    .logo:hover {
        box-shadow: 0 4px 8px #000000;
    }
}

/* Dark mode enhancements (if ever implemented) */
@media (prefers-color-scheme: dark) {
    .logo::before {
        background: radial-gradient(
            circle,
            rgba(74, 158, 255, 0.3) 0%,
            rgba(74, 158, 255, 0.1) 40%,
            transparent 70%
        );
    }
    
    .logo:focus {
        outline-color: #4a9eff;
        box-shadow: 0 0 0 6px rgba(74, 158, 255, 0.2);
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .logo {
        width: 70px;
        height: 70px;
        animation-duration: 1s;
    }
    
    .logo::before {
        top: -8px;
        left: -8px;
        right: -8px;
        bottom: -8px;
    }
    
    .logo:hover {
        transform: scale(1.05);
    }
    
    @keyframes logoFloat {
        0%, 100% {
            transform: translateY(0px);
        }
        50% {
            transform: translateY(-2px);
        }
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .logo {
        width: 60px;
        height: 60px;
    }
    
    .logo:hover {
        transform: scale(1.03);
    }
}

/* Print styles - remove animations */
@media print {
    .logo {
        animation: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
    
    .logo::before,
    .logo::after {
        display: none !important;
    }
}

/* Final fallback to ensure logo is always visible */
.login-header .logo-container .logo:not(.breathing):not(.celebrate):not(.shake):not(.success-bounce):not(.pulse-once) {
    opacity: 1 !important;
}

/* Specific override for completed animations */
.login-header .logo-container .logo.animation-complete:not(:hover):not(:active):not(:focus) {
    opacity: 1 !important;
    transform: scale(1) rotate(0deg) translateY(0px) !important;
}

/* Ensure logo is visible after any animation completes */
.logo {
    animation-fill-mode: forwards !important;
}

/* Fallback for when JavaScript doesn't load - show logo after a delay */
.login-header .logo-container .logo {
    animation: logoEntrance 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards,
               logoFallbackVisible 0.1s ease-out 3s forwards;
}

@keyframes logoFallbackVisible {
    100% {
        opacity: 1 !important;
        transform: scale(1) rotate(0deg) translateY(0px) !important;
    }
}