/* =============================================
   Logan Health - Animations
   ============================================= */

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

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

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

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

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

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

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

@keyframes checkmark {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* =============================================
   Scroll Animation Classes
   ============================================= */
.animate-fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.animate-fade-up.delay-100 {
    transition-delay: 100ms;
}

.animate-fade-up.delay-200 {
    transition-delay: 200ms;
}

.animate-fade-up.delay-300 {
    transition-delay: 300ms;
}

.animate-fade-up.delay-400 {
    transition-delay: 400ms;
}

.animate-fade-up.delay-500 {
    transition-delay: 500ms;
}

.animate-fade-up.delay-600 {
    transition-delay: 600ms;
}

.animate-fade-up.delay-700 {
    transition-delay: 700ms;
}

/* =============================================
   Hero Animations
   ============================================= */
.hero-bg::before {
    animation: float 20s ease-in-out infinite;
}

.hero-card {
    animation: scaleIn 0.8s ease forwards;
    animation-delay: 0.3s;
}

/* Gradient text shimmer effect */
.text-gradient {
    background-size: 200% auto;
    animation: gradientFlow 4s ease infinite;
}

/* =============================================
   Button Animations
   ============================================= */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    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 ease, height 0.6s ease;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

/* =============================================
   Card Hover Animations
   ============================================= */
.step-card,
.treatment-card,
.faq-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.step-card:hover,
.treatment-card:hover {
    transform: translateY(-8px);
}

/* =============================================
   Progress Bar Animation
   ============================================= */
.progress-fill {
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================
   Form Animations
   ============================================= */
.form-step {
    animation: fadeIn 0.4s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    animation: pulse 0.3s ease;
}

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

.form-input.error,
.form-select.error {
    animation: shake 0.5s ease;
}

/* =============================================
   Result Animations
   ============================================= */
.result-icon {
    animation: scaleIn 0.5s ease;
}

.result-icon.success svg {
    animation: pulse 2s ease infinite;
}

.result-icon.success svg path:last-child {
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: checkmark 0.8s ease forwards;
    animation-delay: 0.3s;
}

/* =============================================
   FAQ Animations
   ============================================= */
.faq-icon {
    transition: transform 0.3s ease;
}

.faq-item.active .faq-icon {
    transform: rotate(180deg);
}

.faq-answer {
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================
   Loading Spinner
   ============================================= */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* =============================================
   Phone Mockup Animations
   ============================================= */
.phone-frame {
    animation: float 6s ease-in-out infinite;
}

.app-chart svg path:first-child {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: drawChart 2s ease forwards;
    animation-delay: 0.5s;
}

@keyframes drawChart {
    to {
        stroke-dashoffset: 0;
    }
}

/* =============================================
   Navigation Animations
   ============================================= */
.navbar {
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-primary);
    transition: width 0.3s ease;
}

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

.nav-toggle span {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* =============================================
   Trust Badge Animations
   ============================================= */
.trust-badge {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

.trust-badge:nth-child(1) {
    animation-delay: 0.6s;
}

.trust-badge:nth-child(2) {
    animation-delay: 0.7s;
}

.trust-badge:nth-child(3) {
    animation-delay: 0.8s;
}

/* =============================================
   Stat Number Counter Animation
   ============================================= */
.stat-number {
    display: inline-block;
}

/* =============================================
   App Store Buttons Hover
   ============================================= */
.app-button {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.app-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* =============================================
   Feature Icon Animations
   ============================================= */
.glper-features .feature-icon {
    transition: transform 0.3s ease, background 0.3s ease;
}

.glper-features li:hover .feature-icon {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.2);
}

.about-feature .feature-icon {
    transition: transform 0.3s ease;
}

.about-feature:hover .feature-icon {
    transform: scale(1.1);
}

/* =============================================
   Scroll Indicator (optional hero addition)
   ============================================= */
.scroll-indicator {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    animation: bounce 2s ease infinite;
}

/* =============================================
   Skeleton Loading (for future use)
   ============================================= */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-border-light) 25%,
        var(--color-border) 50%,
        var(--color-border-light) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* =============================================
   Reduced Motion Support
   ============================================= */
@media (prefers-reduced-motion: reduce) {
    .animate-fade-up {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .hero-bg::before,
    .phone-frame,
    .text-gradient,
    .trust-badge,
    .result-icon.success svg {
        animation: none;
    }

    .btn::after {
        display: none;
    }

    .step-card:hover,
    .treatment-card:hover {
        transform: none;
    }

    .faq-answer {
        transition: none;
    }

    .progress-fill {
        transition: none;
    }

    /* GSAP animated elements - ensure visibility */
    .hero-title,
    .hero-subtitle,
    .hero-cta .btn,
    .trust-badge,
    .hero-stat-card,
    .section-header,
    .step-card,
    .step-connector,
    .treatment-card,
    .testimonial-card,
    .story-card,
    .faq-item,
    .blog-card,
    .comparison-table-wrapper,
    .treatments-info,
    .glper-text,
    .glper-mockup,
    .glper-features li,
    .app-buttons,
    .meet-team-content,
    .about-content,
    .about-image,
    .steps-cta {
        opacity: 1 !important;
        transform: none !important;
    }
}
