/* ============================================
   CIVITAS ENGINEERING - ANIMATIONS CSS
   Modern animations for a professional construction website
   ============================================ */

/* ============================================
   BASE ANIMATION KEYFRAMES
   ============================================ */

/* Fade In Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale Animations */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(30, 136, 229, 0.4);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(30, 136, 229, 0);
    }
}

/* Slide Animations */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Bounce Animation */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes floatSlow {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-15px) rotate(2deg);
    }
}

/* Rotate Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

/* Shimmer Effect */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Glow Animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(30, 136, 229, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(30, 136, 229, 0.8), 0 0 30px rgba(30, 136, 229, 0.6);
    }
}

/* Counter Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Draw Line Animation */
@keyframes drawLine {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes drawLineVertical {
    from {
        height: 0;
    }
    to {
        height: 100%;
    }
}

/* Typewriter Effect */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    0%, 50% {
        border-color: transparent;
    }
    51%, 100% {
        border-color: #1e88e5;
    }
}

/* Wave Animation */
@keyframes wave {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-5px);
    }
    75% {
        transform: translateY(5px);
    }
}

/* Ripple Effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* ============================================
   ANIMATION UTILITY CLASSES
   ============================================ */

/* Fade Animations */
.animate-fadeIn {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fadeInDown {
    animation: fadeInDown 0.6s ease-out forwards;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.6s ease-out forwards;
}

.animate-fadeInRight {
    animation: fadeInRight 0.6s ease-out forwards;
}

/* Scale Animations */
.animate-scaleIn {
    animation: scaleIn 0.5s ease-out forwards;
}

.animate-scaleUp {
    animation: scaleUp 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-pulseGlow {
    animation: pulseGlow 2s ease-in-out infinite;
}

/* Slide Animations */
.animate-slideInUp {
    animation: slideInUp 0.6s ease-out forwards;
}

.animate-slideInLeft {
    animation: slideInLeft 0.6s ease-out forwards;
}

.animate-slideInRight {
    animation: slideInRight 0.6s ease-out forwards;
}

/* Bounce Animations */
.animate-bounce {
    animation: bounce 1s ease infinite;
}

.animate-bounceIn {
    animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Float Animation */
.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-floatSlow {
    animation: floatSlow 4s ease-in-out infinite;
}

/* Rotate Animations */
.animate-rotate {
    animation: rotate 10s linear infinite;
}

.animate-rotateIn {
    animation: rotateIn 0.6s ease-out forwards;
}

/* Glow Animation */
.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

/* ============================================
   ANIMATION DELAYS
   ============================================ */

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* ============================================
   ANIMATION DURATIONS
   ============================================ */

.duration-300 { animation-duration: 0.3s; }
.duration-500 { animation-duration: 0.5s; }
.duration-700 { animation-duration: 0.7s; }
.duration-1000 { animation-duration: 1s; }
.duration-1500 { animation-duration: 1.5s; }
.duration-2000 { animation-duration: 2s; }

/* ============================================
   SCROLL-TRIGGERED ANIMATIONS
   ============================================ */

/* Initial hidden state for scroll animations */
.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-animate-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-animate-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.scroll-animate-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-animate-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.scroll-animate-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-animate-scale.visible {
    opacity: 1;
    transform: scale(1);
}

/* ============================================
   HOVER ANIMATIONS
   ============================================ */

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(30, 136, 229, 0.4);
}

.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* Button Hover Effects */
.btn-hover-slide {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-hover-slide::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 ease;
    z-index: -1;
}

.btn-hover-slide:hover::before {
    left: 100%;
}

/* Card Hover Effects */
.card-hover-border {
    position: relative;
    overflow: hidden;
}

.card-hover-border::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #1e88e5, #42a5f5);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.card-hover-border:hover::before {
    transform: scaleX(1);
}

/* Icon Hover Effects */
.icon-hover-bounce:hover {
    animation: bounce 0.5s ease;
}

.icon-hover-rotate:hover {
    animation: rotate 0.5s ease;
}

.icon-hover-pulse:hover {
    animation: pulse 0.5s ease;
}

/* ============================================
   STAGGER ANIMATIONS FOR LISTS
   ============================================ */

.stagger-animate > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animate > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animate > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animate > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animate > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-animate > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-animate > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-animate > *:nth-child(8) { animation-delay: 0.8s; }

/* ============================================
   LOADING ANIMATIONS
   ============================================ */

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(30, 136, 229, 0.2);
    border-top-color: #1e88e5;
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

.loading-dots {
    display: flex;
    gap: 8px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: #1e88e5;
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ============================================
   PROGRESS BAR ANIMATIONS
   ============================================ */

.progress-animate {
    width: 0;
    transition: width 1.5s ease-out;
}

.progress-animate.visible {
    width: var(--progress-width, 100%);
}

/* ============================================
   NUMBER COUNTER ANIMATION
   ============================================ */

.counter-animate {
    display: inline-block;
    animation: countUp 0.5s ease-out forwards;
}

/* ============================================
   SECTION TRANSITIONS
   ============================================ */

.section-transition {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-transition.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   PARALLAX EFFECT HELPERS
   ============================================ */

.parallax-slow {
    will-change: transform;
    transition: transform 0.1s linear;
}

.parallax-medium {
    will-change: transform;
    transition: transform 0.05s linear;
}

.parallax-fast {
    will-change: transform;
    transition: transform 0.02s linear;
}

/* ============================================
   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;
    }
    
    .scroll-animate,
    .scroll-animate-left,
    .scroll-animate-right,
    .scroll-animate-scale {
        opacity: 1;
        transform: none;
    }
}

/* ============================================
   SPECIAL EFFECTS
   ============================================ */

/* Gradient Text Animation */
.gradient-text-animate {
    background: linear-gradient(90deg, #1e88e5, #42a5f5, #1e88e5);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s linear infinite;
}

/* Border Animation */
.border-animate {
    position: relative;
}

.border-animate::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #1e88e5;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.border-animate:hover::after {
    width: 100%;
}

/* Underline Animation */
.underline-animate {
    position: relative;
    display: inline-block;
}

.underline-animate::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #1e88e5, #42a5f5);
    transition: width 0.3s ease;
}

.underline-animate:hover::after {
    width: 100%;
}

/* Image Reveal Animation */
.image-reveal {
    position: relative;
    overflow: hidden;
}

.image-reveal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1e88e5;
    transform: translateX(-100%);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.image-reveal.visible::before {
    transform: translateX(100%);
}

/* Text Reveal Animation */
.text-reveal {
    overflow: hidden;
}

.text-reveal span {
    display: inline-block;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.text-reveal.visible span {
    transform: translateY(0);
}

/* Morphing Shape Animation */
@keyframes morph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
}

.morph-shape {
    animation: morph 8s ease-in-out infinite;
}

/* Particle Float Animation */
@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 1;
    }
    50% {
        transform: translateY(-20px) translateX(10px);
        opacity: 0.7;
    }
}

