/* ========================================
   MIETERLISTE.COM - Animations
   ======================================== */

/* ========================================
   Fade In Animations
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

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

/* ========================================
   Scale Animations
   ======================================== */

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

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

/* ========================================
   Float Animation (for demo card)
   ======================================== */

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

/* ========================================
   Slide Animations
   ======================================== */

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

/* ========================================
   Shimmer Animation (loading state)
   ======================================== */

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

/* ========================================
   Badge Glow Animation
   ======================================== */

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(27, 107, 58, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(27, 107, 58, 0.5);
    }
}

/* ========================================
   Arrow Bounce Animation
   ======================================== */

@keyframes arrowBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(5px);
    }
}

/* ========================================
   Animation Classes
   ======================================== */

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

.animate-fade-in-up {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.animate-fade-in-down {
    opacity: 0;
    animation: fadeInDown 0.6s ease forwards;
}

.animate-fade-in-left {
    opacity: 0;
    animation: fadeInLeft 0.6s ease forwards;
}

.animate-fade-in-right {
    opacity: 0;
    animation: fadeInRight 0.6s ease forwards;
}

.animate-scale-in {
    opacity: 0;
    animation: scaleIn 0.5s ease forwards;
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

/* ========================================
   Animation Delays
   ======================================== */

.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-600 { animation-delay: 600ms; }
.delay-700 { animation-delay: 700ms; }
.delay-800 { animation-delay: 800ms; }

/* ========================================
   Scroll-triggered Animation Classes
   ======================================== */

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-scale.revealed {
    opacity: 1;
    transform: scale(1);
}

/* ========================================
   Stagger Delays for Reveal
   ======================================== */

.stagger-1 { transition-delay: 100ms; }
.stagger-2 { transition-delay: 200ms; }
.stagger-3 { transition-delay: 300ms; }
.stagger-4 { transition-delay: 400ms; }
.stagger-5 { transition-delay: 500ms; }

/* ========================================
   Initial Page Load Animations
   ======================================== */

.hero-badge {
    opacity: 0;
    animation: fadeInDown 0.5s ease 0.2s forwards;
}

.hero-title {
    opacity: 0;
    animation: fadeInUp 0.6s ease 0.3s forwards;
}

.hero-subtitle {
    opacity: 0;
    animation: fadeInUp 0.6s ease 0.4s forwards;
}

.hero-cta {
    opacity: 0;
    animation: fadeInUp 0.6s ease 0.5s forwards;
}

.hero-stats {
    opacity: 0;
    animation: fadeInUp 0.6s ease 0.6s forwards;
}

.hero-demo {
    opacity: 0;
    animation: fadeInRight 0.8s ease 0.4s forwards;
}

/* ========================================
   Demo Arrow Animation
   ======================================== */

.demo-arrow svg {
    animation: arrowBounce 1.5s ease-in-out infinite;
}

/* ========================================
   Pricing Badge Glow
   ======================================== */

.pricing-badge {
    animation: glow 2s ease-in-out infinite;
}

/* ========================================
   Hover Transitions
   ======================================== */

.step-card,
.testimonial-card,
.pricing-card,
.faq-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* ========================================
   Button Hover Effects
   ======================================== */

.btn {
    position: relative;
    overflow: hidden;
}

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

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

/* ========================================
   Form Focus Animation
   ======================================== */

.form-input {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.form-input:focus {
    transform: translateY(-1px);
}

/* ========================================
   Success Message Animation
   ======================================== */

.success-message:not(.hidden) {
    animation: scaleIn 0.5s ease forwards;
}

.success-icon svg {
    animation: scaleIn 0.5s ease 0.2s forwards;
    opacity: 0;
}

.success-message:not(.hidden) .success-icon svg {
    opacity: 1;
}

/* ========================================
   Reduced Motion Support
   ======================================== */

/* ========================================
   PDF to Table Extraction Animation
   Total Duration: 5s loop (Vertical)
   ======================================== */

/* PDF flies in from top */
@keyframes pdfSlideIn {
    0%, 5% {
        opacity: 0;
        transform: translateY(-50px);
    }
    15%, 35% {
        opacity: 1;
        transform: translateY(0);
    }
    45%, 100% {
        opacity: 0;
        transform: translateY(30px);
    }
}

/* Engine rattle/shake effect */
@keyframes engineRattle {
    0%, 20% {
        transform: translateX(0);
    }
    22% {
        transform: translateX(-2px) rotate(-0.5deg);
    }
    23% {
        transform: translateX(2px) rotate(0.5deg);
    }
    24% {
        transform: translateX(-2px) rotate(-0.5deg);
    }
    25% {
        transform: translateX(2px) rotate(0.5deg);
    }
    26% {
        transform: translateX(-2px) rotate(-0.5deg);
    }
    27% {
        transform: translateX(2px) rotate(0.5deg);
    }
    28% {
        transform: translateX(-1px) rotate(-0.3deg);
    }
    29% {
        transform: translateX(1px) rotate(0.3deg);
    }
    30% {
        transform: translateX(-1px) rotate(-0.2deg);
    }
    31% {
        transform: translateX(1px) rotate(0.2deg);
    }
    32%, 42% {
        transform: translateX(-1px) rotate(-0.3deg);
    }
    33%, 43% {
        transform: translateX(1px) rotate(0.3deg);
    }
    34%, 44% {
        transform: translateX(-1px) rotate(-0.2deg);
    }
    35%, 45% {
        transform: translateX(1px) rotate(0.2deg);
    }
    46% {
        transform: translateX(0);
    }
    50%, 100% {
        transform: translateX(0);
    }
}

/* Engine glow pulse during processing */
@keyframes engineGlow {
    0%, 15% {
        box-shadow: 0 4px 20px rgba(27, 107, 58, 0.1);
    }
    20%, 45% {
        box-shadow: 0 4px 30px rgba(27, 107, 58, 0.5), 0 0 50px rgba(27, 107, 58, 0.25);
    }
    50%, 100% {
        box-shadow: 0 4px 20px rgba(27, 107, 58, 0.1);
    }
}

/* Table slides out to bottom */
@keyframes tableSlideOut {
    0%, 40% {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
    55%, 85% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    95%, 100% {
        opacity: 0;
        transform: translateY(0) scale(1);
    }
}

/* Gear rotation */
@keyframes gearSpin {
    0%, 15% {
        transform: rotate(0deg);
    }
    45% {
        transform: rotate(360deg);
    }
    50%, 100% {
        transform: rotate(360deg);
    }
}

@keyframes gearSpinReverse {
    0%, 15% {
        transform: rotate(0deg);
    }
    45% {
        transform: rotate(-360deg);
    }
    50%, 100% {
        transform: rotate(-360deg);
    }
}

/* Progress bar fill */
@keyframes progressFill {
    0%, 18% {
        width: 0%;
    }
    45%, 90% {
        width: 100%;
    }
    95%, 100% {
        width: 0%;
    }
}

/* Arrow pulse during flow (vertical - top arrow) */
@keyframes arrowPulseTop {
    0%, 5% {
        opacity: 0;
        transform: translateY(0);
    }
    10%, 25% {
        opacity: 1;
        transform: translateY(4px);
    }
    35%, 100% {
        opacity: 0;
        transform: translateY(0);
    }
}

/* Arrow pulse during flow (vertical - bottom arrow) */
@keyframes arrowPulseBottom {
    0%, 42% {
        opacity: 0;
        transform: translateY(0);
    }
    50%, 58% {
        opacity: 1;
        transform: translateY(4px);
    }
    68%, 100% {
        opacity: 0;
        transform: translateY(0);
    }
}

/* Checkbox badge pop animation */
@keyframes checkboxPop {
    0%, 50% {
        opacity: 0;
        transform: scale(0);
    }
    58% {
        opacity: 1;
        transform: scale(1.2);
    }
    65%, 88% {
        opacity: 1;
        transform: scale(1);
    }
    95%, 100% {
        opacity: 0;
        transform: scale(0);
    }
}

/* Apply extraction animations */
.animation-pdf .pdf-document {
    animation: pdfSlideIn 5s ease-in-out infinite;
}

.animation-engine .engine-box {
    animation: engineRattle 5s ease-in-out infinite, engineGlow 5s ease-in-out infinite;
}

.engine-gears .gear-large {
    animation: gearSpin 5s ease-in-out infinite;
}

.engine-gears .gear-small {
    animation: gearSpinReverse 5s ease-in-out infinite;
}

.engine-progress-bar {
    animation: progressFill 5s ease-in-out infinite;
}

.animation-table .table-output {
    animation: tableSlideOut 5s ease-in-out infinite;
}

.table-checkbox-badge {
    animation: checkboxPop 5s ease-in-out infinite;
}

.animation-arrow-top svg {
    animation: arrowPulseTop 5s ease-in-out infinite;
}

.animation-arrow-bottom svg {
    animation: arrowPulseBottom 5s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .reveal,
    .reveal-left,
    .reveal-right,
    .reveal-scale {
        opacity: 1;
        transform: none;
    }
    
    .hero-badge,
    .hero-title,
    .hero-subtitle,
    .hero-cta,
    .hero-stats,
    .hero-demo {
        opacity: 1;
    }
    
    /* Disable extraction animation for reduced motion */
    .animation-pdf .pdf-document,
    .animation-engine .engine-box,
    .engine-gears .gear-large,
    .engine-gears .gear-small,
    .engine-progress-bar,
    .animation-table .table-output,
    .table-checkbox-badge,
    .animation-arrow-top svg,
    .animation-arrow-bottom svg {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

