/* Modern Animations Inspired by Cloudflare Workers */

/* Particle Animation Container */
.particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: linear-gradient(45deg, #3b82f6, #06b6d4);
    border-radius: 50%;
    opacity: 0;
    animation: floatParticle 15s infinite;
}

@keyframes floatParticle {
    0% {
        opacity: 0;
        transform: translateY(100vh) scale(0);
    }
    10% {
        opacity: 1;
        transform: translateY(90vh) scale(1);
    }
    90% {
        opacity: 1;
        transform: translateY(10vh) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(0) scale(0);
    }
}

/* Hero Section Animations */
.hero {
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    animation: gradientShift 20s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% {
        transform: rotate(0deg) scale(1);
        opacity: 0.7;
    }
    50% {
        transform: rotate(180deg) scale(1.1);
        opacity: 1;
    }
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-text {
    animation: slideInFromBottom 1s ease-out;
}

@keyframes slideInFromBottom {
    0% {
        opacity: 0;
        transform: translateY(50px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logo Animation */
.ozenprop-logo {
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Service Cards Animation */
.service-card {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.service-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(59, 130, 246, 0.2);
}

.service-icon {
    position: relative;
    overflow: hidden;
}

.service-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.3), transparent);
    transform: translate(-50%, -50%);
    transition: all 0.6s ease;
}

.service-card:hover .service-icon::before {
    width: 100px;
    height: 100px;
}

/* Property Cards Animation */
.property-card {
    opacity: 0;
    transform: translateY(30px) rotateX(10deg);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    perspective: 1000px;
}

.property-card.animate-in {
    opacity: 1;
    transform: translateY(0) rotateX(0);
}

.property-card:hover {
    transform: translateY(-15px) rotateX(5deg) scale(1.03);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.property-image {
    overflow: hidden;
    position: relative;
}

.property-image img {
    transition: transform 0.6s ease;
}

.property-card:hover .property-image img {
    transform: scale(1.1);
}

/* Navigation Animations */
.navbar {
    backdrop-filter: blur(10px);
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.nav-link {
    position: relative;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #06b6d4);
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Button Animations */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 1;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
    z-index: -1;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
}

/* Stats Counter Animation */
.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    background: linear-gradient(45deg, #3b82f6, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-item {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.stat-item.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Floating Elements */
.floating-element {
    position: absolute;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

/* Pulse Animation */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Glow Effect */
.glow {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    }
    to {
        box-shadow: 0 0 30px rgba(6, 182, 212, 0.8);
    }
}

/* Loading Animation */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Scroll Reveal Animation */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Text Gradient Animation */
.gradient-text {
    background: linear-gradient(45deg, #3b82f6, #06b6d4, #8b5cf6);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientText 3s ease infinite;
}

@keyframes gradientText {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Background Grid Animation */
.grid-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(59, 130, 246, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
    z-index: -1;
}

@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

/* Responsive Animations */
@media (max-width: 768px) {
    .hero-text {
        animation: slideInFromBottom 0.8s ease-out;
    }
    
    .service-card,
    .property-card {
        transition: all 0.4s ease;
    }
    
    .service-card:hover,
    .property-card:hover {
        transform: translateY(-5px) scale(1.01);
    }
}

/* Services Background Animation - Same as Hero */
.services {
    position: relative;
    overflow: hidden;
}

.services::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
    animation: gradientShift 25s ease-in-out infinite;
}

.services-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -2;
}

.services-background-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 3s ease-in-out;
    will-change: opacity;
}

.services-background-slide.active {
    opacity: 1;
}

.services-background-slide:nth-child(1) {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.02), rgba(6, 182, 212, 0.01)),
                url('img/landmark-spain2.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.3);
}

.services-background-slide:nth-child(2) {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.02), rgba(6, 182, 212, 0.01)),
                url('img/long-exposure-granvia.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.3);
}

.services-background-slide:nth-child(3) {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.02), rgba(6, 182, 212, 0.01)),
                url('img/granvia-sunset.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.3);
}

.services-background-slide:nth-child(4) {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.02), rgba(6, 182, 212, 0.01)),
                url('img/madrid-sky-downtown.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.3);
}

.services-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] .services-overlay {
    background: rgba(15, 23, 42, 0.95);
}

[data-theme="dark"] .services-background-slide:nth-child(1) {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.02), rgba(37, 99, 235, 0.01)),
                url('img/landmark-spain2.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.2);
}

[data-theme="dark"] .services-background-slide:nth-child(2) {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.02), rgba(37, 99, 235, 0.01)),
                url('img/long-exposure-granvia.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.2);
}

[data-theme="dark"] .services-background-slide:nth-child(3) {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.02), rgba(37, 99, 235, 0.01)),
                url('img/granvia-sunset.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.2);
}

[data-theme="dark"] .services-background-slide:nth-child(4) {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.02), rgba(37, 99, 235, 0.01)),
                url('img/madrid-sky-downtown.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.2);
}

