/* ============================================================
   o3-fixes.css
   إصلاح الفراغ الجانبي + تعارضات CSS + تحسين الـ responsive
   يُحمَّل بعد جميع ملفات CSS الأخرى
   ============================================================ */

/* ─── 1. إصلاح الفراغ الجانبي (السبب الجذري) ─────────────────── */
html,
body {
    overflow-x: hidden !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* كل section بعرض كامل */
.hero,
.services,
.stats,
.testimonials,
.about,
.contact,
.footer {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* ─── 2. إصلاح تعارض .slide بين ملفَي CSS ────────────────────── */
/*
   homepage-advanced.css يضع .slide بـ position:absolute top:50% left:50%
   و.slide.active بـ position:relative — هذا يكسر سلايدر o3.
   نعيد القيم الصحيحة لمشروع o3-cleaning.
*/
.hero .slide {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    transform: scale(1.1) !important;
    opacity: 0 !important;
    transition: opacity 1s ease, transform 1.5s ease !important;
    background-size: cover !important;
    background-position: center !important;
}

.hero .slide.active {
    opacity: 1 !important;
    transform: scale(1) !important;
    position: absolute !important;   /* override homepage-advanced .slide.active { position:relative } */
    top: 0 !important;
    left: 0 !important;
    visibility: visible !important;
}

/* ─── 3. إصلاح تعارض .slider-dots ──────────────────────────────── */
/* homepage-advanced يضع bottom:100px; نحن نحتاج bottom:40px */
.hero .slider-dots {
    position: absolute !important;
    bottom: 40px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    display: flex !important;
    gap: 12px !important;
    z-index: 10 !important;
}

.hero .slider-dot {
    width: 12px !important;
    height: 12px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.4) !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    border: none !important;
    overflow: visible !important;
}

.hero .slider-dot.active {
    background: #ffffff !important;
    transform: scale(1.2) !important;
}

/* ─── 4. إصلاح Hero Shapes - تجاوزها يسبب الفراغ على موبايل ──── */
.hero-shapes {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

.hero-particles {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

/* ─── 5. Header الثابت - إصلاح التعارض ─────────────────────────── */
/* homepage-advanced يعرّف .site-header بنفس الخصائص، يجب أن يكون متوافقاً */
.site-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    width: 100% !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.site-header.scrolled {
    background: rgba(26, 54, 93, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2) !important;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
}

/* ─── 6. Container - ضمان عدم تجاوز العرض ───────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ─── 7. إصلاح شبكة الخدمات ─────────────────────────────────────── */
/* homepage-advanced تعرّف .service-card بـ perspective و rotateX — نلغيه */
.services .service-card {
    transform-style: flat !important;
    perspective: none !important;
}

.services .service-card:hover {
    transform: translateY(-8px) !important;
    box-shadow: 0 20px 40px rgba(0, 180, 216, 0.18) !important;
}

/* ─── 8. Footer - إصلاح الـ wave overflow ───────────────────────── */
.footer {
    overflow: hidden !important;
    position: relative;
}

/* ─── 9. Testimonials - إصلاح overflow الاقتباسات الكبيرة ────────── */
.testimonials {
    overflow: hidden !important;
    position: relative;
}

/* ─── 10. إصلاح Nav Menu على موبايل ─────────────────────────────── */
/* prevent nav-menu from widening the page */
.nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(320px, 85vw);
    height: 100dvh;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-menu.active {
    right: 0;
}

/* ─── 11. Hero Section موبايل ────────────────────────────────────── */
@media (max-width: 768px) {
    .hero {
        height: 100dvh;
        min-height: 550px;
    }

    .slide-content {
        padding-top: 90px;
        padding-bottom: 100px;
        padding-left: 20px;
        padding-right: 20px;
    }

    .hero-title {
        font-size: clamp(1.6rem, 7vw, 2.4rem) !important;
        line-height: 1.25;
    }

    .hero-subtitle {
        font-size: clamp(0.9rem, 3.5vw, 1.1rem) !important;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .hero-buttons .btn {
        width: 100%;
        max-width: 100%;
        justify-content: center;
    }

    .scroll-indicator {
        display: none;
    }

    /* Shapes أصغر على موبايل */
    .shape-1 {
        width: 200px !important;
        height: 200px !important;
        right: -60px !important;
        top: -60px !important;
    }

    .shape-2 {
        width: 160px !important;
        height: 160px !important;
        left: -40px !important;
    }

    .shape-3,
    .shape-4 {
        display: none !important;
    }
}

/* ─── 12. Services Grid موبايل ───────────────────────────────────── */
@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    .service-card {
        padding: 30px 20px !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ─── 13. Stats موبايل ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px;
    }

    .stat-number {
        font-size: 2.8rem !important;
    }
}

@media (max-width: 400px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ─── 14. Testimonials carousel موبايل ──────────────────────────── */
@media (max-width: 768px) {
    .testimonial-card {
        flex: 0 0 100% !important;
    }

    .testimonials-carousel {
        padding: 10px 0;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .testimonial-card {
        flex: 0 0 calc(50% - 15px) !important;
    }
}

/* ─── 15. About Section موبايل ───────────────────────────────────── */
@media (max-width: 768px) {
    .about-grid {
        grid-template-columns: 1fr !important;
        gap: 30px;
    }

    .about-map {
        order: -1;
        min-height: 280px;
    }

    .about-map iframe {
        min-height: 280px !important;
    }

    .about-content h2 {
        font-size: 1.8rem !important;
    }
}

/* ─── 16. Contact موبايل ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .contact-grid {
        grid-template-columns: 1fr !important;
        gap: 30px;
    }

    .contact-form {
        padding: 25px 20px !important;
    }

    .info-card {
        padding: 20px !important;
    }
}

/* ─── 17. Footer موبايل ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 35px;
    }

    .footer {
        padding: 70px 0 30px !important;
    }
}

/* ─── 18. Section headers موبايل ────────────────────────────────── */
@media (max-width: 768px) {
    .section-header h2 {
        font-size: 1.7rem !important;
    }

    .section-header p {
        font-size: 1rem !important;
    }
}

/* ─── 19. Preloader ─────────────────────────────────────────────── */
.preloader {
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* ─── 20. Back-to-top button ──────────────────────────────────────── */
.back-to-top {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 998;
}

/* ─── 21. WhatsApp float ─────────────────────────────────────────── */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 20px;
    z-index: 999;
}

/* ─── 22. Smooth section padding على الشاشات الكبيرة ──────────────── */
@media (min-width: 1025px) {
    .services,
    .about,
    .testimonials,
    .contact {
        padding: 100px 0;
    }

    .stats {
        padding: 80px 0;
    }
}

/* ─── 23. إصلاح form labels على موبايل ──────────────────────────── */
@media (max-width: 480px) {
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* يمنع الـ zoom على iOS */
    }
}

/* ─── 24. تحسين اللمس للأزرار والروابط ──────────────────────────── */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .slider-btn,
    .carousel-btn,
    .slider-dot,
    .service-card {
        -webkit-tap-highlight-color: transparent;
    }

    .service-card:hover {
        transform: none !important;
    }

    .info-card:hover {
        transform: none !important;
    }
}

/* ─── 25. ضمان عرض السلايدر بالكامل ومنع القص ─────────────────── */
.hero {
    width: 100vw !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.hero .slider {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

.hero .slide {
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    width: 100% !important;
    height: 100% !important;
}

/* ─── 26. زر الإرجاع الخلفي وواتساب - ترتيب z-index ──────────── */
.whatsapp-float {
    z-index: 999 !important;
}

.back-to-top {
    z-index: 998 !important;
}

/* ─── 27. إصلاح slide-content في الشاشات الكبيرة ──────────────── */
@media (min-width: 769px) {
    .hero .slide-content {
        padding: 100px 60px !important;
        max-width: 800px;
        margin: 0 auto;
        width: 100%;
    }
}

/* ─── 28. تحسين عرض الصور الخلفية في السلايدر ────────────────── */
.slide {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ─── 29. Force main-navigation transparent background & style links ─── */
.site-header .main-navigation,
.main-navigation,
.main-navigation.navigation-clone,
.main-navigation.navigation-stick,
#site-navigation,
#site-navigation.navigation-clone,
#site-navigation.navigation-stick {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

.site-header .nav-menu li a {
    color: rgba(255, 255, 255, 0.95) !important;
    font-weight: 500 !important;
    transition: var(--transition);
}

.site-header .nav-menu li a:hover,
.site-header .nav-menu li a.active,
.site-header .nav-menu li a[aria-current="page"] {
    color: var(--secondary) !important;
}

/* ─── 30. Force site-main container to have no margin or padding on homepage ─── */
body.home .site-main,
body.home.separate-containers .site-main,
body.home.separate-containers .site-content,
body.home.separate-containers #page {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    box-shadow: none !important;
}

/* ─── 31. Style WhatsApp Float & Premium Tooltip ─── */
.whatsapp-float {
    position: fixed !important;
    bottom: 30px !important;
    left: 30px !important;
    right: auto !important;
    width: 60px !important;
    height: 60px !important;
    background: #25d366 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4) !important;
    z-index: 999 !important;
    transition: var(--transition) !important;
    overflow: visible !important;
    text-decoration: none !important;
}

.whatsapp-float i {
    color: white !important;
    font-size: 32px !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.whatsapp-float .whatsapp-tooltip {
    display: none !important;
}

@media (min-width: 769px) {
    .whatsapp-float .whatsapp-tooltip {
        display: block !important;
        position: absolute !important;
        left: 75px !important; /* Float on the right of the button */
        top: 50% !important;
        transform: translateY(-50%) translateX(-10px) !important;
        background: #1a202c !important; /* Premium dark background */
        color: white !important;
        padding: 8px 14px !important;
        border-radius: 8px !important;
        font-size: 0.85rem !important;
        font-weight: 600 !important;
        white-space: nowrap !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        pointer-events: none !important;
    }
    
    .whatsapp-float:hover .whatsapp-tooltip {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(-50%) translateX(0) !important;
    }
}

@media (max-width: 768px) {
    .whatsapp-float {
        bottom: 20px !important;
        left: 20px !important;
        width: 50px !important;
        height: 50px !important;
    }
    .whatsapp-float i {
        font-size: 26px !important;
    }
}

/* ─── 32. Premium Logo Sizing & Header Alignment ─── */
/* Desktop logo sizing */
.site-header .logo-img {
    height: 65px !important;
    width: auto !important;
    max-height: none !important;
    transition: height 0.3s ease !important;
}

/* Scrolled logo sizing on desktop */
.site-header.scrolled .logo-img {
    height: 55px !important;
}

/* Mobile and Tablet logo sizing */
@media (max-width: 992px) {
    .site-header .logo-img {
        height: 55px !important;
    }
    .site-header.scrolled .logo-img {
        height: 48px !important;
    }
    /* Ensure CTA phone button is a perfect circle */
    .site-header .btn-header-cta {
        width: 44px !important;
        height: 44px !important;
        border-radius: 50% !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

@media (max-width: 480px) {
    .site-header .logo-img {
        height: 48px !important;
    }
    .site-header.scrolled .logo-img {
        height: 42px !important;
    }
    .site-header .btn-header-cta {
        width: 40px !important;
        height: 40px !important;
    }
}