/**
 * SleepCheck Website - Animations
 * Subtle, professional animations for headers, icons, and page elements
 */

/* ===== Green Header Background Animation ===== */
@keyframes subtleGradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.animated-header {
    background: linear-gradient(
        135deg,
        #8DC63F 0%,
        #7AB635 25%,
        #8DC63F 50%,
        #7AB635 75%,
        #8DC63F 100%
    );
    background-size: 400% 400%;
    animation: subtleGradientShift 15s ease infinite;
}

/* ===== Heading Animations ===== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Heading animation classes */
.animate-heading {
    opacity: 0;
    animation: fadeInDown 0.8s ease-out forwards;
}

.animate-subheading {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 0.2s forwards;
}

.animate-fade-in {
    opacity: 0;
    animation: fadeIn 1s ease-out forwards;
}

/* Staggered animation delays */
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }
.animate-delay-6 { animation-delay: 0.6s; }

/* ===== Icon Animations ===== */
@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes iconBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes iconRotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes iconFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

/* Icon animation classes */
.icon-pulse {
    animation: iconPulse 2s ease-in-out infinite;
}

.icon-bounce {
    animation: iconBounce 2s ease-in-out infinite;
}

.icon-float {
    animation: iconFloat 3s ease-in-out infinite;
}

.icon-pulse-hover:hover {
    animation: iconPulse 0.6s ease-in-out;
}

/* ===== SVG Icon Animations ===== */
@keyframes svgDraw {
    to {
        stroke-dashoffset: 0;
    }
}

.svg-animated path,
.svg-animated circle,
.svg-animated line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: svgDraw 2s ease-out forwards;
}

.svg-animated path:nth-child(1) { animation-delay: 0s; }
.svg-animated path:nth-child(2) { animation-delay: 0.2s; }
.svg-animated path:nth-child(3) { animation-delay: 0.4s; }

/* SVG Fill Animation */
@keyframes svgFill {
    from {
        fill: transparent;
    }
    to {
        fill: #8DC63F;
    }
}

.svg-fill-animated {
    animation: svgFill 1s ease-out 0.5s forwards;
}

/* ===== Card Entrance Animations ===== */
@keyframes cardSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.card-animate {
    opacity: 0;
}

.card-animate.in-view {
    animation: cardSlideUp 0.6s ease-out forwards;
}

/* ===== Section Animations ===== */
.section-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.section-animate.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Text Shimmer Effect (subtle) ===== */
@keyframes textShimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

.text-shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.8) 0%,
        rgba(255, 255, 255, 1) 50%,
        rgba(255, 255, 255, 0.8) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    animation: textShimmer 3s linear infinite;
}

/* ===== Scroll-triggered Animations ===== */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scroll-reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* ===== Counter Animation (for numbers) ===== */
@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.counter-animate {
    animation: countUp 0.8s ease-out;
}

/* ===== Button Hover Animations ===== */
.btn-hover-lift {
    transition: all 0.3s ease;
}

.btn-hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(141, 198, 63, 0.4);
}

/* ===== Badge Animations ===== */
@keyframes badgePop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.badge-animate {
    animation: badgePop 0.5s ease-out;
}

/* ===== Loading Animations ===== */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer-loading {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* ===== Reduced Motion Support ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .animated-header {
        animation: none;
        background: linear-gradient(135deg, #8DC63F 0%, #7AB635 100%);
    }
}

/* ===== Mobile Optimizations ===== */
@media (max-width: 768px) {
    .animate-heading,
    .animate-subheading {
        animation-duration: 0.6s;
    }

    .scroll-reveal,
    .scroll-reveal-left,
    .scroll-reveal-right {
        transform: translateY(20px);
    }

    .card-animate.in-view {
        animation-duration: 0.5s;
    }
}