/**
 * VereniConsult Animations
 * Smooth, modern animations for a professional feel
 * Author: Angel Petrov
 */

/* ==========================================================================
   Animation Keyframes
   ========================================================================== */

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Down */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In Right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide In Up */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Slide In Down */
@keyframes slideInDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Rotate In */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-10deg);
    }
    to {
        opacity: 1;
        transform: rotate(0);
    }
}

/* Blur In */
@keyframes blurIn {
    from {
        opacity: 0;
        filter: blur(10px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

/* Pulse */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* Bounce */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

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

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

/* Gradient Flow */
@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

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

/* ==========================================================================
   Animation Classes - Initial States
   ========================================================================== */

/* Hero Animations - Play Immediately */
.animate-fade-in {
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
}

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

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

/* Animation Delays */
.delay-1 {
    animation-delay: 0.2s;
}

.delay-2 {
    animation-delay: 0.4s;
}

.delay-3 {
    animation-delay: 0.6s;
}

.delay-4 {
    animation-delay: 0.8s;
}

.delay-5 {
    animation-delay: 1s;
}

/* ==========================================================================
   Scroll Triggered Animations
   ========================================================================== */

/* Elements that animate on scroll */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animations for grid items */
.animate-on-scroll:nth-child(1) { transition-delay: 0s; }
.animate-on-scroll:nth-child(2) { transition-delay: 0.1s; }
.animate-on-scroll:nth-child(3) { transition-delay: 0.2s; }
.animate-on-scroll:nth-child(4) { transition-delay: 0.3s; }
.animate-on-scroll:nth-child(5) { transition-delay: 0.4s; }
.animate-on-scroll:nth-child(6) { transition-delay: 0.5s; }
.animate-on-scroll:nth-child(7) { transition-delay: 0.6s; }
.animate-on-scroll:nth-child(8) { transition-delay: 0.7s; }

/* Different animation types on scroll */
.animate-on-scroll.fade-up {
    transform: translateY(40px);
}

.animate-on-scroll.fade-down {
    transform: translateY(-40px);
}

.animate-on-scroll.fade-left {
    transform: translateX(40px);
}

.animate-on-scroll.fade-right {
    transform: translateX(-40px);
}

.animate-on-scroll.scale {
    transform: scale(0.9);
}

.animate-on-scroll.fade-up.animated,
.animate-on-scroll.fade-down.animated,
.animate-on-scroll.fade-left.animated,
.animate-on-scroll.fade-right.animated,
.animate-on-scroll.scale.animated {
    transform: none;
}

/* ==========================================================================
   Interactive Hover Animations
   ========================================================================== */

/* Lift Effect */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Scale Effect */
.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Glow Effect */
.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.4);
}

/* Shine Effect */
.hover-shine {
    position: relative;
    overflow: hidden;
}

.hover-shine::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(30deg);
    transition: transform 0.6s ease;
    pointer-events: none;
    opacity: 0;
}

.hover-shine:hover::after {
    opacity: 1;
    transform: rotate(30deg) translate(100%, 100%);
}

/* Underline Grow Effect */
.hover-underline {
    position: relative;
}

.hover-underline::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.3s ease, left 0.3s ease;
}

.hover-underline:hover::after {
    width: 100%;
    left: 0;
}

/* ==========================================================================
   Loading Animations
   ========================================================================== */

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Dots Loading */
.loading-dots {
    display: flex;
    gap: 6px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-gray-200) 25%,
        var(--color-gray-100) 50%,
        var(--color-gray-200) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ==========================================================================
   Text Animations
   ========================================================================== */

/* Typing Effect */
.typing-text {
    overflow: hidden;
    border-right: 2px solid var(--color-primary);
    white-space: nowrap;
    animation:
        typing 3s steps(30) forwards,
        blink 0.7s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink {
    50% { border-color: transparent; }
}

/* Gradient Text Animation */
.gradient-text-animated {
    background: linear-gradient(
        90deg,
        var(--color-primary),
        var(--color-secondary),
        var(--color-accent),
        var(--color-secondary),
        var(--color-primary)
    );
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 6s ease infinite;
}

/* ==========================================================================
   Number Counter Animation
   ========================================================================== */

.counter {
    transition: all 0.5s ease-out;
}

/* ==========================================================================
   Parallax Effects
   ========================================================================== */

.parallax-slow {
    will-change: transform;
}

.parallax-medium {
    will-change: transform;
}

.parallax-fast {
    will-change: transform;
}

/* ==========================================================================
   Button Animations
   ========================================================================== */

/* Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

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

.btn-ripple:active::before {
    width: 300px;
    height: 300px;
}

/* Arrow Bounce on Hover */
.btn svg {
    transition: transform 0.3s ease;
}

.btn:hover svg {
    animation: arrowBounce 0.6s ease;
}

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

/* ==========================================================================
   Card Animations
   ========================================================================== */

/* Card Tilt Effect - 3D */
.card-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: transform 0.3s ease;
}

