/* Animation Keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

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

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

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

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

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

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

/* Animation Classes */
.fade-in {
    animation: fadeIn 1s ease forwards;
}

.slide-in-left {
    animation: slideInLeft 1s ease forwards;
}

.slide-in-right {
    animation: slideInRight 1s ease forwards;
}

.slide-in-up {
    animation: slideInUp 1s ease forwards;
}

.slide-in-down {
    animation: slideInDown 1s ease forwards;
}

.zoom-in {
    animation: zoomIn 1s ease forwards;
}

.bounce {
    animation: bounce 1s ease infinite;
}

.pulse {
    animation: pulse 2s ease infinite;
}

.spin {
    animation: spin 2s linear infinite;
}

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

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

.fade-in-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* New Enhanced Scroll Animations */
.slide-from-left {
    opacity: 0;
    transform: translateX(-80px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    will-change: transform, opacity;
}

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

.slide-from-right {
    opacity: 0;
    transform: translateX(80px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    will-change: transform, opacity;
}

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

.slide-from-bottom {
    opacity: 0;
    transform: translateY(60px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    will-change: transform, opacity;
}

.slide-from-bottom.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Section Animation */
.section-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* Hover Effects */
.hover-scale {
    transition: transform var(--transition-normal);
}

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

.hover-brightness {
    transition: filter var(--transition-normal);
}

.hover-brightness:hover {
    filter: brightness(1.1);
}

.hover-rotate {
    transition: transform var(--transition-normal);
}

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

/* Parallax Effect */
.parallax-effect {
    overflow: hidden;
}

.parallax-effect img {
    transition: transform 0.5s ease-out;
    will-change: transform;
}

/* Hamburger Menu Animation */
.hamburger.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Stagger Animation Delay */
.stagger-animation > * {
    opacity: 0;
    animation-fill-mode: forwards;
}

.stagger-animation > *:nth-child(1) {
    animation-delay: 0s;
}

.stagger-animation > *:nth-child(2) {
    animation-delay: 0.2s;
}

.stagger-animation > *:nth-child(3) {
    animation-delay: 0.4s;
}

.stagger-animation > *:nth-child(4) {
    animation-delay: 0.6s;
}

.stagger-animation > *:nth-child(5) {
    animation-delay: 0.8s;
}

/* Background Animation */
.bg-animate {
    background-size: 300% 300%;
    animation: gradientBG 8s ease infinite;
}

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

/* Text animation transition */
.text-animate {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    display: inline-block;
}

.text-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Button animation */
.btn-animate {
    position: relative;
    overflow: hidden;
}

.btn-animate:after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transition: all 0.8s ease;
}

.btn-animate:hover:after {
    left: 100%;
}

/* Social icons hover animation */
.social-icon:hover i {
    animation: bounce 0.8s ease;
}

/* Tab container layout fixes */
.tab-content {
    position: relative;
    overflow: hidden;
    min-height: 300px; /* Ensure consistent height */
}

/* Tab content animation */
.tab-pane {
    transition: opacity 0.3s ease, transform 0.3s ease;
    visibility: hidden; /* Start hidden */
    display: none; /* Hide all tabs by default */
    position: absolute; /* All tabs are absolutely positioned */
    width: 100%; /* Ensure it takes full width */
    justify-content: space-between; /* Layout for service images and content */
    align-items: center;
    top: 0;
    left: 0;
    z-index: 1;
    opacity: 0;
}

.tab-pane.active {
    display: flex; /* Show active tab */
    opacity: 1;
    transform: translateY(0);
    z-index: 5; /* Higher z-index for active tab */
    position: relative; /* Active tab is positioned normally */
    visibility: visible !important;
}

.tab-pane.fade-out {
    opacity: 0;
    transform: translateY(10px);
    position: absolute;
    visibility: hidden !important;
    z-index: 1;
}

.tab-pane.fade-in {
    opacity: 1;
    transform: translateY(0);
}

/* Tab content specific animations - ensure always visible when active */
.tab-pane.active .service-img,
.tab-pane.active .service-info {
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateX(0) !important;
}

/* Underline animation */
.animate-underline {
    position: relative;
}

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

.animate-underline:hover:after {
    width: 100%;
}

/* ScrollReveal Animations */
[data-sr-origin] {
    visibility: hidden;
}

.is-revealed {
    visibility: visible !important;
}

/* Enhanced 3D transitions */
[data-sr-origin="left"] {
    transform-origin: left center;
}

[data-sr-origin="right"] {
    transform-origin: right center;
}

[data-sr-origin="top"] {
    transform-origin: center top;
}

[data-sr-origin="bottom"] {
    transform-origin: center bottom;
}

/* Override will-change for better performance */
[data-sr-origin] {
    will-change: transform, opacity;
}

/* Custom transitions for specific sections */
#home .hero-content.is-revealed h1,
#home .hero-content.is-revealed p,
#home .hero-content.is-revealed .btn {
    animation: fadeInStagger 0.8s ease forwards;
}

#home .hero-content.is-revealed h1 {
    animation-delay: 0.2s;
}

#home .hero-content.is-revealed p {
    animation-delay: 0.4s;
}

#home .hero-content.is-revealed .btn {
    animation-delay: 0.6s;
}

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

/* Ensure content isn't shifted during animations */
.services,
.about,
.contact,
.why-us {
    overflow-x: hidden;
}

/* Contact form specific animations */
.contact-form {
    visibility: visible !important;
    will-change: transform, opacity;
}

.contact-form.slide-from-right {
    opacity: 0;
    transform: translateX(80px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.contact-form.slide-from-right.visible,
.contact-form.is-revealed {
    opacity: 1 !important;
    transform: translateX(0) !important;
    visibility: visible !important;
}

/* Fixed styles for service tabs */
.services .tab-content {
    position: relative;
    min-height: 300px;
    overflow: hidden;
}

.services .tab-pane {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    visibility: hidden;
    display: flex;
    flex-direction: row; 
    justify-content: space-between;
    align-items: center;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    transform: translateY(20px);
    z-index: 1;
}

.services .tab-pane.active {
    opacity: 1;
    visibility: visible;
    position: relative;
    transform: translateY(0);
    z-index: 2;
}

/* Contact form specific animations */
.contact-form {
    visibility: visible !important;
    will-change: transform, opacity;
}

/* Additional mobile-specific animations */
.mobile-reveal {
    animation: mobileReveal 0.5s ease forwards;
    visibility: visible !important;
    opacity: 1 !important;
}

@keyframes mobileReveal {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
} 