/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--body-color);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

#preloader.hide {
    opacity: 0;
    visibility: hidden;
}

.loader {
    position: relative;
    width: 150px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loader-circle {
    position: absolute;
    border: 4px solid transparent;
    border-top-color: var(--first-color);
    border-radius: 50%;
    width: 100%;
    height: 100%;
    animation: spin 1.5s linear infinite;
}

.loader-circle:nth-child(2) {
    width: 70%;
    height: 70%;
    border-top-color: var(--accent-color);
    animation: spin 1s linear infinite reverse;
}

.loader-text {
    margin-top: 120px;
    font-weight: var(--font-bold);
    color: var(--title-color);
    letter-spacing: 1px;
    font-size: var(--small-font-size);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Glassmorphism Header */
.header {
    background-color: transparent;
    /* Ideally we want transparency at top, but solid or blurred on scroll. 
       Let's keep initial transparent if hero allows, but hero has bg image. 
       Let's use body-color initially but add backdrop for scroll.
    */
    background-color: var(--body-color);
}

.scroll-header {
    background-color: rgba(255, 255, 255, 0.8) !important;
    /* Force override */
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .scroll-header {
    background-color: rgba(30, 30, 30, 0.8) !important;
}

/* Clients Section */
.clients__wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3rem;
    padding: 2rem 0;
    align-items: center;
}

.client__logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color-light);
    font-size: 3rem;
    /* Icon size */
    transition: .3s;
    cursor: default;
    opacity: 0.7;
}

.client__logo span {
    font-size: var(--small-font-size);
    font-weight: var(--font-medium);
}

.client__logo:hover {
    color: var(--first-color);
    transform: translateY(-5px);
    opacity: 1;
}

/* Stats Section */
.stats {
    padding: 0;
}

.stats__bg {
    background: url('../assets/images/project4.png') no-repeat center center;
    background-size: cover;
    background-attachment: fixed;
    position: relative;
    padding: 4rem 0;
}

.stats__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--first-color);
    opacity: 0.85;
}

.stats__container {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    text-align: center;
}

.stats__item {
    color: #fff;
}

.stats__number {
    font-size: 2.5rem;
    font-weight: var(--font-bold);
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.stats__title {
    font-size: var(--normal-font-size);
    font-weight: var(--font-medium);
}

@media screen and (max-width: 768px) {
    .stats__container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 480px) {
    .stats__container {
        grid-template-columns: 1fr;
    }
}

/* Floating WhatsApp */
.whatsapp-btn {
    position: fixed;
    bottom: 2rem;
    left: 1.5rem;
    /* Different from scrollup */
    background-color: #25d366;
    color: #fff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: var(--z-tooltip);
    transition: .3s;
    animation: pulse 2s infinite;
}

.whatsapp-btn:hover {
    transform: scale(1.1);
}

[dir="rtl"] .whatsapp-btn {
    left: auto;
    right: 1.5rem;
    /* Move scrollup to left in RTL or stack them. 
       Let's put WhatsApp on the opposite side of ScrollUp. 
       ScrollUp in main CSS: right: 1.5rem (LTR). In RTL: left: 1.5rem.
       So WhatsApp: left: 1.5rem (LTR). In RTL: right: 1.5rem.
    */
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

/* Enhanced Buttons */
.button {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.button::after {
    content: '';
    position: absolute;
    width: 0;
    height: 100%;
    top: 0;
    right: 0;
    /* RTL default? */
    background-color: var(--first-color-alt);
    z-index: -1;
    transition: .3s;
}

/* We need to handle LTR/RTL for button hover slide effect if we want direction aware, 
   but simple expand is easier. 
*/
.button:hover::after {
    width: 100%;
}