.card-3d:hover {
    transform: rotateY(-5deg) rotateX(5deg);
}

/* Card Border Animation */
.card-border-animate {
    position: relative;
}

.card-border-animate::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.card-border-animate:hover::before {
    transform: scaleX(1);
}

/* ==========================================================================
   Icon Animations
   ========================================================================== */

/* Icon Bounce */
.icon-bounce:hover {
    animation: bounce 0.6s ease;
}

/* Icon Spin */
.icon-spin:hover {
    animation: spin 0.6s ease;
}

/* Icon Pulse */
.icon-pulse {
    animation: pulse 2s ease infinite;
}

/* ==========================================================================
   Form Animations
   ========================================================================== */

/* Input Focus Animation */
.input-animated {
    position: relative;
}

.input-animated::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--color-secondary);
    transition: width 0.3s ease, left 0.3s ease;
}

.input-animated:focus-within::after {
    width: 100%;
    left: 0;
}

/* Label Float Animation */
.label-float {
    position: relative;
}

.label-float label {
    position: absolute;
    top: 50%;
    left: var(--space-4);
    transform: translateY(-50%);
    transition: all 0.3s ease;
    pointer-events: none;
    color: var(--color-gray-400);
}

.label-float input:focus + label,
.label-float input:not(:placeholder-shown) + label {
    top: 0;
    font-size: var(--text-xs);
    background: var(--color-white);
    padding: 0 var(--space-1);
    color: var(--color-secondary);
}

/* ==========================================================================
   Page Transition Animations
   ========================================================================== */

/* Fade Transition */
.page-transition {
    animation: fadeIn 0.5s ease;
}

/* Slide Transition */
.page-slide-in {
    animation: slideInUp 0.5s ease;
}

/* ==========================================================================
   Reveal Animations
   ========================================================================== */

/* Reveal from bottom */
.reveal-bottom {
    clip-path: inset(100% 0 0 0);
    transition: clip-path 0.6s ease;
}

.reveal-bottom.revealed {
    clip-path: inset(0 0 0 0);
}

/* Reveal from left */
.reveal-left {
    clip-path: inset(0 100% 0 0);
    transition: clip-path 0.6s ease;
}

.reveal-left.revealed {
    clip-path: inset(0 0 0 0);
}

/* ==========================================================================
   Special Effects
   ========================================================================== */

/* Morphing Background */
.morph-bg {
    background: linear-gradient(-45deg, var(--color-primary), var(--color-secondary), var(--color-accent), var(--color-primary-light));
    background-size: 400% 400%;
    animation: gradientFlow 15s ease infinite;
}

/* Floating Elements */
.float {
    animation: float 6s ease-in-out infinite;
}

.float-delayed {
    animation: float 6s ease-in-out infinite;
    animation-delay: -3s;
}

/* Blur In on Load */
.blur-in {
    animation: blurIn 0.8s ease forwards;
}

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

@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-on-scroll {
        opacity: 1;
        transform: none;
    }

    .hero-card {
        opacity: 1;
        transform: none;
    }

    .animate-fade-in,
    .animate-fade-in-up,
    .animate-fade-in-left {
        opacity: 1;
        animation: none;
    }
}

/* ==========================================================================
   Performance Optimizations
   ========================================================================== */

/* Use GPU acceleration for animated elements */
.animate-on-scroll,
.hover-lift,
.hover-scale,
.service-card,
.hero-card,
.back-to-top,
.mobile-menu {
    will-change: transform, opacity;
}

/* Clean up will-change after animation */
.animated {
    will-change: auto;
}

/* ==========================================================================
   Enhanced Hover Effects
   ========================================================================== */

/* Magnetic Button Effect */
.btn-magnetic {
    position: relative;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 3D Card Tilt on Hover */
.tilt-card {
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tilt-card:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(-5deg) scale(1.02);
}

.tilt-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
    pointer-events: none;
}

.tilt-card:hover::before {
    opacity: 1;
}

/* Gradient Border Animation */
.gradient-border {
    position: relative;
    background: var(--color-white);
    border-radius: var(--radius-xl);
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, var(--color-gold), var(--color-teal), var(--color-gold-light), var(--color-navy));
    background-size: 400% 400%;
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
    animation: gradientFlow 4s ease infinite;
}

.gradient-border:hover::before {
    opacity: 1;
}

