/**
 * ExamBlaze Animations
 * Slide-in, fade, and interactive animations
 *
 * @package ExamBlaze
 * @version 1.0
 */

/* ========================================
   KEYFRAME ANIMATIONS
   ======================================== */

/* Slide from Left */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-60px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide from Right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(60px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide from Top */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide from Bottom */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Fade In Scale */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Bounce In */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Pulse Glow */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(45, 212, 191, 0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(45, 212, 191, 0.6);
    }
}

/* Shimmer */
@keyframes shimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* Rotate In */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-10deg) scale(0.9);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

/* Slide Up Stagger */
@keyframes slideUpStagger {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Gradient Shift */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ========================================
   ANIMATION UTILITY CLASSES
   ======================================== */

/* Base animation class - elements start hidden */
.animate-on-scroll {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animated {
    opacity: 1;
}

/* Slide Animations */
.slide-in-left {
    opacity: 0;
    transform: translateX(-60px);
}

.slide-in-left.animated {
    animation: slideInLeft 0.7s ease forwards;
}

.slide-in-right {
    opacity: 0;
    transform: translateX(60px);
}

.slide-in-right.animated {
    animation: slideInRight 0.7s ease forwards;
}

.slide-in-up {
    opacity: 0;
    transform: translateY(40px);
}

.slide-in-up.animated {
    animation: slideInUp 0.7s ease forwards;
}

.slide-in-down {
    opacity: 0;
    transform: translateY(-40px);
}

.slide-in-down.animated {
    animation: slideInDown 0.7s ease forwards;
}

/* Fade Animations */
.fade-in {
    opacity: 0;
}

.fade-in.animated {
    animation: fadeIn 0.6s ease forwards;
}

.fade-in-scale {
    opacity: 0;
    transform: scale(0.9);
}

.fade-in-scale.animated {
    animation: fadeInScale 0.6s ease forwards;
}

/* Bounce In */
.bounce-in {
    opacity: 0;
    transform: scale(0.3);
}

.bounce-in.animated {
    animation: bounceIn 0.8s ease forwards;
}

/* Rotate In */
.rotate-in {
    opacity: 0;
    transform: rotate(-10deg) scale(0.9);
}

.rotate-in.animated {
    animation: rotateIn 0.6s ease forwards;
}

/* ========================================
   ANIMATION DELAYS
   ======================================== */

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* ========================================
   ANIMATION DURATIONS
   ======================================== */

.duration-fast { animation-duration: 0.3s; }
.duration-normal { animation-duration: 0.6s; }
.duration-slow { animation-duration: 1s; }
.duration-slower { animation-duration: 1.5s; }

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

/* Lift on hover */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Scale on hover */
.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Glow on hover */
.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(45, 212, 191, 0.5);
}

/* Glow gold on hover */
.hover-glow-gold {
    transition: box-shadow 0.3s ease;
}

.hover-glow-gold:hover {
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.5);
}

/* Shake on hover */
.hover-shake:hover {
    animation: shake 0.5s ease;
}

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

/* Rotate on hover */
.hover-rotate {
    transition: transform 0.4s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* ========================================
   CONTINUOUS ANIMATIONS
   ======================================== */

/* Floating effect */
.float {
    animation: float 3s ease-in-out infinite;
}

/* Pulse glow effect */
.pulse-glow {
    animation: pulseGlow 2s ease-in-out infinite;
}

/* Shimmer effect for text */
.shimmer {
    background: linear-gradient(
        90deg,
        var(--text-primary) 0%,
        var(--accent-gold) 50%,
        var(--text-primary) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s linear infinite;
}

/* Gradient background animation */
.gradient-animate {
    background-size: 200% 200%;
    animation: gradientShift 5s ease infinite;
}

/* ========================================
   CARD ANIMATIONS
   ======================================== */

/* Card hover with border glow */
.card-animate {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.card-animate::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-gold));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.card-animate:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.card-animate:hover::before {
    opacity: 1;
}

/* ========================================
   BUTTON ANIMATIONS
   ======================================== */

/* Button with sliding background */
.btn-slide {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
    z-index: -1;
}

.btn-slide:hover::before {
    left: 100%;
}

/* Button ripple effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

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

.btn-ripple:hover::after {
    width: 300px;
    height: 300px;
}

/* ========================================
   TEXT ANIMATIONS
   ======================================== */

/* Typewriter cursor blink */
.cursor-blink::after {
    content: '|';
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Text gradient animation */
.text-gradient-animate {
    background: linear-gradient(
        270deg,
        var(--primary-blue),
        var(--accent-gold),
        var(--primary-blue-light),
        var(--accent-orange)
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease infinite;
}

/* ========================================
   ICON ANIMATIONS
   ======================================== */

/* Spin icon on hover */
.icon-spin {
    transition: transform 0.4s ease;
}

.icon-spin:hover {
    transform: rotate(360deg);
}

/* Bounce icon */
.icon-bounce {
    animation: iconBounce 2s ease infinite;
}

@keyframes iconBounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Pulse icon */
.icon-pulse {
    animation: iconPulse 1.5s ease infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ========================================
   PAGE LOAD ANIMATIONS
   ======================================== */

/* Hero section entrance */
.hero-animate .hero-badge {
    animation: slideInDown 0.6s ease forwards;
    animation-delay: 0.2s;
    opacity: 0;
}

.hero-animate .hero-title,
.hero-animate .wgu-hero-title {
    animation: slideInUp 0.7s ease forwards;
    animation-delay: 0.4s;
    opacity: 0;
}

.hero-animate .hero-subtitle,
.hero-animate .wgu-hero-subtitle {
    animation: fadeIn 0.6s ease forwards;
    animation-delay: 0.6s;
    opacity: 0;
}

.hero-animate .hero-buttons,
.hero-animate .wgu-hero-cta {
    animation: slideInUp 0.6s ease forwards;
    animation-delay: 0.8s;
    opacity: 0;
}

.hero-animate .trust-badges-row,
.hero-animate .wgu-hero-stats {
    animation: fadeInScale 0.6s ease forwards;
    animation-delay: 1s;
    opacity: 0;
}

/* ========================================
   STAGGER ANIMATIONS FOR GRIDS
   ======================================== */

/* Apply to grid containers */
.stagger-children > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.8s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.9s; }
.stagger-children > *:nth-child(10) { animation-delay: 1s; }
.stagger-children > *:nth-child(11) { animation-delay: 1.1s; }
.stagger-children > *:nth-child(12) { animation-delay: 1.2s; }

/* ========================================
   SCROLL REVEAL BASE STYLES
   ======================================== */

[data-animate] {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-animate="slide-up"] {
    transform: translateY(40px);
}

[data-animate="slide-down"] {
    transform: translateY(-40px);
}

[data-animate="slide-left"] {
    transform: translateX(-40px);
}

[data-animate="slide-right"] {
    transform: translateX(40px);
}

[data-animate="fade"] {
    transform: none;
}

[data-animate="scale"] {
    transform: scale(0.9);
}

[data-animate].is-visible {
    opacity: 1;
    transform: translate(0) scale(1);
}

/* ========================================
   REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .animate-on-scroll,
    [data-animate] {
        opacity: 1;
        transform: none;
    }
}