/* Services container positioning */
.services .container {
    position: relative;
    z-index: 1;
}

/* Properties Background Animation - Same as Hero */
.properties {
    position: relative;
    overflow: hidden;
}

.properties::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
    animation: gradientShift 30s ease-in-out infinite;
}

.properties-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -2;
}

.properties-background-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 3s ease-in-out;
    will-change: opacity;
}

.properties-background-slide.active {
    opacity: 1;
}

.properties-background-slide:nth-child(1) {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.02), rgba(6, 182, 212, 0.01)),
                url('img/landmark-spain2.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.3);
}

.properties-background-slide:nth-child(2) {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.02), rgba(6, 182, 212, 0.01)),
                url('img/long-exposure-granvia.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.3);
}

.properties-background-slide:nth-child(3) {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.02), rgba(6, 182, 212, 0.01)),
                url('img/granvia-sunset.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.3);
}

.properties-background-slide:nth-child(4) {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.02), rgba(6, 182, 212, 0.01)),
                url('img/madrid-sky-downtown.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.3);
}

.properties-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] .properties-overlay {
    background: rgba(15, 23, 42, 0.95);
}

[data-theme="dark"] .properties-background-slide:nth-child(1) {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.02), rgba(37, 99, 235, 0.01)),
                url('img/landmark-spain2.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.2);
}

[data-theme="dark"] .properties-background-slide:nth-child(2) {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.02), rgba(37, 99, 235, 0.01)),
                url('img/long-exposure-granvia.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.2);
}

[data-theme="dark"] .properties-background-slide:nth-child(3) {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.02), rgba(37, 99, 235, 0.01)),
                url('img/granvia-sunset.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.2);
}

[data-theme="dark"] .properties-background-slide:nth-child(4) {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.02), rgba(37, 99, 235, 0.01)),
                url('img/madrid-sky-downtown.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.2);
}

/* Properties container positioning */
.properties .container {
    position: relative;
    z-index: 1;
}

/* About Background Animation - Same as Hero */
.about {
    position: relative;
    overflow: hidden;
}

.about::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
    animation: gradientShift 30s ease-in-out infinite;
}

.about-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -2;
}

.about-background-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 3s ease-in-out;
    will-change: opacity;
}

.about-background-slide.active {
    opacity: 1;
}

.about-background-slide:nth-child(1) {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.02), rgba(6, 182, 212, 0.01)),
                url('img/landmark-spain2.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.3);
}

.about-background-slide:nth-child(2) {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.02), rgba(6, 182, 212, 0.01)),
                url('img/long-exposure-granvia.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.3);
}

.about-background-slide:nth-child(3) {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.02), rgba(6, 182, 212, 0.01)),
                url('img/granvia-sunset.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.3);
}

.about-background-slide:nth-child(4) {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.02), rgba(6, 182, 212, 0.01)),
                url('img/madrid-sky-downtown.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.3);
}

.about-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] .about-overlay {
    background: rgba(15, 23, 42, 0.95);
}

[data-theme="dark"] .about-background-slide:nth-child(1) {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.02), rgba(37, 99, 235, 0.01)),
                url('img/landmark-spain2.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.2);
}

[data-theme="dark"] .about-background-slide:nth-child(2) {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.02), rgba(37, 99, 235, 0.01)),
                url('img/long-exposure-granvia.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.2);
}

[data-theme="dark"] .about-background-slide:nth-child(3) {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.02), rgba(37, 99, 235, 0.01)),
                url('img/granvia-sunset.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.2);
}

[data-theme="dark"] .about-background-slide:nth-child(4) {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.02), rgba(37, 99, 235, 0.01)),
                url('img/madrid-sky-downtown.jpg');
    background-size: cover;
    background-position: center center;
    filter: blur(2px) brightness(0.2);
}

/* About container positioning */
.about .container {
    position: relative;
    z-index: 1;
}

/* Performance Optimizations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dashboard Properties Grid Fix */
.dashboard-properties-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)) !important;
    gap: 2rem !important;
    margin-bottom: 3rem !important;
    align-items: start !important;
    justify-content: stretch !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    overflow: visible !important;
    position: relative !important;
    z-index: 1 !important;
}

.dashboard-properties-grid .property-card {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
}

/* Ensure dashboard container is visible */
.dashboard-properties {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Animation for dashboard property cards */
.dashboard-properties-grid .property-card {
    animation: slideInFromBottom 0.6s ease-out;
    animation-fill-mode: both;
}

.dashboard-properties-grid .property-card:nth-child(1) { animation-delay: 0.1s; }
.dashboard-properties-grid .property-card:nth-child(2) { animation-delay: 0.2s; }
.dashboard-properties-grid .property-card:nth-child(3) { animation-delay: 0.3s; }
.dashboard-properties-grid .property-card:nth-child(4) { animation-delay: 0.4s; }
.dashboard-properties-grid .property-card:nth-child(5) { animation-delay: 0.5s; }
