/* ============================================
   LIBERTY INMOBILIARIA - ANIMACIONES DINÁMICAS
   Archivo: dynamic-animations.css
   Versión: 2.0 - Animaciones modernas y fluidas
   ============================================ */

/* ====== VARIABLES DE ANIMACIÓN ====== */
:root {
    --animation-speed-fast: 0.2s;
    --animation-speed-normal: 0.3s;
    --animation-speed-slow: 0.5s;
    --animation-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --animation-ease-back: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --animation-ease-elastic: cubic-bezier(0.68, -0.6, 0.32, 1.6);
}

/* ====== KEYFRAMES PRINCIPALES ====== */

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

@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);
    }
}

/* Scale Animations */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomInBounce {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide Animations */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Rotation Animations */
@keyframes rotateIn {
    from {
        transform: rotate(-200deg);
        opacity: 0;
    }
    to {
        transform: rotate(0);
        opacity: 1;
    }
}

@keyframes flipInX {
    from {
        transform: perspective(400px) rotateX(90deg);
        opacity: 0;
    }
    to {
        transform: perspective(400px) rotateX(0deg);
        opacity: 1;
    }
}

@keyframes flipInY {
    from {
        transform: perspective(400px) rotateY(90deg);
        opacity: 0;
    }
    to {
        transform: perspective(400px) rotateY(0deg);
        opacity: 1;
    }
}

/* Bounce Animations */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceInUp {
    0% {
        opacity: 0;
        transform: translateY(60px);
    }
    60% {
        opacity: 1;
        transform: translateY(-20px);
    }
    80% {
        transform: translateY(10px);
    }
    100% {
        transform: translateY(0);
    }
}

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

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.3);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.3);
    }
    70% {
        transform: scale(1);
    }
    100% {
        transform: scale(1);
    }
}

/* Loading Animations */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes loading {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Shimmer Effect */
@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Wave Animation */
@keyframes wave {
    0%, 60%, 100% {
        transform: initial;
    }
    30% {
        transform: translateY(-15px);
    }
}

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

/* Glow Animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0, 102, 178, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 102, 178, 0.8), 0 0 30px rgba(0, 102, 178, 0.6);
    }
}

/* Typewriter Effect */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    0%, 50% {
        border-color: transparent;
    }
    51%, 100% {
        border-color: currentColor;
    }
}

/* ====== CLASES DE ANIMACIÓN ====== */

/* Fade Animations */
.animate-fade-in {
    animation: fadeIn var(--animation-speed-normal) var(--animation-ease) forwards;
}

.animate-fade-in-up {
    animation: fadeInUp var(--animation-speed-normal) var(--animation-ease) forwards;
}

.animate-fade-in-down {
    animation: fadeInDown var(--animation-speed-normal) var(--animation-ease) forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft var(--animation-speed-normal) var(--animation-ease) forwards;
}

.animate-fade-in-right {
    animation: fadeInRight var(--animation-speed-normal) var(--animation-ease) forwards;
}

/* Scale Animations */
.animate-zoom-in {
    animation: zoomIn var(--animation-speed-normal) var(--animation-ease) forwards;
}

.animate-zoom-in-bounce {
    animation: zoomInBounce var(--animation-speed-slow) var(--animation-ease-back) forwards;
}

/* Slide Animations */
.animate-slide-in-up {
    animation: slideInUp var(--animation-speed-normal) var(--animation-ease) forwards;
}

.animate-slide-in-down {
    animation: slideInDown var(--animation-speed-normal) var(--animation-ease) forwards;
}

.animate-slide-in-left {
    animation: slideInLeft var(--animation-speed-normal) var(--animation-ease) forwards;
}

.animate-slide-in-right {
    animation: slideInRight var(--animation-speed-normal) var(--animation-ease) forwards;
}

/* Rotation Animations */
.animate-rotate-in {
    animation: rotateIn var(--animation-speed-slow) var(--animation-ease) forwards;
}

.animate-flip-in-x {
    animation: flipInX var(--animation-speed-slow) var(--animation-ease) forwards;
}

.animate-flip-in-y {
    animation: flipInY var(--animation-speed-slow) var(--animation-ease) forwards;
}

/* Bounce Animations */
.animate-bounce-in {
    animation: bounceIn var(--animation-speed-slow) var(--animation-ease-back) forwards;
}

.animate-bounce-in-up {
    animation: bounceInUp var(--animation-speed-slow) var(--animation-ease-back) forwards;
}

/* Continuous Animations */
.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

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

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

/* ====== ANIMACIONES ESPECÍFICAS DE COMPONENTES ====== */

/* Header Animations */
.header-slide-down {
    animation: slideInDown var(--animation-speed-fast) var(--animation-ease) forwards;
}

.logo-bounce {
    animation: bounceIn var(--animation-speed-normal) var(--animation-ease-back) forwards;
}

/* Hero Animations */
.hero-title-typewriter {
    overflow: hidden;
    border-right: 3px solid;
    white-space: nowrap;
    animation: 
        typewriter 3s steps(40) 1s forwards,
        blink 0.75s step-end infinite;
}

.hero-stats-stagger .stat-item:nth-child(1) {
    animation: fadeInUp var(--animation-speed-normal) var(--animation-ease) 0.1s forwards;
}

.hero-stats-stagger .stat-item:nth-child(2) {
    animation: fadeInUp var(--animation-speed-normal) var(--animation-ease) 0.2s forwards;
}

.hero-stats-stagger .stat-item:nth-child(3) {
    animation: fadeInUp var(--animation-speed-normal) var(--animation-ease) 0.3s forwards;
}

