/* تحسينات خاصة للآيفون - iPhone Fixes */

/* إصلاحات عامة للآيفون */
@supports (-webkit-touch-callout: none) {
    /* منع التكبير التلقائي والزوم */
    input, select, textarea {
        font-size: 16px !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        border-radius: 0 !important;
    }
    
    /* منع الزوم عند النقر المزدوج */
    * {
        touch-action: manipulation !important;
    }
    
    /* تقييد الزوم على مستوى الصفحة */
    html, body {
        -webkit-text-size-adjust: 100% !important;
        -ms-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
    }
    
    /* تحسين التمرير */
    * {
        -webkit-overflow-scrolling: touch !important;
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        user-select: none !important;
    }
    
    /* منع التداخل البصري */
    .container {
        position: relative !important;
        z-index: 1 !important;
    }
    
    /* تحسين أرقام المكاتب */
    [class*="office-number"] .code {
        position: relative !important;
        z-index: 100 !important;
        isolation: isolate !important;
        transform: translateZ(0) !important;
        -webkit-transform: translateZ(0) !important;
    }
}

/* إصلاحات للآيفون الصغير */
@media only screen and (max-device-width: 667px) {
    section.d-flex {
        transform: scale(0.55) !important;
        transform-origin: top left !important;
    }
    
    .search-form-container {
        zoom: 1.1 !important;
        padding: 15px 8px !important;
    }
    
    .container {
        padding: 2px !important;
    }
    
    [class*="office-number"] {
        font-size: 14px !important;
    }
}

/* إصلاحات للآيفون الكبير والآيباد */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
    section.d-flex {
        transform: scale(0.7) !important;
        transform-origin: top left !important;
    }
    
    .container {
        padding: 3px !important;
    }
}

/* إصلاحات للآيفون في الوضع الأفقي */
@media only screen and (max-device-width: 1024px) and (orientation: landscape) {
    section.d-flex {
        transform: scale(0.5) !important;
        transform-origin: top left !important;
    }
    
    .search-form-container {
        zoom: 1.2 !important;
        padding: 10px 5px !important;
    }
}

/* إصلاحات للآيفون في الوضع الرأسي */
@media only screen and (max-device-width: 1024px) and (orientation: portrait) {
    section.d-flex {
        transform: scale(0.6) !important;
        transform-origin: top left !important;
    }
    
    .search-form-container {
        zoom: 1.1 !important;
        padding: 15px 8px !important;
    }
}

/* إصلاحات للآيفون مع شاشة عالية الدقة */
@media only screen and (-webkit-min-device-pixel-ratio: 2) and (max-device-width: 1024px) {
    section.d-flex {
        transform: scale(0.55) !important;
        transform-origin: top left !important;
    }
}

/* إصلاحات خاصة لـ Safari على iOS */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    @media (max-width: 991px) {
        section.d-flex {
            -webkit-transform: scale(0.6) !important;
            -webkit-transform-origin: top left !important;
            transform: scale(0.6) !important;
            transform-origin: top left !important;
        }
        
        .office-scroll {
            -webkit-overflow-scrolling: touch !important;
            overflow-x: auto !important;
            scroll-behavior: smooth !important;
        }
        
        * {
            -webkit-text-size-adjust: 100% !important;
            -webkit-font-smoothing: antialiased !important;
        }
        
        .container {
            -webkit-overflow-scrolling: touch !important;
            overflow-x: auto !important;
            position: relative !important;
        }
    }
}

/* تحسينات التمرير */
.office-scroll {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: smooth !important;
    position: relative !important;
    z-index: 1 !important;
}

/* منع التداخل البصري */
.row, .col, [class*="col-"] {
    position: relative !important;
    z-index: 1 !important;
}

/* تحسين أرقام المكاتب */
[class*="office-number"] {
    position: relative !important;
    z-index: 10 !important;
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
    isolation: isolate !important;
}

/* منع الاهتزاز والخلط */
.office-scroll > * {
    will-change: auto !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
}

/* تحسين الأداء */
section.d-flex * {
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
}

/* إصلاحات خاصة للزوم في الآيفون */
@supports (-webkit-touch-callout: none) {
    /* منع النقر التلقائي أثناء الزوم - معلق مؤقتاً */
    /*
    [onclick*="officeDetails"] {
        pointer-events: auto !important;
        touch-action: manipulation !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        user-select: none !important;
    }
    */
    
    /* تحسين الاستجابة للمس أثناء الزوم - معلق مؤقتاً */
    /*
    [onclick*="officeDetails"]:active {
        transform: scale(0.95) !important;
        transition: transform 0.1s ease !important;
    }
    */
    
    /* منع التداخل أثناء الزوم */
    .office-scroll {
        position: relative !important;
        z-index: 1 !important;
        isolation: isolate !important;
    }
    
    /* تحسين عرض المكاتب أثناء الزوم */
    [class*="A"], [class*="B"], [class*="C"], [class*="D"], [class*="E"], [class*="M"], [class*="T"] {
        position: relative !important;
        z-index: 2 !important;
        isolation: isolate !important;
        -webkit-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
    }
}