/* Additional Animations for KDK Alarabiya Website */

/* ===== CONSTRUCTION HERO ANIMATIONS ===== */

/* Construction Animation Container */
.construction-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

/* Buildings Animation */
.buildings-container {
    position: absolute;
    bottom: 0;
    right: 10%;
    display: flex;
    align-items: flex-end;
    gap: 20px;
    opacity: 0.15;
}

.building {
    display: flex;
    flex-direction: column-reverse;
    animation: buildingGrow 4s ease-out infinite;
}

.building-1 {
    animation-delay: 0s;
}

.building-2 {
    animation-delay: 0.8s;
}

.building-3 {
    animation-delay: 1.6s;
}

.building-floor {
    width: 40px;
    height: 25px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 2px;
    animation: floorBuild 0.8s ease-out both;
    position: relative;
}

.building-floor::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.building-1 .building-floor:nth-child(1) { animation-delay: 0s; }
.building-1 .building-floor:nth-child(2) { animation-delay: 0.3s; }
.building-1 .building-floor:nth-child(3) { animation-delay: 0.6s; }
.building-1 .building-floor:nth-child(4) { animation-delay: 0.9s; }

.building-2 .building-floor:nth-child(1) { animation-delay: 0.8s; }
.building-2 .building-floor:nth-child(2) { animation-delay: 1.1s; }
.building-2 .building-floor:nth-child(3) { animation-delay: 1.4s; }

.building-3 .building-floor:nth-child(1) { animation-delay: 1.6s; }
.building-3 .building-floor:nth-child(2) { animation-delay: 1.9s; }
.building-3 .building-floor:nth-child(3) { animation-delay: 2.2s; }
.building-3 .building-floor:nth-child(4) { animation-delay: 2.5s; }
.building-3 .building-floor:nth-child(5) { animation-delay: 2.8s; }

/* Construction Crane */
.crane-container {
    position: absolute;
    top: 20%;
    left: 15%;
    opacity: 0.2;
}

.crane {
    position: relative;
    animation: craneRotate 12s linear infinite;
}