.particle {
    animation: particleFloat 4s ease-in-out infinite;
}

.particle:nth-child(2) { animation-delay: 0.5s; }
.particle:nth-child(3) { animation-delay: 1s; }
.particle:nth-child(4) { animation-delay: 1.5s; }
.particle:nth-child(5) { animation-delay: 2s; }

/* ============================================
   VISIBILITY FIXES FOR ICONS AND ANIMATIONS
   ============================================ */

/* Ensure Font Awesome icons are always visible */
.fa, .fas, .far, .fab, .flaticon, [class^="flaticon-"], [class*=" flaticon-"] {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Fix for ftco-animate visibility */
.ftco-animate {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

/* Ensure all cards and sections are visible */
.services-wrap,
.project-wrap,
.news-wrap,
.block-18,
.staff {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Navigation menu visibility fix */
@media (min-width: 992px) {
    #ftco-nav,
    .navbar-collapse {
        display: flex !important;
        visibility: visible !important;
    }
    
    .navbar-nav-custom {
        display: flex !important;
        flex-direction: row !important;
        visibility: visible !important;
    }
    
    .navbar-nav-custom li,
    .navbar-nav-custom li a {
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Ensure hover effects work properly */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

.hover-lift:hover {
    transform: translateY(-8px) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15) !important;
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

/* Mobile responsive for all sections */
@media (max-width: 768px) {
    section {
        padding: 60px 0 !important;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    h1 {
        font-size: 2rem !important;
    }
    
    h2 {
        font-size: 1.8rem !important;
    }
    
    h3 {
        font-size: 1.4rem !important;
    }
    
    /* Fix padding on mobile */
    [style*="paddingLeft: '30px'"],
    [style*="padding-left: 30px"] {
        padding-left: 0 !important;
    }
}

@media (max-width: 576px) {
    section {
        padding: 40px 0 !important;
    }
    
    h1 {
        font-size: 1.6rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.2rem !important;
    }
}

/* Ensure all content is visible */
.blog-entry,
.services-wrap,
.project-wrap,
.news-wrap,
.block-6,
.media,
.card,
.bg-white {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Fix for sections with background images */
section[style*="background"] {
    background-attachment: scroll !important;
}

@media (min-width: 992px) {
    section[style*="background"] {
        background-attachment: fixed !important;
    }
}
