/* ============================================
   RaicadGroup - Animations
   Smooth, Organic Animations
   ============================================ */

/* Keyframe Animations */

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Slide Up - More Organic with Spring */
@keyframes slideUp {
    0% {
        opacity: 0;
        transform: translateY(60px) scale(0.98);
    }
    60% {
        opacity: 1;
        transform: translateY(-5px) scale(1.01);
    }
    80% {
        transform: translateY(3px) scale(0.995);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Slide In Left - Organic */
@keyframes slideInLeft {
    0% {
        opacity: 0;
        transform: translateX(-60px) rotate(-2deg);
    }
    70% {
        opacity: 1;
        transform: translateX(5px) rotate(0.5deg);
    }
    100% {
        opacity: 1;
        transform: translateX(0) rotate(0deg);
    }
}

/* Slide In Right - Organic */
@keyframes slideInRight {
    0% {
        opacity: 0;
        transform: translateX(60px) rotate(2deg);
    }
    70% {
        opacity: 1;
        transform: translateX(-5px) rotate(-0.5deg);
    }
    100% {
        opacity: 1;
        transform: translateX(0) rotate(0deg);
    }
}

/* Float Animation - More Natural */
@keyframes float {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-15px) rotate(2deg);
    }
    50% {
        transform: translateY(-25px) rotate(0deg);
    }
    75% {
        transform: translateY(-10px) rotate(-2deg);
    }
    100% {
        transform: translateY(0) rotate(0deg);
    }
}

/* Gentle Float - Subtle Movement */
@keyframes gentleFloat {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    25% {
        transform: translateY(-8px) translateX(3px);
    }
    50% {
        transform: translateY(-12px) translateX(-2px);
    }
    75% {
        transform: translateY(-5px) translateX(4px);
    }
}

/* Breathing Animation - Very Organic */
@keyframes breathing {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

/* Soft Pulse - Natural Heartbeat */
@keyframes softPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(74, 158, 255, 0.4);
    }
    40% {
        transform: scale(1.02);
        box-shadow: 0 0 20px 5px rgba(74, 158, 255, 0.2);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(74, 158, 255, 0);
    }
}

/* Morph Animation */
@keyframes morph {
    0%, 100% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    }
    25% {
        border-radius: 58% 42% 75% 25% / 76% 46% 54% 24%;
    }
    50% {
        border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%;
    }
    75% {
        border-radius: 33% 67% 58% 42% / 63% 68% 32% 37%;
    }
}

/* Scroll Pulse */
@keyframes scrollPulse {
    0% {
        opacity: 1;
        height: 60px;
    }
    50% {
        opacity: 0.5;
        height: 40px;
    }
    100% {
        opacity: 1;
        height: 60px;
    }
}

/* Rotate House */
@keyframes rotateHouse {
    from {
        transform: rotateY(0deg);
    }
    to {
        transform: rotateY(360deg);
    }
}

/* Draw Line */
@keyframes drawLine {
    from {
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dashoffset: 0;
    }
}

/* Pulse Glow */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(74, 158, 255, 0.2);
    }
    50% {
        box-shadow: 0 0 40px rgba(74, 158, 255, 0.4);
    }
}

/* Shimmer */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Topo Line Flow */
@keyframes topoFlow {
    0% {
        stroke-dashoffset: 0;
    }
    100% {
        stroke-dashoffset: 100;
    }
}

/* Laser Beam */
@keyframes laserPulse {
    0%, 100% {
        opacity: 1;
        stroke-width: 1;
    }
    50% {
        opacity: 0.5;
        stroke-width: 2;
    }
}

/* Target Blink */
@keyframes targetBlink {
    0%, 100% {
        opacity: 1;
        r: 3;
    }
    50% {
        opacity: 0.3;
        r: 5;
    }
}

/* Parcel Highlight */
@keyframes parcelHighlight {
    0%, 100% {
        fill: url(#hatch);
        stroke-width: 1.5;
    }
    50% {
        fill: rgba(74, 158, 255, 0.1);
        stroke-width: 2;
    }
}

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Count Up Animation Class */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Animation Classes for JavaScript
   ============================================ */

/* Reveal on Scroll - Organic Spring Effect */
.reveal {
    opacity: 0;
    transform: translateY(50px) scale(0.98);
    transition: opacity 0.9s cubic-bezier(0.34, 1.56, 0.64, 1), 
                transform 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Reveal Left - Organic */
.reveal-left {
    opacity: 0;
    transform: translateX(-50px) rotate(-1deg);
    transition: opacity 0.9s cubic-bezier(0.34, 1.56, 0.64, 1), 
                transform 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0) rotate(0deg);
}

/* Reveal Right - Organic */
.reveal-right {
    opacity: 0;
    transform: translateX(50px) rotate(1deg);
    transition: opacity 0.9s cubic-bezier(0.34, 1.56, 0.64, 1), 
                transform 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0) rotate(0deg);
}

