/* ==========================================
   Özer Reinigung - Animations & Effects
   ========================================== */

/* Keyframe Animations */
@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 fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
        transform: translate3d(0, -30px, 0);
    }
    70% {
        animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
        transform: translate3d(0, -15px, 0);
    }
    90% {
        transform: translate3d(0, -4px, 0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes sparkle {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

/* Animation Classes */
.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fade-in-down {
    animation: fadeInDown 0.6s ease-out forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.6s ease-out forwards;
}

.animate-fade-in-right {
    animation: fadeInRight 0.6s ease-out forwards;
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-slide-up {
    animation: slideUp 0.8s ease-out forwards;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-bounce {
    animation: bounce 1s;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Delayed Animations */
.animate-delay-100 {
    animation-delay: 0.1s;
}

.animate-delay-200 {
    animation-delay: 0.2s;
}

.animate-delay-300 {
    animation-delay: 0.3s;
}

.animate-delay-400 {
    animation-delay: 0.4s;
}

.animate-delay-500 {
    animation-delay: 0.5s;
}

/* Intersection Observer Animation Classes */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Hero Animation */
.hero-title {
    animation: fadeInUp 0.8s ease-out;
}

.hero-subtitle {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero-buttons {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.hero-image {
    animation: fadeInRight 0.8s ease-out 0.6s both;
}

/* Service Cards Stagger Animation */
.service-card:nth-child(1) {
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

.service-card:nth-child(2) {
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.service-card:nth-child(3) {
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

.service-card:nth-child(4) {
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

.service-card:nth-child(5) {
    animation: fadeInUp 0.6s ease-out 0.5s both;
}

.service-card:nth-child(6) {
    animation: fadeInUp 0.6s ease-out 0.6s both;
}

/* Feature Cards Animation */
.feature:nth-child(1) {
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

.feature:nth-child(2) {
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.feature:nth-child(3) {
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

.feature:nth-child(4) {
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

/* Header Scroll Animation */
.header.scrolled {
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
}

/* Hover Animations */
.service-card {
    transition: all 0.3s ease-out;
}

.service-card:hover .service-icon {
    animation: pulse 0.5s ease-in-out;
}

.feature:hover .feature-icon {
    animation: bounce 0.6s ease-in-out;
}

/* Button Animations */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::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;
}

.btn:hover::before {
    left: 100%;
}

/* Loading Animations */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

/* Floating Animation */
.whatsapp-float,
.chatbot-toggle {
    animation: pulse 2s infinite;
}

.whatsapp-float:hover,
.chatbot-toggle:hover {
    animation: bounce 0.6s ease-in-out;
}

/* Sparkle Effect */
.sparkle-container {
    position: relative;
    overflow: hidden;
}

.sparkle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    animation: sparkle 2s linear infinite;
}

/* Navigation Animation */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 50%;
    background-color: var(--primary-color);
    transition: all 0.3s ease-in-out;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
    left: 0;
}

/* Dropdown Animation */
.dropdown-menu {
    transform-origin: top center;
}

.nav-dropdown:hover .dropdown-menu {
    animation: slideUp 0.3s ease-out;
}

/* Mobile Dropdown Animation - WICHTIG für Handy-Funktionalität */
@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        overflow: hidden;
    }
    to {
        opacity: 1;
        max-height: 500px;
        overflow: visible;
    }
}

/* Mobile-spezifische Dropdown-Regeln */
@media (max-width: 768px) {
    /* Mobile Navigation Dropdown */
    .nav-menu.active .nav-dropdown .dropdown-menu {
        position: static !important;
        display: none !important;
        background: var(--background-light, #f9fafb) !important;
        box-shadow: none !important;
        border-top: 1px solid var(--border-color, #e5e7eb) !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: none !important;
        animation: none !important;
    }
    
    .nav-menu.active .nav-dropdown .dropdown-trigger[aria-expanded="true"] + .dropdown-menu {
        display: block !important;
        animation: slideDown 0.3s ease-out !important;
    }
    
    /* Hover-Effekte auf Mobile deaktivieren */
    .nav-dropdown:hover .dropdown-menu {
        animation: none;
    }
    
    /* Sicherstellen, dass Dropdown-Links sichtbar sind */
    .nav-menu.active .dropdown-menu a {
        display: block !important;
        padding: 1rem 2rem !important;
        color: var(--text-secondary, #6b7280) !important;
        text-decoration: none !important;
        font-size: 0.875rem !important;
        border-bottom: 1px solid var(--border-color, #e5e7eb) !important;
    }
    
    .nav-menu.active .dropdown-menu a:hover {
        color: var(--primary-color, #2563eb) !important;
        background-color: var(--background-white, #ffffff) !important;
    }
}

/* Chatbot Animation */
.chatbot {
    transform: translateY(100%) scale(0.8);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.chatbot.active {
    transform: translateY(0) scale(1);
}

.chatbot-message {
    animation: fadeInUp 0.3s ease-out;
}

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    z-index: 10000;
    transition: width 0.3s ease-out;
}

/* Parallax Effect */
.parallax-bg {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Text Animation */
.typewriter {
    overflow: hidden;
    border-right: 0.15em solid var(--primary-color);
    white-space: nowrap;
    margin: 0 auto;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink-caret {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--primary-color);
    }
}

/* Mobile Optimized Animations */
@media (max-width: 768px) {
    .animate-on-scroll {
        transform: translateY(20px);
    }
    
    .service-card:hover {
        transform: translateY(-4px);
    }
    
    .hero-title,
    .hero-subtitle,
    .hero-buttons,
    .hero-image {
        animation-duration: 0.6s;
    }
}

/* Reduced Motion Accessibility */
@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;
    }
    
    .animate-pulse,
    .animate-bounce,
    .animate-spin {
        animation: none !important;
    }
    
    .parallax-bg {
        background-attachment: scroll;
    }
}