.hero-stats-stagger .stat-item:nth-child(4) {
    animation: fadeInUp var(--animation-speed-normal) var(--animation-ease) 0.4s forwards;
}

/* Card Animations */
.cards-stagger .property-card:nth-child(1),
.cards-stagger .advantage-card:nth-child(1),
.cards-stagger .testimonial-card:nth-child(1) {
    animation: fadeInUp var(--animation-speed-normal) var(--animation-ease) 0.1s forwards;
}

.cards-stagger .property-card:nth-child(2),
.cards-stagger .advantage-card:nth-child(2),
.cards-stagger .testimonial-card:nth-child(2) {
    animation: fadeInUp var(--animation-speed-normal) var(--animation-ease) 0.2s forwards;
}

.cards-stagger .property-card:nth-child(3),
.cards-stagger .advantage-card:nth-child(3),
.cards-stagger .testimonial-card:nth-child(3) {
    animation: fadeInUp var(--animation-speed-normal) var(--animation-ease) 0.3s forwards;
}

.cards-stagger .property-card:nth-child(4),
.cards-stagger .advantage-card:nth-child(4) {
    animation: fadeInUp var(--animation-speed-normal) var(--animation-ease) 0.4s forwards;
}

/* Button Animations */
.btn-hover-grow {
    transition: transform var(--animation-speed-fast) var(--animation-ease);
}

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

.btn-hover-float {
    transition: transform var(--animation-speed-fast) var(--animation-ease);
}

.btn-hover-float:hover {
    transform: translateY(-3px);
}

.btn-shake:hover {
    animation: shake 0.5s ease-in-out;
}

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

/* WhatsApp Button Special Animation */
.whatsapp-button-special {
    position: relative;
    overflow: hidden;
}

.whatsapp-button-special::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.whatsapp-button-special:hover::before {
    left: 100%;
}

/* Loading States */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 102, 178, 0.3);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: loading 1.4s infinite ease-in-out both;
}

.loading-dots::before,
.loading-dots::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    display: inline-block;
    margin: 0 2px;
}

.loading-dots::before {
    animation: loading 1.4s infinite ease-in-out both;
    animation-delay: -0.16s;
}

/* Shimmer Effect for Loading */
.shimmer {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Scroll Animations */
.scroll-fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-fade-in.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-slide-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-slide-left.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.scroll-slide-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-slide-right.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.scroll-zoom-in {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-zoom-in.is-visible {
    opacity: 1;
    transform: scale(1);
}

/* Counter Animation */
.counter-number {
    display: inline-block;
    transition: transform 0.3s ease;
}

.counter-animate {
    animation: bounceIn 0.6s ease;
}

/* Progress Bar Animation */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 102, 178, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    width: 0%;
    transition: width 1s ease;
    animation: shimmer 2s infinite;
}

/* Modal Animations */
.modal-backdrop {
    opacity: 0;
    transition: opacity var(--animation-speed-normal) ease;
}

.modal-backdrop.show {
    opacity: 1;
}

.modal-content {
    transform: scale(0.8) translateY(-50px);
    opacity: 0;
    transition: all var(--animation-speed-normal) var(--animation-ease);
}

.modal-content.show {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Notification Animations */
.notification-enter {
    animation: slideInRight var(--animation-speed-normal) var(--animation-ease) forwards;
}

.notification-exit {
    animation: slideOutRight var(--animation-speed-fast) var(--animation-ease) forwards;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Hover Effects */
.hover-lift {
    transition: transform var(--animation-speed-fast) var(--animation-ease), 
                box-shadow var(--animation-speed-fast) var(--animation-ease);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.hover-tilt {
    transition: transform var(--animation-speed-fast) var(--animation-ease);
}

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

.hover-glow {
    transition: box-shadow var(--animation-speed-fast) var(--animation-ease);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(0, 102, 178, 0.5);
}

/* Image Animations */
.image-zoom {
    overflow: hidden;
}

.image-zoom img {
    transition: transform var(--animation-speed-slow) var(--animation-ease);
}

.image-zoom:hover img {
    transform: scale(1.1);
}

.image-parallax {
    transition: transform var(--animation-speed-fast) ease-out;
}

/* Text Animations */
.text-focus-in {
    animation: text-focus-in 1s cubic-bezier(0.550, 0.085, 0.680, 0.530) both;
}

@keyframes text-focus-in {
    0% {
        filter: blur(12px);
        opacity: 0;
    }
    100% {
        filter: blur(0px);
        opacity: 1;
    }
}

.text-shadow-pop {
    animation: text-shadow-pop 0.6s both;
}

@keyframes text-shadow-pop {
    0% {
        text-shadow: 0 0 0 transparent;
        transform: translateX(0);
    }
    100% {
        text-shadow: 1px 1px 0 #555, 2px 2px 0 #555, 3px 3px 0 #555;
        transform: translateX(-3px);
    }
}

/* ====== PERFORMANCE OPTIMIZATIONS ====== */

/* Reduce animations on low-end devices */
@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;
    }
}

/* GPU Acceleration for better performance */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000;
}

/* Optimize will-change for animations */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

.will-change-auto {
    will-change: auto;
}

/* ====== ANIMATION DELAYS ====== */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-700 { animation-delay: 0.7s; }
.delay-1000 { animation-delay: 1s; }

/* ====== ANIMATION DURATIONS ====== */
.duration-fast { animation-duration: var(--animation-speed-fast); }
.duration-normal { animation-duration: var(--animation-speed-normal); }
.duration-slow { animation-duration: var(--animation-speed-slow); }
.duration-1s { animation-duration: 1s; }
.duration-2s { animation-duration: 2s; }
.duration-3s { animation-duration: 3s; }