/* 
 * animation.css - Animationen und Übergangseffekte für Physio Nova
 * Enthält Keyframes für Animationen und spezielle Effekte
 */

/* Fadein Animation für Hero-Content und andere Elemente */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 1s ease-out;
}

/* Staggered Fadeins für Listen und Kartensammlungen */
.stagger-fade-in > * {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.5s ease-out forwards;
}

.stagger-fade-in > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-fade-in > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-fade-in > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-fade-in > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-fade-in > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-fade-in > *:nth-child(6) { animation-delay: 0.6s; }

/* Pulse-Animation für Buttons und hervorgehobene Elemente */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Slide-In von links */
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-50px); }
    to { opacity: 1; transform: translateX(0); }
}

.slide-in-left {
    animation: slideInLeft 0.8s ease-out;
}

/* Slide-In von rechts */
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

.slide-in-right {
    animation: slideInRight 0.8s ease-out;
}

/* Zoom-In-Animation */
@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.zoom-in {
    animation: zoomIn 0.6s ease-out;
}

/* Background-Highlight Animation */
@keyframes backgroundHighlight {
    0% { background-color: transparent; }
    50% { background-color: rgba(230, 57, 70, 0.1); }
    100% { background-color: transparent; }
}

.bg-highlight {
    animation: backgroundHighlight 2s ease-in-out;
}

/* Shimmer-Effekt für CTA-Elemente oder Highlights */
@keyframes shimmer {
    0% { background-position: -100% 0; }
    100% { background-position: 100% 0; }
}

.shimmer {
    background: linear-gradient(90deg, 
        rgba(255,255,255,0) 0%, 
        rgba(255,255,255,0.6) 50%, 
        rgba(255,255,255,0) 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Bounce-Animation für CTA-Buttons */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-15px); }
    60% { transform: translateY(-7px); }
}

.bounce {
    animation: bounce 2s ease infinite;
}

/* Rotate-Animation für Icons */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.rotate {
    animation: rotate 2s linear infinite;
}

/* Fade-Effekt für Hover-Overlays */
@keyframes fadeOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.hover-overlay {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hover-parent:hover .hover-overlay {
    opacity: 1;
}

/* Underline-Animation für Links */
.animated-underline {
    position: relative;
    text-decoration: none;
}

.animated-underline::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--secondary);
    transition: width 0.3s ease;
}

.animated-underline:hover::after {
    width: 100%;
}

/* Border-Pulse für Inputs und fokussierte Elemente */
@keyframes borderPulse {
    0% { border-color: var(--primary); }
    50% { border-color: var(--secondary); }
    100% { border-color: var(--primary); }
}

.border-pulse {
    animation: borderPulse 2s infinite;
}

/* Glow-Effekt für Hover-States */
.glow-on-hover {
    transition: box-shadow 0.3s ease;
}

.glow-on-hover:hover {
    box-shadow: 0 0 15px var(--primary-light);
}

/* Shake-Animation für Error-States oder Aufmerksamkeit */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.6s ease-in-out;
}

/* Flip-Animation */
@keyframes flip {
    0% { transform: perspective(400px) rotateY(0); }
    100% { transform: perspective(400px) rotateY(360deg); }
}

.flip {
    animation: flip 1.5s ease-in-out;
    transform-style: preserve-3d;
}

/* Loading-Spinner */
@keyframes spinner {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(74, 44, 130, 0.2);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spinner 1s linear infinite;
}

/* Sektions-Animation beim Scrollen (für JavaScript-Unterstützung) */
.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);
}

/* Text-Reveal-Animation */
@keyframes textReveal {
    from { width: 0; }
    to { width: 100%; }
}

.text-reveal {
    position: relative;
    display: inline-block;
}

.text-reveal::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary);
    animation: textReveal 1s ease-in-out forwards;
    animation-delay: 0.5s;
    animation-direction: reverse;
}

/* Media Queries für Animationen */
@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, .stagger-fade-in > *, .pulse, .slide-in-left, 
    .slide-in-right, .zoom-in, .bg-highlight, .shimmer, 
    .bounce, .rotate, .border-pulse, .shake, .flip, .spinner {
        animation: none !important;
        opacity: 1;
        transform: none;
    }
}