/* ===================================
   IPEDUS Sports Academy - Animations
   Lightweight CSS Animations
   =================================== */

/* ===== HERO ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes appear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hero Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.animate-slide-up {
    animation: slideUp 0.8s ease-out forwards;
    opacity: 0;
}

.animate-slide-up.delay-1 {
    animation-delay: 0.3s;
}

.animate-appear {
    animation: appear 0.6s ease-out forwards;
    opacity: 0;
}

.animate-appear.delay-2 {
    animation-delay: 0.6s;
}

/* ===== SCROLL ANIMATIONS ===== */
.fade-in-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered Animation for Program Cards */
.fade-in-stagger {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.fade-in-stagger.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Stagger Delays */
.fade-in-stagger[data-delay="0"].is-visible {
    transition-delay: 0ms;
}

.fade-in-stagger[data-delay="1"].is-visible {
    transition-delay: 100ms;
}

.fade-in-stagger[data-delay="2"].is-visible {
    transition-delay: 200ms;
}

.fade-in-stagger[data-delay="3"].is-visible {
    transition-delay: 300ms;
}

.fade-in-stagger[data-delay="4"].is-visible {
    transition-delay: 400ms;
}

.fade-in-stagger[data-delay="5"].is-visible {
    transition-delay: 500ms;
}

.fade-in-stagger[data-delay="6"].is-visible {
    transition-delay: 600ms;
}

/* ===== HOVER ANIMATIONS ===== */

/* Button Hover (already in styles.css, but enhancement here) */
.btn {
    position: relative;
    overflow: hidden;
}

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

.btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Card Hover Glow Effect */
.program-card {
    position: relative;
}

.program-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: var(--radius-md);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.program-card:hover::before {
    opacity: 0.3;
}

/* Icon Bounce on Hover */
.program-card:hover .program-icon {
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ===== LOADING & SPINNER ANIMATIONS ===== */

/* Button Loading State */
.btn-submit:disabled .btn-text {
    opacity: 0;
}

.btn-submit:disabled .btn-loader {
    display: inline-block !important;
}

/* Spinner Animation (already defined in styles.css) */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== SMOOTH SCROLL INDICATOR ===== */
@keyframes scrollIndicator {
    0%, 100% {
        opacity: 0;
        transform: translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateY(10px);
    }
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    animation: scrollIndicator 2s infinite;
}

/* ===== FORM ANIMATIONS ===== */

/* Input Focus Animation */
.form-group input:focus {
    animation: inputFocus 0.3s ease;
}

@keyframes inputFocus {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* Success Message Slide In */
.form-message.success {
    animation: slideInFromTop 0.5s ease-out;
}

.form-message.error {
    animation: shake 0.5s ease-out;
}

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

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

/* ===== NAVIGATION ANIMATIONS ===== */

/* Mobile Menu Slide In */
.nav-menu {
    animation: slideDown 0.3s ease-out;
}

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

/* Header Slide Down on Show */
.header {
    animation: headerSlideDown 0.3s ease-out;
}

@keyframes headerSlideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ===== BACKGROUND ANIMATIONS ===== */

/* Gradient Animation (Optional Enhancement) */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.hero-animated-bg {
    background: linear-gradient(135deg, var(--dark-color), var(--accent-color), var(--dark-color));
    background-size: 200% 200%;
    animation: gradientShift 10s ease infinite;
}

/* ===== FLOATING ELEMENTS ===== */

/* WhatsApp Button Pulse */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(37, 211, 102, 0);
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* Use GPU acceleration for better performance */
.animate-fade-in,
.animate-slide-up,
.animate-appear,
.fade-in-section,
.fade-in-stagger {
    will-change: opacity, transform;
}

/* Remove will-change after animation completes */
.fade-in-section.is-visible,
.fade-in-stagger.is-visible {
    will-change: auto;
}

/* ===== ACCESSIBILITY ===== */

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .fade-in-section,
    .fade-in-stagger {
        opacity: 1;
        transform: none;
    }
}

/* ===== PAGE LOAD ANIMATION ===== */

/* Prevent flash of unstyled content */
body {
    opacity: 0;
    animation: pageLoad 0.5s ease-out 0.1s forwards;
}

@keyframes pageLoad {
    to {
        opacity: 1;
    }
}

/* ===== CUSTOM ANIMATIONS FOR SPECIFIC SECTIONS ===== */

/* Mission Box Highlight */
.mission-box {
    animation: missionHighlight 2s ease-in-out infinite;
}

@keyframes missionHighlight {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(249, 92, 61, 0);
    }
    50% {
        box-shadow: 0 0 20px 5px rgba(249, 92, 61, 0.2);
    }
}

/* Benefit Icon Rotation on Scroll In */
.benefit-card.is-visible .benefit-icon {
    animation: iconRotate 0.6s ease-out;
}

@keyframes iconRotate {
    from {
        transform: rotate(-10deg) scale(0.8);
        opacity: 0;
    }
    to {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
}

/* ===== IMAGE LAZY LOAD ANIMATION ===== */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}