/* Morphing Shape Background */
@keyframes morphShape {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    25% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
    50% {
        border-radius: 50% 60% 30% 60% / 30% 40% 70% 60%;
    }
    75% {
        border-radius: 60% 40% 60% 30% / 70% 30% 50% 60%;
    }
}

.morph-shape {
    animation: morphShape 8s ease-in-out infinite;
}

/* Glowing Ring Effect */
@keyframes glowRing {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.4);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(201, 162, 39, 0);
    }
}

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

/* Text Reveal Animation */
@keyframes textReveal {
    0% {
        clip-path: polygon(0 0, 0 0, 0 100%, 0% 100%);
    }
    100% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
}

.text-reveal {
    animation: textReveal 0.8s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

/* Stagger Children Animation */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
}

.stagger-children.animated > *:nth-child(1) { animation: fadeInUp 0.5s ease forwards 0.1s; }
.stagger-children.animated > *:nth-child(2) { animation: fadeInUp 0.5s ease forwards 0.2s; }
.stagger-children.animated > *:nth-child(3) { animation: fadeInUp 0.5s ease forwards 0.3s; }
.stagger-children.animated > *:nth-child(4) { animation: fadeInUp 0.5s ease forwards 0.4s; }
.stagger-children.animated > *:nth-child(5) { animation: fadeInUp 0.5s ease forwards 0.5s; }
.stagger-children.animated > *:nth-child(6) { animation: fadeInUp 0.5s ease forwards 0.6s; }

/* Elastic Scale */
@keyframes elasticScale {
    0% { transform: scale(0); }
    55% { transform: scale(1.1); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.elastic-in {
    animation: elasticScale 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Wave Animation for Background */
@keyframes wave {
    0% { transform: translateX(0) translateZ(0) scaleY(1); }
    50% { transform: translateX(-25%) translateZ(0) scaleY(0.8); }
    100% { transform: translateX(-50%) translateZ(0) scaleY(1); }
}

.wave-bg {
    animation: wave 15s linear infinite;
}

/* Particle Float */
@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.5;
    }
}

.particle {
    animation: particleFloat 4s ease-in-out infinite;
}

/* Icon Morph on Hover */
.icon-morph {
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.icon-morph:hover {
    transform: rotate(360deg) scale(1.2);
}

/* Neon Glow Text */
@keyframes neonPulse {
    0%, 100% {
        text-shadow:
            0 0 5px rgba(201, 162, 39, 0.5),
            0 0 10px rgba(201, 162, 39, 0.3),
            0 0 20px rgba(201, 162, 39, 0.2);
    }
    50% {
        text-shadow:
            0 0 10px rgba(201, 162, 39, 0.8),
            0 0 20px rgba(201, 162, 39, 0.5),
            0 0 40px rgba(201, 162, 39, 0.3);
    }
}

.neon-text {
    animation: neonPulse 2s ease-in-out infinite;
}

/* Slide In Bounce */
@keyframes slideInBounce {
    0% {
        opacity: 0;
        transform: translateY(60px);
    }
    60% {
        opacity: 1;
        transform: translateY(-10px);
    }
    80% {
        transform: translateY(5px);
    }
    100% {
        transform: translateY(0);
    }
}

.slide-in-bounce {
    animation: slideInBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Circular Progress */
@keyframes circularProgress {
    0% {
        stroke-dashoffset: 283;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

.circular-progress circle {
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    animation: circularProgress 2s ease forwards;
}

/* Breathing Animation */
@keyframes breathing {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

.breathing {
    animation: breathing 3s ease-in-out infinite;
}

/* Spotlight Effect */
.spotlight {
    position: relative;
    overflow: hidden;
}

.spotlight::after {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 60%);
    transform: scale(0);
    opacity: 0;
    transition: transform 0.6s ease, opacity 0.6s ease;
}

.spotlight:hover::after {
    transform: scale(1);
    opacity: 1;
}

/* Marquee Effect */
@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.marquee {
    animation: marquee 20s linear infinite;
}

/* Counter Flip Animation */
@keyframes counterFlip {
    0% {
        transform: rotateX(90deg);
        opacity: 0;
    }
    100% {
        transform: rotateX(0);
        opacity: 1;
    }
}

.counter-flip {
    animation: counterFlip 0.6s ease forwards;
}

/* Smooth Scroll Indicator Bounce */
@keyframes scrollIndicator {
    0%, 100% {
        transform: translateY(0);
        opacity: 1;
    }
    50% {
        transform: translateY(10px);
        opacity: 0.5;
    }
}

.scroll-indicator {
    animation: scrollIndicator 1.5s ease-in-out infinite;
}
