/* Advanced Animations and Effects */

/* Loading Animation */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #166534 0%, #0f766e 45%, #059669 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Floating Animation for Hero Elements */
.hero-content {
    animation: float 6s ease-in-out infinite;
}

.hero-image {
    animation: float 6s ease-in-out infinite reverse;
}

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

/* Gradient Text Effect */
.gradient-text {
    background: linear-gradient(135deg, #166534 0%, #0f766e 35%, #059669 70%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glow Effect for Buttons */
.btn-primary {
    position: relative;
    overflow: hidden;
}

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

.btn-primary:hover::before {
    left: 100%;
}

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

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #166534 0%, #059669 50%, #f59e0b 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.service-card:hover::before {
    opacity: 0.08;
}

/* Parallax Scrolling Effect */
.parallax {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Text Reveal Animation */
.text-reveal {
    overflow: hidden;
}

.text-reveal span {
    display: inline-block;
    transform: translateY(100%);
    animation: revealText 0.8s ease forwards;
}

@keyframes revealText {
    to {
        transform: translateY(0);
    }
}

/* Staggered Animation for Lists */
.staggered-list li {
    opacity: 0;
    transform: translateX(-30px);
    animation: staggerIn 0.5s ease forwards;
}

.staggered-list li:nth-child(1) { animation-delay: 0.1s; }
.staggered-list li:nth-child(2) { animation-delay: 0.2s; }
.staggered-list li:nth-child(3) { animation-delay: 0.3s; }
.staggered-list li:nth-child(4) { animation-delay: 0.4s; }

@keyframes staggerIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Morphing Shapes */
.morphing-shape {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #0f766e 0%, #0e7490 100%);
    border-radius: 50%;
    animation: morph 4s ease-in-out infinite;
}

@keyframes morph {
    0%, 100% { border-radius: 50%; }
    25% { border-radius: 0%; }
    50% { border-radius: 25%; }
    75% { border-radius: 75%; }
}

/* Pulse Animation */
.pulse {
    animation: pulse 2s infinite;
}

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

/* Slide In Animations */
.slide-in-left {
    transform: translateX(-100%);
    opacity: 0;
    animation: slideInLeft 0.8s ease forwards;
}

.slide-in-right {
    transform: translateX(100%);
    opacity: 0;
    animation: slideInRight 0.8s ease forwards;
}

.slide-in-up {
    transform: translateY(100%);
    opacity: 0;
    animation: slideInUp 0.8s ease forwards;
}

@keyframes slideInLeft {
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

@keyframes slideInUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Bounce Animation */
.bounce {
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Shake Animation */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Rotate Animation */
.rotate {
    animation: rotate 2s linear infinite;
}

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

/* Scale Animation */
.scale-in {
    transform: scale(0);
    animation: scaleIn 0.5s ease forwards;
}

@keyframes scaleIn {
    to {
        transform: scale(1);
    }
}

/* Fade In with Delay */
.fade-in-delay {
    opacity: 0;
    animation: fadeInDelay 1s ease forwards;
}

.fade-in-delay.delay-1 { animation-delay: 0.2s; }
.fade-in-delay.delay-2 { animation-delay: 0.4s; }
.fade-in-delay.delay-3 { animation-delay: 0.6s; }
.fade-in-delay.delay-4 { animation-delay: 0.8s; }

@keyframes fadeInDelay {
    to {
        opacity: 1;
    }
}

/* Hover Transform Effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.hover-scale {
    transition: transform 0.3s ease;
}

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

.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* Gradient Border Animation */
.gradient-border {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 3px;
}

.gradient-border::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    padding: 3px;
    background: linear-gradient(135deg, #0f766e 0%, #0e7490 100%);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    animation: borderRotate 3s linear infinite;
}

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

/* Typing Effect */
.typing-effect {
    overflow: hidden;
    border-right: 2px solid #0f766e;
    white-space: nowrap;
    animation: typing 3.5s 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: #0f766e; }
}

/* Responsive Animation Adjustments */
@media (max-width: 768px) {
    .parallax {
        background-attachment: scroll;
    }
    
    .morphing-shape {
        width: 60px;
        height: 60px;
    }
    
    .hero-content,
    .hero-image {
        animation: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
