/**
 * Tagus Vitrine Digital - Advanced Animations
 * Smooth, luxury animations for real estate display
 */

/* ========================================
   Entrance Animations
   ======================================== */

/* Fade animations */
.tvd-fade-in {
    animation: tvdFadeIn 0.6s ease forwards;
}

.tvd-fade-in-up {
    animation: tvdFadeInUp 0.6s ease forwards;
}

.tvd-fade-in-down {
    animation: tvdFadeInDown 0.6s ease forwards;
}

.tvd-fade-in-left {
    animation: tvdFadeInLeft 0.6s ease forwards;
}

.tvd-fade-in-right {
    animation: tvdFadeInRight 0.6s ease forwards;
}

@keyframes tvdFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes tvdFadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes tvdFadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes tvdFadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes tvdFadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   Slide Transitions
   ======================================== */

.tvd-slide {
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.8s;
}

.tvd-slide:not(.active) {
    transform: scale(0.95);
}

.tvd-slide.active {
    transform: scale(1);
}

/* Slide content animations */
.tvd-slide.active .tvd-property-badges {
    animation: tvdFadeInUp 0.6s 0.2s ease forwards;
    opacity: 0;
}

.tvd-slide.active .tvd-property-type {
    animation: tvdFadeInUp 0.6s 0.3s ease forwards;
    opacity: 0;
}

.tvd-slide.active .tvd-property-title {
    animation: tvdFadeInUp 0.6s 0.4s ease forwards;
    opacity: 0;
}

.tvd-slide.active .tvd-property-location {
    animation: tvdFadeInUp 0.6s 0.5s ease forwards;
    opacity: 0;
}

.tvd-slide.active .tvd-property-features {
    animation: tvdFadeInUp 0.6s 0.6s ease forwards;
    opacity: 0;
}

.tvd-slide.active .tvd-property-price-box {
    animation: tvdFadeInUp 0.6s 0.7s ease forwards;
    opacity: 0;
}

.tvd-slide.active .tvd-slide-thumbnails {
    animation: tvdFadeInRight 0.6s 0.8s ease forwards;
    opacity: 0;
}

/* ========================================
   Background Image Animations
   ======================================== */

.tvd-slide-background {
    transition: transform 10s ease-out;
}

.tvd-slide.active .tvd-slide-background {
    transform: scale(1.05);
}

/* Ken Burns effect */
.tvd-ken-burns .tvd-slide-background {
    animation: kenBurns 15s ease-out infinite alternate;
}

@keyframes kenBurns {
    0% {
        transform: scale(1) translate(0, 0);
    }
    100% {
        transform: scale(1.1) translate(-2%, -2%);
    }
}

/* ========================================
   Ticker Animations
   ======================================== */

.tvd-prices-track,
.tvd-news-track {
    animation: tickerScroll var(--ticker-duration, 30s) linear infinite;
}

.tvd-prices-track:hover,
.tvd-news-track:hover {
    animation-play-state: paused;
}

@keyframes tickerScroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* Duplicate content for seamless loop */
.tvd-prices-track::after,
.tvd-news-track::after {
    content: '';
    display: block;
}

/* ========================================
   Pulse & Glow Effects
   ======================================== */

.tvd-pulse {
    animation: tvdPulse 2s ease-in-out infinite;
}

@keyframes tvdPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.02);
    }
}

/* Status indicator pulse */
.tvd-status-open .tvd-status-indicator {
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    50% {
        opacity: 0.8;
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
    }
}

/* Gold glow effect */
.tvd-glow-gold {
    animation: glowGold 3s ease-in-out infinite alternate;
}

@keyframes glowGold {
    from {
        box-shadow: 0 0 10px rgba(201, 169, 97, 0.3),
                    0 0 20px rgba(201, 169, 97, 0.2),
                    0 0 30px rgba(201, 169, 97, 0.1);
    }
    to {
        box-shadow: 0 0 15px rgba(201, 169, 97, 0.5),
                    0 0 30px rgba(201, 169, 97, 0.3),
                    0 0 45px rgba(201, 169, 97, 0.2);
    }
}

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

.tvd-loading {
    position: relative;
    overflow: hidden;
}

.tvd-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Skeleton loading */
.tvd-skeleton {
    background: linear-gradient(
        90deg,
        var(--tvd-surface-elevated) 25%,
        var(--tvd-surface) 50%,
        var(--tvd-surface-elevated) 75%
    );
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s ease-in-out infinite;
}

