/* Advanced Visual Effects and Animations */

/* Particle Background Effect */
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 100px 100px, 150px 150px, 200px 200px;
    animation: float 20s ease-in-out infinite;
    z-index: 0;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    33% {
        transform: translateY(-20px) rotate(1deg);
    }
    66% {
        transform: translateY(-10px) rotate(-1deg);
    }
}

/* Enhanced Card Hover Effects */
.service-card {
    position: relative;
    overflow: hidden;
}

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

.service-card:hover::before {
    left: 100%;
}

.service-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.service-icon {
    position: relative;
    overflow: hidden;
}

.service-icon::after {
    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: all 0.3s ease;
}

.service-card:hover .service-icon::after {
    width: 100%;
    height: 100%;
}

/* Morphing Background Gradients */
.hero-background {
    background: linear-gradient(-45deg, #e53e3e, #3182ce, #d69e2e, #38a169);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

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

/* Text Glow Effect */
.hero-title .title-main {
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    animation: textGlow 3s ease-in-out infinite alternate;
}

@keyframes textGlow {
    from {
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    }
    to {
        text-shadow: 0 0 30px rgba(255, 255, 255, 0.8), 0 0 40px rgba(255, 255, 255, 0.6);
    }
}

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

.floating:nth-child(odd) {
    animation-delay: -3s;
}

@keyframes floating {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Ripple Effect for Buttons */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::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, height 0.6s;
}

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

/* Smooth Section Transitions */
.section {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease;
}

.section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Enhanced Navigation Effects */
.navbar {
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.nav-link {
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(229, 62, 62, 0.1), transparent);
    transition: left 0.5s ease;
}

.nav-link:hover::before {
    left: 100%;
}

/* Glowing Border Effect */
.service-card.glow {
    border: 2px solid transparent;
    background: linear-gradient(var(--background-color), var(--background-color)) padding-box,
                linear-gradient(45deg, #e53e3e, #3182ce, #d69e2e) border-box;
    animation: borderGlow 3s ease-in-out infinite;
}

@keyframes borderGlow {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.2);
    }
}

/* Parallax Scroll Effect */
.parallax-element {
    transform: translateZ(0);
    will-change: transform;
}

/* Loading Animation Enhancement */
.loading-logo {
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.8));
}

.loading-spinner {
    background: conic-gradient(from 0deg, transparent, #ffffff, transparent);
    border: none;
    border-radius: 50%;
    animation: spin 1s linear infinite, pulse 2s ease-in-out infinite;
}

/* Stats Counter Animation */
.stat-number {
    background: linear-gradient(45deg, #ffffff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 2s ease-in-out infinite;
}

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

/* Scroll Indicator Animation */
.scroll-indicator {
    animation: bounce 2s infinite, fadeInOut 4s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

/* Enhanced Search Modal */
.search-modal {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.search-content {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.search-box {
    position: relative;
}

.search-box::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.search-box:focus-within::after {
    width: 100%;
}

/* Governorate Cards Animation */
.governorate-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.governorate-card:hover {
    transform: translateY(-5px) rotateY(5deg);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

/* Footer Wave Effect */
.footer::before {
    content: '';
    position: absolute;
    top: -50px;
    left: 0;
    width: 100%;
    height: 50px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M321.39,56.44c58-10.79,114.16-30.13,172-41.86,82.39-16.72,168.19-17.73,250.45-.39C823.78,31,906.67,72,985.66,92.83c70.05,18.48,146.53,26.09,214.34,3V0H0V27.35A600.21,600.21,0,0,0,321.39,56.44Z' fill='%23ffffff'%3E%3C/path%3E%3C/svg%3E") no-repeat;
    background-size: cover;
}

[data-theme="dark"] .footer::before {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M321.39,56.44c58-10.79,114.16-30.13,172-41.86,82.39-16.72,168.19-17.73,250.45-.39C823.78,31,906.67,72,985.66,92.83c70.05,18.48,146.53,26.09,214.34,3V0H0V27.35A600.21,600.21,0,0,0,321.39,56.44Z' fill='%232d3748'%3E%3C/path%3E%3C/svg%3E") no-repeat;
    background-size: cover;
}

/* Back to Top Button Enhancement */
.back-to-top {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    animation: pulse 2s ease-in-out infinite;
}

.back-to-top:hover {
    animation: none;
    transform: translateY(-3px) scale(1.1);
}

/* Mobile Enhancements */
@media (max-width: 768px) {
    .hero::before {
        background-size: 50px 50px, 75px 75px, 100px 100px;
    }
    
    .service-card:hover {
        transform: translateY(-3px) scale(1.01);
    }
    
    .governorate-card:hover {
        transform: translateY(-3px);
    }
}

/* 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;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .service-card {
        border: 2px solid var(--text-primary);
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Print Optimizations */
@media print {
    .hero::before,
    .service-card::before,
    .floating,
    .parallax-element {
        display: none !important;
    }
    
    .service-card,
    .governorate-card {
        break-inside: avoid;
    }
}