.crane-mast {
    width: 4px;
    height: 120px;
    background: rgba(255, 255, 255, 0.4);
    position: relative;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.crane-jib {
    width: 80px;
    height: 3px;
    background: rgba(255, 255, 255, 0.4);
    position: absolute;
    top: 10px;
    left: 4px;
    transform-origin: left center;
    animation: jibSwing 6s ease-in-out infinite;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

.crane-hook {
    width: 8px;
    height: 8px;
    background: rgba(26, 105, 57, 0.7);
    border-radius: 50%;
    position: absolute;
    top: 13px;
    right: -4px;
    animation: hookMove 3s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(26, 105, 57, 0.5);
}

/* Floating Construction Elements */
.floating-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.element {
    position: absolute;
    color: rgba(255, 255, 255, 0.15);
    font-size: 2.5rem;
    animation: floatElement 8s ease-in-out infinite;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.element-1 {
    top: 20%;
    left: 20%;
    animation-delay: 0s;
}

.element-2 {
    top: 30%;
    right: 25%;
    animation-delay: 1.3s;
}

.element-3 {
    top: 50%;
    left: 10%;
    animation-delay: 2.6s;
}

.element-4 {
    top: 60%;
    right: 15%;
    animation-delay: 3.9s;
}

.element-5 {
    top: 40%;
    left: 70%;
    animation-delay: 5.2s;
}

.element-6 {
    top: 70%;
    left: 60%;
    animation-delay: 6.5s;
}

/* Geometric Patterns */
.geometric-patterns {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.pattern {
    position: absolute;
    border: 2px solid rgba(26, 105, 57, 0.15);
    animation: patternRotate 15s linear infinite;
    box-shadow: 0 0 20px rgba(26, 105, 57, 0.1);
}

.pattern-1 {
    width: 100px;
    height: 100px;
    top: 15%;
    right: 20%;
    border-radius: 50%;
    animation-delay: 0s;
}

.pattern-2 {
    width: 80px;
    height: 80px;
    top: 45%;
    left: 25%;
    transform: rotate(45deg);
    animation-delay: 3.75s;
}

.pattern-3 {
    width: 60px;
    height: 60px;
    top: 65%;
    right: 30%;
    border-radius: 50%;
    animation-delay: 7.5s;
}

.pattern-4 {
    width: 120px;
    height: 120px;
    top: 25%;
    left: 60%;
    transform: rotate(45deg);
    animation-delay: 11.25s;
}

/* Hero Content Animations */
.hero-content {
    animation: heroContentFadeIn 2.5s ease-out;
    position: relative;
    z-index: 2;
}

.hero-title {
    animation: heroTitleSlide 2s ease-out;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    animation: heroSubtitleSlide 2.3s ease-out;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.hero-btn-1 {
    animation: heroBtnSlide 2.5s ease-out;
}

.hero-btn-2 {
    animation: heroBtnSlide 2.8s ease-out;
}

/* Construction Animation Keyframes */
@keyframes buildingGrow {
    0%, 100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(1.05);
    }
}

@keyframes floorBuild {
    0% {
        transform: scaleY(0) scaleX(0.8);
        opacity: 0;
    }
    50% {
        transform: scaleY(0.5) scaleX(0.9);
        opacity: 0.5;
    }
    100% {
        transform: scaleY(1) scaleX(1);
        opacity: 1;
    }
}

@keyframes craneRotate {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(8deg);
    }
    75% {
        transform: rotate(-8deg);
    }
}

@keyframes jibSwing {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(15deg);
    }
}

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

@keyframes floatElement {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.15;
    }
    25% {
        opacity: 0.25;
    }
    50% {
        transform: translateY(-40px) rotate(180deg);
        opacity: 0.2;
    }
    75% {
        opacity: 0.1;
    }
}

@keyframes patternRotate {
    0% {
        transform: rotate(0deg) scale(1);
        opacity: 0.15;
    }
    25% {
        opacity: 0.25;
    }
    50% {
        transform: rotate(180deg) scale(1.1);
        opacity: 0.2;
    }
    75% {
        opacity: 0.1;
    }
    100% {
        transform: rotate(360deg) scale(1);
        opacity: 0.15;
    }
}

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

@keyframes heroTitleSlide {
    0% {
        opacity: 0;
        transform: translateX(-100px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes heroSubtitleSlide {
    0% {
        opacity: 0;
        transform: translateX(100px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Responsive Construction Animations */
@media (max-width: 768px) {
    .buildings-container {
        right: 5%;
        transform: scale(0.7);
        opacity: 0.1;
    }
    
    .crane-container {
        left: 10%;
        transform: scale(0.6);
        opacity: 0.15;
    }
    
    .element {
        font-size: 2rem;
    }
    
    .pattern {
        transform: scale(0.7);
    }
}

@media (max-width: 576px) {
    .construction-animation {
        opacity: 0.7;
    }
    
    .buildings-container {
        transform: scale(0.5);
        opacity: 0.08;
    }
    
    .crane-container {
        transform: scale(0.4);
        opacity: 0.1;
    }
    
    .element {
        font-size: 1.5rem;
    }
    
    .pattern {
        transform: scale(0.5);
    }
}

/* ===== END CONSTRUCTION ANIMATIONS ===== */

/* Loading Animation */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

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

.loading-text {
    color: white;
    font-size: 1.2rem;
    margin-top: 1rem;
    text-align: center;
}

/* Hero Text Animation */
.hero-text-animation {
    opacity: 0;
    transform: translateY(50px);
    animation: heroTextSlideUp 1s ease-out 0.5s forwards;
}

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

/* Staggered Animation for Service Cards */
.service-card {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.service-card.animate,
.service-card.fade-in-up {
    opacity: 1;
    transform: translateY(0);
}

.service-card:nth-child(1) { animation-delay: 0.1s; }
.service-card:nth-child(2) { animation-delay: 0.2s; }
.service-card:nth-child(3) { animation-delay: 0.3s; }
.service-card:nth-child(4) { animation-delay: 0.4s; }
.service-card:nth-child(5) { animation-delay: 0.5s; }
.service-card:nth-child(6) { animation-delay: 0.6s; }

/* Project Cards Hover Animation */
.project-card {
    transform: translateY(0);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.project-card:hover {
    transform: translateY(-15px) scale(1.02);
}

.project-card:hover .project-image img {
    transform: scale(1.15);
}

/* Statistics Counter Animation */
.stat-card {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.6s ease;
}

.stat-card.animate,
.stat-card.fade-in-up {
    opacity: 1;
    transform: scale(1);
}

.stat-number {
    font-size: 0;
    transition: font-size 0.3s ease;
}

.stat-number.animate {
    font-size: 3rem;
}

/* Contact Form Animation */
.contact-form {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease;
}

.contact-form.animate,
.contact-form.fade-in-up {
    opacity: 1;
    transform: translateY(0);
}

/* Contact Info Cards Animation */
.contact-info-card {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.contact-info-card.animate,
.contact-info-card.fade-in-up {
    opacity: 1;
    transform: translateY(0);
}

.form-control {
    transform: translateX(-20px);
    opacity: 0;
    transition: all 0.5s ease;
}

.form-control.animate {
    transform: translateX(0);
    opacity: 1;
}

.form-control:nth-child(1) { transition-delay: 0.1s; }
.form-control:nth-child(2) { transition-delay: 0.2s; }
.form-control:nth-child(3) { transition-delay: 0.3s; }

/* Navbar Animation */
.navbar {
    transform: translateY(-100%);
    animation: navbarSlideDown 0.8s ease-out forwards;
}

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

.navbar-nav .nav-link {
    opacity: 0;
    transform: translateY(-20px);
    animation: navLinkFadeIn 0.6s ease-out forwards;
}

.navbar-nav .nav-link:nth-child(1) { animation-delay: 0.1s; }
.navbar-nav .nav-link:nth-child(2) { animation-delay: 0.2s; }
.navbar-nav .nav-link:nth-child(3) { animation-delay: 0.3s; }
.navbar-nav .nav-link:nth-child(4) { animation-delay: 0.4s; }
.navbar-nav .nav-link:nth-child(5) { animation-delay: 0.5s; }
.navbar-nav .nav-link:nth-child(6) { animation-delay: 0.6s; }

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

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

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

.section-divider {
    width: 0;
    transition: width 0.8s ease 0.3s;
}

.section-divider.animate {
    width: 80px;
}

/* Client Logos Animation */
.client-logo {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.6s ease;
}

.client-logo.animate,
.client-logo.fade-in-up {
    opacity: 0.6;
    transform: scale(1);
}

.client-logo:nth-child(1) { transition-delay: 0.1s; }
.client-logo:nth-child(2) { transition-delay: 0.2s; }
.client-logo:nth-child(3) { transition-delay: 0.3s; }
.client-logo:nth-child(4) { transition-delay: 0.4s; }
.client-logo:nth-child(5) { transition-delay: 0.5s; }
.client-logo:nth-child(6) { transition-delay: 0.6s; }

/* Footer Animation */
.footer {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease;
}

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

/* Button Hover Effects */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn::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:hover::before {
    left: 100%;
}

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    z-index: 9999;
    transition: width 0.1s ease;
}

/* Parallax Effect */
.parallax-element {
    transform: translateY(0);
    transition: transform 0.1s ease-out;
}

/* Image Reveal Animation */
.image-reveal {
    position: relative;
    overflow: hidden;
}

.image-reveal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-color);
    transform: translateX(-100%);
    transition: transform 0.8s ease;
    z-index: 2;
}

.image-reveal.animate::before {
    transform: translateX(100%);
}

.image-reveal img {
    transform: scale(1.2);
    transition: transform 0.8s ease;
}

.image-reveal.animate img {
    transform: scale(1);
}

/* Text Typing Animation */
.typing-text {
    overflow: hidden;
    border-right: 2px solid var(--primary-color);
    white-space: nowrap;
    margin: 0 auto;
    animation: typing 3s 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: var(--primary-color); }
}

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

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

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

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

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

/* Responsive Animations */
@media (max-width: 768px) {
    .hero-text-animation {
        animation-duration: 0.8s;
    }
    
    .service-card,
    .project-card,
    .stat-card {
        animation-duration: 0.5s;
    }
    
    .contact-form {
        animation-duration: 0.6s;
    }
}

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