@keyframes skeletonLoading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

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

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

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

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

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

/* Shine effect on hover */
.tvd-hover-shine {
    position: relative;
    overflow: hidden;
}

.tvd-hover-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transform: skewX(-25deg);
    transition: 0.5s;
}

.tvd-hover-shine:hover::before {
    left: 125%;
}

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

.tvd-counter {
    display: inline-block;
}

.tvd-counter-animate {
    animation: countUp 1s ease-out forwards;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Progress Bar Animation
   ======================================== */

.tvd-carousel-progress-bar {
    transition: width var(--progress-duration, 8s) linear;
}

.tvd-carousel-progress-bar.animating {
    width: 100% !important;
}

.tvd-carousel-progress-bar.reset {
    transition: none;
    width: 0 !important;
}

/* ========================================
   Particle Effects
   ======================================== */

.tvd-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--tvd-primary);
    border-radius: 50%;
    pointer-events: none;
    animation: particleFloat 15s linear infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Different speeds for variety */
.tvd-particle:nth-child(odd) {
    animation-duration: 20s;
}

.tvd-particle:nth-child(3n) {
    animation-duration: 25s;
}

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

/* Typewriter effect */
.tvd-typewriter {
    overflow: hidden;
    border-right: 2px solid var(--tvd-primary);
    white-space: nowrap;
    animation: 
        typing 3s 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(--tvd-primary); }
}

/* Text reveal */
.tvd-text-reveal {
    position: relative;
    display: inline-block;
}

.tvd-text-reveal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--tvd-background);
    animation: revealText 0.6s ease forwards;
}

@keyframes revealText {
    to {
        width: 0;
    }
}

/* Gradient text animation */
.tvd-gradient-text-animate {
    background: linear-gradient(
        90deg,
        var(--tvd-primary),
        var(--tvd-accent),
        var(--tvd-primary-light),
        var(--tvd-primary)
    );
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 5s ease infinite;
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

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

/* Sun rotation */
.tvd-weather-icon[data-condition="Clear"] svg,
.tvd-weather-icon[data-condition="Sunny"] svg {
    animation: sunRotate 20s linear infinite;
}

@keyframes sunRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Cloud float */
.tvd-weather-icon[data-condition="Clouds"] svg,
.tvd-weather-icon[data-condition="Overcast"] svg {
    animation: cloudFloat 3s ease-in-out infinite;
}

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

/* Rain drops */
.tvd-weather-icon[data-condition="Rain"] svg {
    animation: rainShake 0.5s ease-in-out infinite;
}

@keyframes rainShake {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(2px); }
}

/* ========================================
   Badge Animations
   ======================================== */

.tvd-badge-exclusive {
    animation: badgeShine 3s ease-in-out infinite;
}

@keyframes badgeShine {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(201, 169, 97, 0);
    }
    50% {
        box-shadow: 0 0 20px 5px rgba(201, 169, 97, 0.3);
    }
}

.tvd-badge-new {
    animation: badgePop 2s ease-in-out infinite;
}

@keyframes badgePop {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ========================================
   Seasonal Animations
   ======================================== */

/* Snow effect (Winter) */
.tvd-season-winter .tvd-effects-layer::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(4px 4px at 100px 50px, white, transparent),
        radial-gradient(3px 3px at 200px 150px, white, transparent),
        radial-gradient(2px 2px at 300px 250px, white, transparent),
        radial-gradient(4px 4px at 400px 350px, white, transparent);
    background-size: 600px 600px;
    animation: snowfall 15s linear infinite;
    opacity: 0.5;
}

@keyframes snowfall {
    0% { transform: translateY(-600px); }
    100% { transform: translateY(600px); }
}

/* Autumn leaves */
.tvd-season-autumn .tvd-effects-layer::before {
    content: '🍂';
    position: absolute;
    font-size: 2rem;
    animation: leafFall 10s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes leafFall {
    0% {
        top: -50px;
        left: 20%;
        transform: rotate(0deg);
    }
    100% {
        top: 100%;
        left: 80%;
        transform: rotate(720deg);
    }
}

/* ========================================
   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;
    }
    
    .tvd-prices-track,
    .tvd-news-track {
        animation: none;
    }
}
