@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ===== Base Typography ===== */
html[lang="ar"] {
    font-family: 'Cairo', sans-serif;
}

html[lang="en"] {
    font-family: 'Inter', sans-serif;
}

body, h1, h2, h3, h4, h5, h6 {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Body & Background ===== */
body {
    background-color: #141f18;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(16, 185, 129, 0.05), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(245, 158, 11, 0.02), transparent),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.025'/%3E%3C/svg%3E");
    color: #d4d8d6;
    overflow-x: hidden;
}

/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar {
    width: 5px;
}
::-webkit-scrollbar-track {
    background: #0e1610;
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #10b981, #047857);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #34d399, #10b981);
}

/* ===== Selection ===== */
::selection {
    background: rgba(16, 185, 129, 0.35);
    color: #fff;
}

/* ===== Smooth Scroll ===== */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px; /* Offset for fixed navbar */
}

/* ===== Accessibility Focus Ring ===== */
:focus-visible {
    outline: 2px solid #10b981;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ===== Back to Top Button ===== */
#back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ===== Base Gradients ===== */
.bg-gradient-eco {
    background: linear-gradient(135deg, #141f18 0%, #1a2e22 50%, #141f18 100%);
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
}

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

.bg-hero-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.12) 0%, rgba(20, 31, 24, 0) 70%);
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 0;
    pointer-events: none;
    animation: pulseGlowHero 10s infinite alternate ease-in-out;
}

@keyframes pulseGlowHero {
    0% { opacity: 0.4; transform: translateX(-50%) scale(0.95); }
    100% { opacity: 0.7; transform: translateX(-50%) scale(1.05); }
}

/* ===== Cards ===== */
.eco-card {
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.04);
    background: linear-gradient(155deg, rgba(26, 46, 34, 0.85), rgba(20, 31, 24, 0.95));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.eco-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35), 0 0 30px rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.2);
}
.eco-card:hover i {
    transform: scale(1.1);
    transition: transform 0.4s ease;
}

/* ===== Fancy Image Hover ===== */
.fancy-img {
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.6s ease;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.fancy-img:hover {
    transform: scale(1.02) translateY(-4px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.45), 0 0 25px rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.15);
}

/* ===== Floating Animations ===== */
.animate-float {
    animation: float 7s ease-in-out infinite;
}

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

/* ===== Scroll Reveal Animation ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0px);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ===== Buttons ===== */
.fancy-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.fancy-btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: -100%;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0) 100%);
    transition: all 0.6s ease;
}
.fancy-btn:hover::after {
    left: 100%;
}
.fancy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(16, 185, 129, 0.2), 0 0 15px rgba(245, 158, 11, 0.1);
}
.fancy-btn:active {
    transform: translateY(0) scale(0.98);
}

.fancy-btn-outline:hover {
    background-color: rgba(16, 185, 129, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.15);
}

/* ===== WhatsApp Floating Button ===== */
@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.6);
        transform: scale(1);
    }
    50% {
        transform: scale(1.04);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
        transform: scale(1);
    }
}

.whatsapp-float {
    animation: pulseGlow 3s infinite;
}

/* ===== Form Inputs ===== */
input, textarea {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
input:focus, textarea:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.08), 0 0 15px rgba(16, 185, 129, 0.06) !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
}
input::placeholder, textarea::placeholder {
    color: #3d5448;
    font-weight: 500;
}

/* ===== Section Headings ===== */
section h3 {
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.2);
}

/* ===== Animated Text Gradient ===== */
.animate-text-gradient {
    background-size: 200% auto;
    animation: textGradient 5s linear infinite;
}

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

/* ===== Clients Carousel ===== */
html[dir="rtl"] .animate-carousel-scroll {
    animation: carouselScrollRTL 50s linear infinite;
}
html[dir="ltr"] .animate-carousel-scroll {
    animation: carouselScrollLTR 50s linear infinite;
}
.animate-carousel-scroll:hover {
    animation-play-state: paused;
}
@keyframes carouselScrollRTL {
    0% { transform: translateX(33.333%); }
    100% { transform: translateX(0%); }
}
@keyframes carouselScrollLTR {
    0% { transform: translateX(0%); }
    100% { transform: translateX(-33.333%); }
}

/* ===== Divider Line ===== */
.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.12), transparent);
}

/* ===== Subtle Link Underline ===== */
.nav-link-underline {
    position: relative;
}
.nav-link-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #22c55e;
    border-radius: 1px;
    transition: width 0.3s ease;
}
.nav-link-underline:hover::after {
    width: 100%;
}

/* ===== Responsive Fine-tuning ===== */
@media (max-width: 768px) {
    .eco-card:hover {
        transform: translateY(-3px);
    }

    .fancy-img:hover {
        transform: scale(1.01) translateY(-2px);
    }
}

/* ===== Smooth page transitions ===== */
section {
    position: relative;
}

/* ===== Hero Image Animations ===== */
.hero-img-main {
    animation: heroImgFadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.hero-img-secondary {
    animation: heroImgSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.6s both;
}

@keyframes heroImgFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
        filter: blur(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0px);
    }
}

@keyframes heroImgSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0px);
    }
}

/* ===== About Section Image Animations ===== */
.about-img-main {
    animation: aboutImgReveal 1s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

.about-img-secondary {
    animation: aboutImgSlide 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.7s both;
}

@keyframes aboutImgReveal {
    from {
        opacity: 0;
        transform: translateX(-20px) scale(0.96);
        filter: blur(5px);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
        filter: blur(0px);
    }
}

@keyframes aboutImgSlide {
    from {
        opacity: 0;
        transform: translateY(25px) scale(0.94);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0px);
    }
}

/* ===== Gradient text (for i18n innerHTML injection) ===== */
.gradient-text {
    background: linear-gradient(to right, #6ee7b7, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* ===== Subject Select Dropdown ===== */
#subjectSelect option {
    background-color: #0f1a13;
    color: #e5e7eb;
    padding: 12px;
}
#subjectSelect option:disabled {
    color: #4b5563;
}
#subjectSelect:invalid,
#subjectSelect option[value=""] {
    color: #4b5563;
}
#subjectSelect:focus option {
    color: #e5e7eb;
}