/* Reveal Scale - Bounce Effect */
.reveal-scale {
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.7s cubic-bezier(0.34, 1.56, 0.64, 1), 
                transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* Stagger Children - Organic Cascade */
.stagger-children > * {
    opacity: 0;
    transform: translateY(35px) scale(0.97);
    transition: opacity 0.7s cubic-bezier(0.34, 1.56, 0.64, 1), 
                transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stagger-children.active > *:nth-child(1) { transition-delay: 0.05s; }
.stagger-children.active > *:nth-child(2) { transition-delay: 0.12s; }
.stagger-children.active > *:nth-child(3) { transition-delay: 0.19s; }
.stagger-children.active > *:nth-child(4) { transition-delay: 0.26s; }
.stagger-children.active > *:nth-child(5) { transition-delay: 0.33s; }
.stagger-children.active > *:nth-child(6) { transition-delay: 0.40s; }

.stagger-children.active > * {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ============================================
   SVG Animations
   ============================================ */

/* Blueprint Drawing Animation */
.bp-line {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    animation: drawLine 2s ease forwards;
}

.bp-line:nth-child(1) { animation-delay: 0s; }
.bp-line:nth-child(2) { animation-delay: 0.3s; }
.bp-line:nth-child(3) { animation-delay: 0.6s; }
.bp-line:nth-child(4) { animation-delay: 0.9s; }
.bp-line:nth-child(5) { animation-delay: 1.2s; }

.draw-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: drawLine 1.5s ease forwards;
}

.draw-circle {
    stroke-dasharray: 220;
    stroke-dashoffset: 220;
    animation: drawLine 2s ease forwards 0.5s;
}

/* Measurement Line */
.measure-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: drawLine 1s ease forwards 1.5s;
}

/* Topo Lines Animation */
.topo-line {
    stroke-dasharray: 10 5;
    animation: topoFlow 20s linear infinite;
}

.topo-line:nth-child(2) { animation-delay: -4s; }
.topo-line:nth-child(3) { animation-delay: -8s; }
.topo-line:nth-child(4) { animation-delay: -12s; }
.topo-line:nth-child(5) { animation-delay: -16s; }

/* Theodolite Animation */
.laser-beam {
    animation: laserPulse 1.5s ease-in-out infinite;
}

.target-point {
    animation: targetBlink 1.5s ease-in-out infinite;
}

/* Parcel Animation */
.parcel {
    transition: all 0.5s ease;
}

.parcel.p1 {
    animation: parcelHighlight 3s ease-in-out infinite;
}

/* ============================================
   Interactive Hover Animations
   ============================================ */

/* Button Hover Effect */
.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:hover::after {
    width: 300px;
    height: 300px;
}

/* Card Hover Lift */
.service-card,
.imobiliare-card,
.testimonial-card,
.renovation-type {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Icon Bounce on Hover */
.service-card:hover .service-icon,
.imobiliare-card:hover .card-icon {
    animation: iconBounce 0.5s ease;
}

@keyframes iconBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Link Underline Animation */
.nav-link,
.footer-column a {
    position: relative;
}

.footer-column a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--color-primary);
    transition: width 0.3s ease;
}

.footer-column a:hover::after {
    width: 100%;
}

/* ============================================
   Page Transition Effects
   ============================================ */

/* Smooth Section Transitions */
section {
    position: relative;
}

section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        var(--color-border), 
        transparent
    );
}

/* ============================================
   Loading States
   ============================================ */

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, 
        var(--color-bg-card) 25%, 
        var(--color-bg-card-hover) 50%, 
        var(--color-bg-card) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

/* ============================================
   Micro-interactions
   ============================================ */

/* Form Focus Animation */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    animation: inputFocus 0.3s ease;
}

@keyframes inputFocus {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.01);
    }
    100% {
        transform: scale(1);
    }
}

/* Social Icon Hover */
.social-link {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s ease,
                border-color 0.3s ease;
}

.social-link:hover {
    transform: translateY(-3px) rotate(5deg);
}

/* Step Number Pulse on View */
.step-number {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.process-step:hover .step-number {
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 0 30px rgba(74, 158, 255, 0.3);
}

/* ============================================
   Reduced Motion Support
   ============================================ */

@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;
    }
    
    .stagger-children > * {
        opacity: 1;
        transform: none;
    }
}
