/**
 * SADAF Website - Unified Responsive System
 * نظام متجاوب موحد - يحل جميع التضاربات
 * Version: 2.0 - Mobile-First Unified
 */

/* ==========================================================================
   IMPORTANT: هذا الملف يجب أن يُحمل بعد جميع ملفات CSS الأخرى
   ========================================================================== */

/* ==========================================================================
   1. RESET & OVERRIDE CONFLICTS
   ========================================================================== */

/* إلغاء أي !important غير ضرورية من الملفات الأخرى */
* {
    box-sizing: border-box;
}

/* ==========================================================================
   2. MOBILE BASE (< 576px) - الهواتف الصغيرة
   ========================================================================== */

/* Menu Bar - Mobile */
@media (max-width: 767px) {
    .menu-bar {
        padding: 0.75rem 0;
        /* لا نغير الألوان/الـ theme — فقط تثبيت وتجهيز تخطيط الموبايل */
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
    }

    .menu-container {
        /* رجوع لتخطيط سطر واحد مثل style.css لتجنب تمدد الهيدر */
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        /* Even tighter gap */
        padding: 0 10px;
        /* Tighter padding */
        height: 60px;
        /* Ultra-compact height for 24px logo */
    }

    .logo {
        width: auto;
        max-width: none;
        margin: 0;
    }

    .logo-image {
        height: 24px;
        /* User requested extreme reduction */
        width: auto;
    }

    .menu-list {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
        padding: 0;
    }

    .menu-list.active {
        display: flex;
        /* نفس فكرة dropdown الموجودة في style.css لكن نضبط top حسب ارتفاع الهيدر */
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        padding: 16px;
        gap: 10px;
        box-shadow: var(--shadow-lg);
        z-index: 1100;
    }

    .menu-link {
        padding: 10px 14px;
        text-align: center;
        width: 100%;
    }

    .header-actions {
        /* Keep hamburger and lang toggle */
        display: flex;
        flex-direction: row;
        align-items: center;
        width: auto;
        gap: 15px;
    }

    .cta-buttons-container {
        /* Restore: Horizontal scrolling chips */
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 4px;
        /* Tighter gap */
        padding: 2px;
        max-width: calc(100vw - 120px);
        /* Adjusted for even smaller triggers */
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
    }

    .menu-toggle {
        display: flex !important;
        min-width: 28px;
        height: 28px;
        align-items: center;
        justify-content: center;
        font-size: 1.0rem !important;
        /* Smaller icon */
        padding: 0 !important;
        color: var(--text-primary);
        background: transparent;
        border: none;
    }

    .lang-toggle {
        width: 28px;
        height: 24px;
        flex-shrink: 0;
    }

    .header-btn {
        width: auto;
        padding: 4px 8px;
        font-size: 0.6rem;
        white-space: nowrap;
    }
}

/* Cleanup orphan styles */
.cta-buttons-container::-webkit-scrollbar {
    display: none;
}

.header-btn {
    width: auto;
    padding: 8px 12px;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Ensure all header buttons are visible on mobile */
.cta-buttons-container .header-btn {
    display: inline-block !important;
}

/* Hide the 3rd button (Register Talent) on mobile/tablet as requested */
@media (max-width: 991px) {
    .cta-buttons-container .header-btn:nth-child(3) {
        display: none !important;
    }
}


/* ==========================================================================
   "مع من نعمل؟" / Clients (Mobile): تصغير الكروت لعرض عدد أكبر
   ========================================================================== */
@media (max-width: 767px) {
    #clients .customer-logos-wrapper {
        padding: 18px 0 !important;
    }

    #clients .customer-logos .slide {
        padding: 0 4px !important;
    }

    #clients .customer-logos .slick-list {
        margin: 0 -4px !important;
        padding: 10px 0 !important;
    }

    #clients .client-logo-wrapper {
        padding: 14px 10px !important;
        height: 92px !important;
        border-radius: 12px !important;
        box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16) !important;
    }

    #clients .client-logo {
        width: 86px !important;
        height: 54px !important;
    }
}

/* ==========================================================================
   Services (Mobile): 2 services per row
   ========================================================================== */
@media (max-width: 767px) {

    /* الصفحة الرئيسية تستخدم services-grid-3col */
    #services .services-grid-3col {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
    }

    #services .services-grid-3col .service-card {
        min-height: 160px !important;
        padding: 16px 12px !important;
        gap: 10px !important;
        border-radius: 14px !important;
    }

    #services .services-grid-3col .service-icon {
        transform: scale(0.9);
    }

    #services .services-grid-3col .service-card h3 {
        font-size: 0.95rem !important;
        line-height: 1.25 !important;
        margin: 0 !important;
    }
}

/* ==========================================================================
   Service Modal close button (All sizes)
   - دائمًا يسار
   - إزالة أي لون/حد أزرق للـ focus
   ========================================================================== */
.service-modal-close {
    left: 12px !important;
    right: auto !important;
}

.service-modal-close:focus,
.service-modal-close:focus-visible,
.service-modal-close:active {
    outline: none !important;
    box-shadow: none !important;
}

/* Hero Section - Mobile */
@media (max-width: 767px) {
    .hero-section {
        min-height: auto;
        padding: 2rem 0;
    }

    .hero-container {
        flex-direction: column;
        gap: 1.5rem;
        padding: 0 1rem;
    }

    .hero-text-layer {
        width: 100%;
        text-align: center;
        padding: 1rem 0;
    }

    .hero-main-title {
        font-size: 2.1rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    .hero-main-subtitle {
        font-size: 1.2rem;
        line-height: 1.5;
        margin-bottom: 1rem;
    }

    /* Typography - Reduced Sizes */
    h1,
    .h1 {
        font-size: 1.75rem !important;
    }

    h2,
    .h2 {
        font-size: 1.5rem !important;
    }

    /* Hero Slider Mobile - Reverted to Absolute but positioned safely */
    .hero-slider-cards {
        position: absolute !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 60% !important;
        /* Take up bottom 60% */
        width: 100% !important;
        z-index: 1 !important;
        overflow: visible !important;
        background: transparent !important;
    }

    .hero-text-layer {
        position: relative;
        z-index: 5;
        margin-bottom: 250px;
        /* Push text up to avoid slider overlap */
    }

    /* Keep internal container clean */
    .hero-slider-cards .slider-cards-container {
        width: 100% !important;
        overflow-x: auto !important;
        padding-bottom: 20px;
    }

    h3,
    .h3 {
        font-size: 1.25rem !important;
    }

    .hero-main-title {
        font-size: 2rem !important;
        margin-bottom: 15px !important;
    }

    .hero-main-subtitle {
        font-size: 1rem !important;
    }

    .section-title,
    .features-main-title,
    .services-section-title {
        font-size: 1.6rem !important;
        margin-bottom: 20px !important;
    }

    .section-subtitle {
        font-size: 0.9rem !important;
        margin-bottom: 20px !important;
    }

    /* Adjust margins to prevent 'cutting' look */
    .page-section {
        padding: 40px 0 !important;
        overflow: visible !important;
        /* Allow shadows to show */
    }

    .hero-description {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .hero-cta-buttons {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .hero-btn {
        width: 100%;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }

    .hero-slider-cards {
        width: 100%;
        min-height: 300px;
    }
}

/* Services Grid - Mobile */
@media (max-width: 767px) {
    .services-grid-3col {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .service-category-card {
        padding: 1.5rem;
    }

    .service-category-title {
        font-size: 1.25rem;
    }

    .service-category-description {
        font-size: 0.9rem;
    }
}

/* Modals - Mobile UNIFIED */
/* Modals - Mobile UNIFIED (Flexbox Fix) */
@media (max-width: 767px) {

    /* 1. Modal Wrapper: Full screen, high z-index */
    .service-modal,
    .project-modal,
    .ad-modal,
    #serviceRequestModal,
    #contactModal {
        padding: 0 !important;
        align-items: flex-start !important;
        /* Ensure content starts at top */
        z-index: 9999 !important;
        /* Above everything */
    }

    /* 2. Modal Content: Flex Column, Full Height */
    .service-modal-content,
    .project-modal-content,
    .ad-modal-content,
    #serviceRequestModal .service-modal-content,
    #contactModal .service-modal-content {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh !important;
        min-height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        background: var(--bg-primary) !important;
        /* Ensure solid background */
    }

    /* 3. Modal Header: Fixed at top (via flex) */
    .service-modal-header,
    .project-modal-header {
        flex-shrink: 0 !important;
        position: relative !important;
        /* Flex handles positioning */
        width: 100% !important;
        z-index: 10 !important;
        padding: 15px !important;
        background: var(--bg-secondary) !important;
        border-bottom: 1px solid var(--border-color) !important;
    }

    .service-modal-title {
        font-size: 1.1rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 4. Modal Body: Scrollable Area */
    .service-modal-body,
    .project-modal-body,
    .ad-modal-body,
    .service-request-modal-body {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 15px !important;
        height: auto !important;
        max-height: none !important;
        /* Remove constraints */
        display: block !important;
        /* Default to block, specific overrides below */
    }

    /* --- Specific Adjustments --- */

    /* Close Button - Bigger touch target */
    .service-modal-close,
    .project-modal-close,
    .ad-modal-close,
    .sub-services-modal-close {
        width: 44px !important;
        height: 44px !important;
        font-size: 1.5rem !important;
        line-height: 44px !important;
        position: relative !important;
        /* Relative to header flex container if possible, or keep absolute */
        top: auto !important;
        left: auto !important;
        right: auto !important;
    }


    .project-modal-details {
        width: 100% !important;
        padding: 0 !important;
    }

    /* Ad Modal Specific */
    .ad-modal-content {
        background-size: cover !important;
        background-position: center !important;
    }

    /* Darken overlay for better readibilty on ads */
    .ad-modal-content::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.85);
        z-index: 0;
    }

    .ad-modal-body {
        position: relative;
        z-index: 1;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center;
        padding: 20px !important;
    }

    .ad-modal-poster {
        display: none !important;
    }

    .ad-modal-details {
        width: 100% !important;
        background: transparent !important;
        padding: 0 !important;
        text-align: center;
    }

    .ad-modal-title {
        font-size: 1.5rem !important;
        margin-bottom: 15px !important;
    }

    .ad-modal-description {
        font-size: 1rem !important;
        line-height: 1.6 !important;
        /* "Add container with opacity ... not white" */
        background: rgba(0, 0, 0, 0.6) !important;
        padding: 15px !important;
        border-radius: 8px !important;
        color: #fff !important;
        display: block !important;
        /* Ensure visible */
    }
}

/* Service Modal Tabs - Mobile */
@media (max-width: 767px) {
    .service-modal-tabs-container {
        padding: 0 1rem 0.5rem !important;
    }

    .tabs-wrapper {
        gap: 0.5rem;
    }

    .tab-arrow {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.85rem !important;
    }

    .tabs-header {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .tab-btn {
        padding: 0.5rem 0.875rem !important;
        font-size: 0.85rem !important;
    }

    .tab-count {
        font-size: 0.7rem !important;
        padding: 2px 6px !important;
    }

    .service-card-slider {
        padding: 1rem !important;
        min-height: 400px !important;
        max-height: 400px !important;
    }

    .service-card-title {
        font-size: 1.2rem !important;
    }

    .service-card-body {
        max-height: 320px !important;
    }

    .service-detail-item {
        padding: 0.75rem !important;
        font-size: 0.9rem !important;
    }
}

/* Service Request Modal - Mobile */
@media (max-width: 767px) {
    #serviceRequestModal .service-modal-content {
        border-radius: 0 !important;
    }

    .service-request-modal-body {
        padding: 1rem !important;
    }

    .steps-progress {
        padding: 1rem !important;
    }

    .step-circle {
        width: 36px !important;
        height: 36px !important;
        font-size: 0.9rem !important;
    }

    .step-label {
        font-size: 0.75rem !important;
    }

    .modal-form-row {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .modal-service-categories {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }

    .modal-service-category {
        padding: 1rem 0.75rem !important;
    }

    .modal-service-category-icon {
        font-size: 1.5rem !important;
    }

    .modal-service-category-name {
        font-size: 0.8rem !important;
    }

    .service-request-modal-footer {
        flex-direction: column-reverse !important;
        padding: 1rem !important;
        gap: 0.75rem;
    }

    .modal-btn {
        width: 100% !important;
        justify-content: center;
        padding: 0.875rem 1.5rem !important;
    }

    .sub-services-modal-content {
        width: 95% !important;
        max-height: 80vh !important;
    }
}

/* Forms - Mobile */
@media (max-width: 767px) {
    .form-row {
        flex-direction: column !important;
        gap: 1rem;
    }

    .form-group {
        width: 100% !important;
    }

    .form-control,
    .modal-form-input,
    .modal-form-select,
    .modal-form-textarea {
        width: 100%;
        padding: 0.75rem !important;
        font-size: 1rem !important;
    }

    .phone-input-wrapper,
    .modal-phone-wrapper {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.5rem;
    }

    .phone-code-select,
    .modal-phone-code {
        width: 100px !important;
        flex-shrink: 0;
    }

    .phone-number-input,
    .modal-phone-number {
        flex: 1 !important;
    }

    .submit-btn {
        width: 100% !important;
        padding: 1rem !important;
        font-size: 1rem !important;
    }
}

/* Floating Buttons - Mobile */
@media (max-width: 767px) {

    .floating-contact-btn,
    .service-request-btn-floating {
        bottom: 1rem !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.875rem !important;
        border-radius: 25px;
    }

    .floating-contact-btn {
        right: 1rem !important;
    }

    .service-request-btn-floating {
        left: 1rem !important;
    }

    .floating-contact-btn i,
    .service-request-btn-floating i {
        font-size: 1rem !important;
    }

    /* تواصل معنا: أيقونة فقط على الجوال */
    .floating-contact-btn span {
        display: none !important;
    }

    .floating-contact-btn {
        width: 52px !important;
        height: 52px !important;
        padding: 0 !important;
        justify-content: center !important;
        border-radius: 999px !important;
        gap: 0 !important;
    }

    .floating-contact-btn i {
        font-size: 1.25rem !important;
    }
}

/* تواصل معنا: أيقونة فقط على الآيباد/التابلت أيضاً */
@media (min-width: 768px) and (max-width: 991px) {
    .floating-contact-btn span {
        display: none !important;
    }

    .floating-contact-btn {
        width: 56px !important;
        height: 56px !important;
        padding: 0 !important;
        justify-content: center !important;
        border-radius: 999px !important;
        gap: 0 !important;
    }

    .floating-contact-btn i {
        font-size: 1.3rem !important;
    }
}

/* ==========================================================================
   Floating Actions (Mobile/Tablet): تواصل معنا + سجل موهبتك في نفس السطر
   ========================================================================== */

/* زر سجل موهبتك مخفي افتراضياً (Desktop) */
.floating-register-btn {
    display: none;
}

/* على الجوال والآيباد: حاوية عائمة في الركن (سطر واحد) */
@media (max-width: 991px) {
    .floating-actions {
        position: fixed;
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        height: 56px;
        z-index: 1000;
        /* نخلي الحاوية للتجميع فقط، والتموضع يكون لكل زر في ركنه */
        pointer-events: none;
    }

    /* إلغاء تموضع الزر الأساسي على الموبايل/التابلت (كان fixed في style.css) */
    .floating-contact-btn {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: auto !important;
        margin: 0 !important;
        pointer-events: auto;
    }

    /* إظهار زر سجل موهبتك */
    .floating-register-btn {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 0.75rem 1rem;
        border-radius: 50px;
        font-weight: 700;
        font-family: 'Cairo', sans-serif;
        cursor: pointer;
        border: none;
        white-space: nowrap;
        /* نفس تدرج الأحمر المستخدم في الموقع */
        background: linear-gradient(135deg, #8B0000 0%, #DC143C 50%, #FF6347 100%);
        color: #ffffff;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
        transition: transform 0.25s ease, box-shadow 0.25s ease;
        position: absolute;
        bottom: 0;
        right: 0;
        left: auto;
        pointer-events: auto;
    }

    .floating-register-btn:hover {
        transform: translateY(-3px);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    }

    .floating-register-btn i {
        font-size: 1.1rem;
    }
}

/* ==========================================================================
   Project Modal (Mobile + Tablet <= 991px)
   - البوستر خلفية كاملة للمودل
   - نفس توزيع المودل (بوستر/تفاصيل) لكن البوستر يصبح خلفية
   - ضغط الخطوط والمسافات لعرض كل البيانات بدون سكرول قدر الإمكان
   ========================================================================== */
@media (max-width: 991px) {
    .project-modal.active {
        padding: 5px !important;
        align-items: flex-start !important;
    }

    .project-modal-content {
        width: 95% !important;
        /* Slightly narrower for breathing room */
        max-width: 640px !important;
        margin: 10px auto !important;
        height: auto !important;
        /* Allow it to scale with content */
        min-height: 90vh !important;
        border-radius: 20px !important;
        /* Rounded corners for card look */
        overflow-x: hidden !important;
        overflow-y: auto !important;
        /* ENABLE SCROLL */
        /* الخلفية تأتي من JS (project.poster) */
        background-size: cover !important;
        background-position: center !important;
        background-repeat: no-repeat !important;
    }

    /* طبقة تعتيم خفيفة لتحسين قراءة النص فوق البوستر */
    .project-modal-content::before {
        content: "";
        position: absolute;
        inset: 0;
        /* أخف حتى يظهر البوستر أكثر + تقليل "السواد الكبير" */
        background:
            radial-gradient(circle at 50% 35%, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.18) 55%, rgba(0, 0, 0, 0.12) 100%),
            linear-gradient(to bottom, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.50));
        z-index: 0;
        pointer-events: none;
    }

    .project-modal-body {
        position: relative;
        z-index: 1;
        /* لا نجبره على 100vh حتى لا يترك فراغ أسود كبير */
        min-height: auto !important;
        padding: 70px 12px 20px !important;
        /* مساحة لزر الإغلاق + padding أسفل */
        gap: 10px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
    }

    .project-modal-poster {
        flex: 0 0 auto !important;
        width: 100% !important;
        height: auto !important;
        /* Allow height to be determined by image */
        max-height: none !important;
        position: relative !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        /* Show poster at the top, details below */
        order: 1;
    }

    /* Restore Poster Image & Overlay Text */
    .project-poster-img {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        max-height: 500px !important;
        /* Slightly more height for vertical posters */
        border-radius: 12px !important;
        object-fit: contain !important;
        /* Show full image, no cutting */
        margin-bottom: 0 !important;
    }

    #projectPosterPlaceholder {
        width: 100% !important;
        height: 250px !important;
        border-radius: 12px !important;
        margin-bottom: 0 !important;
        display: flex;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        background: linear-gradient(135deg, rgba(201, 169, 97, 0.2) 0%, rgba(133, 117, 78, 0.3) 100%) !important;
        border: 1px solid rgba(201, 169, 97, 0.4) !important;
    }

    #projectPosterPlaceholder .project-no-poster-title {
        color: #ffffff !important;
        font-size: 1.2rem !important;
        text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5) !important;
        padding: 20px !important;
    }

    .project-genres {
        position: absolute !important;
        top: 15px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: auto !important;
        max-width: 90% !important;

        /* Container with opacity (Not White) as requested */
        background: rgba(0, 0, 0, 0.6) !important;
        padding: 5px 15px !important;
        border-radius: 20px !important;
        backdrop-filter: blur(4px);

        display: flex !important;
        justify-content: center !important;
        gap: 6px !important;
        margin: 0 !important;
        z-index: 10 !important;
    }

    .genre-chip {
        font-size: 11px !important;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
    }

    /* كرت التفاصيل بنفس توزيع الديسكتوب ولكن مضغوط */
    .project-modal-details {
        width: 100% !important;
        max-width: 640px;
        margin: 0 auto;
        /* شفاف ليظهر البوستر قليلاً */
        background: rgba(0, 0, 0, 0.32) !important;
        border: 1px solid rgba(201, 169, 97, 0.35);
        border-radius: 14px;
        padding: 12px 12px 10px !important;
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        display: flex;
        flex-direction: column;
        gap: 8px;
        order: 2;
    }

    .project-modal-title {
        font-size: 1.15rem !important;
        margin: 0 0 2px 0 !important;
        line-height: 1.25 !important;
        text-align: center;
    }

    .project-modal-description {
        font-size: 0.80rem !important;
        line-height: 1.25 !important;
        margin: 0 0 6px 0 !important;
        text-align: center;
        color: rgba(255, 255, 255, 0.92) !important;
    }

    .project-info-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .project-info-item {
        padding: 8px 10px !important;
        gap: 4px !important;
        border-radius: 10px !important;
    }

    .info-label {
        font-size: 11px !important;
        letter-spacing: 0 !important;
        text-transform: none !important;
    }

    .info-value {
        font-size: 12px !important;
        font-weight: 600 !important;
    }

    /* صف الميتا: يظل في سطر واحد لكن مضغوط */
    .project-info-row-meta {
        gap: 8px !important;
    }

    .project-info-item-actors {
        gap: 8px !important;
    }

    .project-info-item-actors .info-label {
        min-width: 62px !important;
    }

    .project-actors {
        gap: 4px !important;
    }

    .actor-chip {
        font-size: 11px !important;
        padding: 3px 8px !important;
        white-space: normal !important;
    }

    /* زر إغلاق المشروع: ثابت يسار بدون أزرق */
    .project-modal-close {
        top: 20px !important;
        right: 20px !important;
        /* Standard position, will flip if needed */
        left: auto !important;
        outline: none !important;
        box-shadow: none !important;
    }

    .project-modal-close:focus,
    .project-modal-close:focus-visible,
    .project-modal-close:active {
        outline: none !important;
        box-shadow: none !important;
    }
}

/* ==========================================================================
   Featured Works (Mobile + Tablet <= 991px): عرض 5 أعمال دائمًا
   - تصغير الكروت + جعلها طولية + عنوان واضح بدون hover
   ========================================================================== */
@media (max-width: 991px) {
    #featured-works .content-container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .featured-works-wrapper {
        padding: 16px 0 !important;
    }

    .featured-works-slider .slide {
        padding: 0 4px !important;
        outline: none;
    }

    .featured-works-slider .slick-list {
        margin: 0 -4px !important;
        padding: 10px 0 !important;
    }

    .featured-work-wrapper {
        border-radius: 12px !important;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35) !important;
    }

    /* كرت طولي */
    .featured-work-wrapper img,
    .featured-work-img {
        height: auto !important;
        aspect-ratio: 2 / 3;
        max-height: 220px;
        object-fit: cover;
    }

    /* إخفاء تايتل العمل على الجوال/التابلت */
    .featured-work-overlay {
        display: none !important;
    }

    /* تقليل hover transform على الشاشات الصغيرة */
    .featured-work-wrapper:hover {
        transform: none !important;
    }
}

/* على الجوال الصغير جداً: تصغير زر سجل موهبتك قليلاً */
@media (max-width: 479px) {
    .floating-register-btn {
        padding: 0.7rem 0.9rem;
        gap: 8px;
        font-size: 0.9rem;
    }
}

/* Typography - Mobile */
@media (max-width: 767px) {
    .page-title {
        font-size: 1.75rem !important;
        margin-bottom: 1rem;
    }

    .clients-subtitle,
    .page-subtitle,
    .section-subtitle {
        font-size: 1rem !important;
        margin-bottom: 1.5rem;
    }

    h1 {
        font-size: 1.75rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }

    h3 {
        font-size: 1.25rem !important;
    }
}

/* ==========================================================================
   3. SMALL MOBILE (< 480px) - الهواتف الأصغر
   ========================================================================== */

@media (max-width: 479px) {

    /* تصغير إضافي للهواتف الصغيرة جداً */
    .menu-container {
        padding: 0 0.75rem;
    }

    .hero-container {
        padding: 0 0.75rem;
    }

    .hero-main-title {
        font-size: 1.8rem;
    }

    .hero-main-subtitle {
        font-size: 1.08rem;
    }

    .service-modal-body {
        padding: 0.75rem !important;
    }

    .service-card-slider {
        padding: 0.75rem !important;
        min-height: 350px !important;
        max-height: 350px !important;
    }

    .service-card-body {
        max-height: 270px !important;
    }

    .tab-btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8rem !important;
    }

    .step-circle {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.85rem !important;
    }

    .modal-service-categories {
        grid-template-columns: 1fr !important;
    }

    .page-title {
        font-size: 1.5rem !important;
    }

    h1 {
        font-size: 1.5rem !important;
    }

    h2 {
        font-size: 1.35rem !important;
    }

    h3 {
        font-size: 1.15rem !important;
    }
}

/* ==========================================================================
   4. TABLET (768px - 991px)
   ========================================================================== */

@media (min-width: 768px) and (max-width: 991px) {

    /* Menu Bar - Tablet */
    .menu-container {
        flex-direction: row;
        justify-content: space-between;
    }

    .logo {
        max-width: 160px;
    }

    .menu-list {
        display: flex;
        flex-direction: row;
        width: auto;
        gap: 0.75rem;
    }

    .menu-toggle {
        display: none;
    }

    .header-actions {
        flex-direction: row;
        width: auto;
    }

    .cta-buttons-container {
        flex-direction: row;
        width: auto;
    }

    .header-btn {
        width: auto;
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }

    /* Hero Section - Tablet */
    .hero-container {
        flex-direction: row;
        gap: 2rem;
    }

    .hero-text-layer {
        width: 50%;
        text-align: right;
    }

    .hero-slider-cards {
        width: 50%;
    }

    .hero-main-title {
        font-size: 2.7rem;
    }

    .hero-main-subtitle {
        font-size: 1.38rem;
    }

    .hero-cta-buttons {
        flex-direction: row;
        justify-content: flex-start;
    }

    .hero-btn {
        width: auto;
    }

    /* Services Grid - Tablet */
    .services-grid-3col {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem;
    }

    /* Modals - Tablet */
    .service-modal-content,
    .project-modal-content,
    .ad-modal-content {
        width: 90% !important;
        max-width: 700px !important;
        max-height: 90vh !important;
        min-height: auto !important;
        border-radius: 12px !important;
    }

    .project-modal-body,
    .ad-modal-body-content {
        flex-direction: row !important;
    }

    .project-modal-poster,
    .ad-modal-poster {
        width: 40% !important;
    }

    .project-modal-details,
    .ad-modal-details {
        width: 60% !important;
    }

    .form-row {
        flex-direction: row !important;
    }

    .form-group {
        flex: 1;
    }

    .submit-btn {
        width: auto !important;
        min-width: 200px;
    }
}

/* ==========================================================================
   HERO FIX (Mobile + Tablet <= 991px): منع تداخل النص مع السلايدر
   - style.css يضع .hero-text-layer absolute وبارتفاعات ثابتة
   - هنا نحولها إلى تخطيط عمودي وارتفاعات auto بدون تغيير الألوان
   ========================================================================== */
@media (max-width: 991px) {
    .page-section#home {
        height: auto !important;
        min-height: auto !important;
        align-items: flex-start !important;
    }

    .hero-container {
        height: auto !important;
        min-height: auto !important;
        padding-top: 90px !important;
        /* مساحة للهيدر */
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .hero-text-layer {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
        width: 100% !important;
        height: auto !important;
        min-height: auto !important;
        padding: 24px 16px 12px !important;
        overflow: visible !important;
        text-align: center !important;
        z-index: 5;
    }

    .hero-cta-buttons {
        justify-content: center !important;
        flex-wrap: wrap;
    }

    .hero-slider-cards {
        position: relative !important;
        width: 100% !important;
        height: clamp(320px, 45vh, 460px) !important;
        min-height: 320px !important;
        margin-top: 10px;
        z-index: 4;
    }

    /* ===== تحسين كرت السلايدر (Hero Ads Slider) للجوال/التابلت ===== */
    .hero-slider-cards {
        padding-right: 0 !important;
        padding-inline: 12px !important;
    }

    .slider-cards-container {
        height: 100% !important;
    }

    /* كرت واحد متمركز وواضح */
    .project-card {
        width: min(78vw, 360px) !important;
        height: 100% !important;
        top: 50% !important;
        border-radius: 18px !important;
        transform: translateY(-50%) !important;
    }

    .project-card.active {
        left: 50% !important;
        transform: translate(-50%, -50%) scale(1) !important;
        opacity: 1 !important;
        z-index: 3 !important;
    }

    /* لمحة خفيفة من الكروت المجاورة بدون تداخل */
    .project-card.prev {
        left: 50% !important;
        transform: translate(calc(-50% - 46vw), -50%) scale(0.9) !important;
        opacity: 0.18 !important;
        z-index: 1 !important;
        pointer-events: none;
    }

    .project-card.next {
        left: 50% !important;
        transform: translate(calc(-50% + 46vw), -50%) scale(0.9) !important;
        opacity: 0.18 !important;
        z-index: 1 !important;
        pointer-events: none;
    }

    /* إخفاء البقية على الشاشات الصغيرة */
    .project-card.next2,
    .project-card.next3 {
        opacity: 0 !important;
        pointer-events: none !important;
    }

    /* Overlay نصوص أنعم ومقروءة بدون أخذ مساحة كبيرة */
    .card-overlay {
        padding: 18px 16px !important;
    }

    .card-title {
        font-size: 1.1rem !important;
        margin-bottom: 8px !important;
    }

    .card-description {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        overflow: hidden;
    }

    .card-cta {
        margin-top: 10px !important;
        padding: 9px 18px !important;
        font-size: 0.85rem !important;
    }

    /* Nav + Dots: مكان مناسب داخل الكرت/أسفل السلايدر */
    .hero-slider-cards .slider-nav {
        bottom: 18px !important;
        width: 44px !important;
        height: 44px !important;
        z-index: 160 !important;
    }

    .hero-slider-cards .slider-nav.prev-btn {
        left: 16px !important;
        right: auto !important;
    }

    .hero-slider-cards .slider-nav.next-btn {
        right: 16px !important;
        left: auto !important;
    }

    .hero-slider-cards .slider-nav svg {
        width: 22px !important;
        height: 22px !important;
    }

    .hero-slider-cards .slider-indicators {
        bottom: 20px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        gap: 8px !important;
        z-index: 155 !important;
    }

    .indicator-dot {
        width: 10px !important;
        height: 10px !important;
    }
}

/* ==========================================================================
   Ad Modal (Mobile + Tablet <= 991px)
   FIX: الصورة تأتي من JS كـ backgroundImage للمودال
   ========================================================================== */
@media (max-width: 991px) {
    .ad-modal-content {
        aspect-ratio: auto !important;
        background-size: cover !important;
        background-position: center !important;
        background-repeat: no-repeat !important;
    }

    .ad-modal-body {
        padding: 60px 16px 16px !important;
        min-height: 100vh !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }

    .ad-modal-body-content {
        flex: 0 1 auto !important;
        flex-direction: column !important;
    }

    /* إخفاء البوستر المنفصل لأن الصورة background */
    .ad-modal-poster {
        display: none !important;
    }

    .ad-modal-details {
        width: 100% !important;
        padding: 20px !important;
        background: rgba(0, 0, 0, 0.85) !important;
        border-radius: 12px !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        max-width: 680px;
        margin: 0 auto;
    }

    .ad-modal-title {
        font-size: 1.4rem !important;
        margin-bottom: 12px !important;
        color: #ffffff !important;
    }

    .ad-modal-description-container {
        padding: 16px !important;
        margin-bottom: 14px !important;
        /* Switch from white to black opacity */
        background: rgba(0, 0, 0, 0.6) !important;
        border-radius: 8px !important;
    }

    .ad-modal-description {
        font-size: 0.95rem !important;
        line-height: 1.7 !important;
        color: rgba(255, 255, 255, 0.95) !important;
    }

    /* زر الإجراء sticky أسفل */
    .ad-modal-actions {
        position: sticky !important;
        bottom: 0 !important;
        padding: 14px !important;
        margin-top: 12px !important;
        background: transparent !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        border-top: none !important;
        z-index: 300 !important;
    }

    .ad-action-button {
        width: 100% !important;
        justify-content: center !important;
        padding: 14px 24px !important;
        font-size: 1rem !important;
        min-height: 52px !important;
    }

    /* زر الإغلاق: بعيد عن التايتل */
    .ad-modal-close {
        width: 42px !important;
        height: 42px !important;
        font-size: 1.4rem !important;
        top: 12px !important;
        background: rgba(0, 0, 0, 0.8) !important;
        border: 2px solid var(--accent-primary) !important;
        z-index: 1001 !important;
    }

    [dir="rtl"] .ad-modal-close {
        right: 12px !important;
        left: auto !important;
    }

    [dir="ltr"] .ad-modal-close {
        left: 12px !important;
        right: auto !important;
    }

    /* إعطاء padding أعلى للـ body بحيث التايتل ما يتداخل مع زر الإغلاق */
    .ad-modal-body {
        padding: 70px 16px 16px !important;
    }

    /* منع أي لون أزرق (focus ring) */
    .ad-modal-close:focus,
    .ad-modal-close:focus-visible {
        outline: none !important;
        box-shadow: none !important;
    }
}

/* ==========================================================================
   Ad Modal Close Button - Unified position across ALL sizes
   - نفس الركن في كل المقاسات
   - دائمًا يسار (حتى مع RTL)
   - منع أي outline أزرق دائماً
   ========================================================================== */
.ad-modal-close {
    top: 12px !important;
    left: 12px !important;
    right: auto !important;
}

.ad-modal-close:focus,
.ad-modal-close:focus-visible,
.ad-modal-close:active {
    outline: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   5. DESKTOP (992px+)
   ========================================================================== */

@media (min-width: 992px) {

    /* Services Grid - Desktop */
    .services-grid-3col {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 2rem;
    }

    /* Modals - Desktop */
    .service-modal-content {
        max-width: 900px !important;
    }

    .project-modal-content,
    .ad-modal-content {
        max-width: 1000px !important;
    }

    #serviceRequestModal .service-modal-content {
        max-width: 650px !important;
    }

    #contactModal .service-modal-content {
        max-width: 700px !important;
    }

    .hero-main-title {
        font-size: 3.6rem;
    }

    .hero-main-subtitle {
        font-size: 1.56rem;
    }
}

/* ==========================================================================
   6. COLOR CONSISTENCY - ضمان توحيد الألوان
   ========================================================================== */

/* التأكد من استخدام نفس الألوان في جميع الأحجام */
.service-modal,
.project-modal,
.ad-modal,
#serviceRequestModal,
#contactModal {
    background: rgba(0, 0, 0, 0.85) !important;
}

/* ملاحظة: ad-modal-content و project-modal-content يستخدمان backgroundImage ديناميكي من JS في بعض الحالات */
.service-modal-content {
    background: linear-gradient(135deg, rgba(30, 30, 35, 0.98) 0%, rgba(20, 20, 25, 0.98) 100%) !important;
    border: 2px solid rgba(201, 169, 97, 0.3) !important;
}

/* Project Modal: نحافظ على الخلفية الافتراضية في الديسكتوب فقط، وعلى الموبايل/التابلت نسمح بخلفية البوستر */
@media (min-width: 992px) {
    .project-modal-content {
        background: linear-gradient(135deg, rgba(30, 30, 35, 0.98) 0%, rgba(20, 20, 25, 0.98) 100%) !important;
        border: 2px solid rgba(201, 169, 97, 0.3) !important;
    }
}

/* Ad Modal: فقط border بدون background override */
.ad-modal-content {
    border: 2px solid rgba(201, 169, 97, 0.3) !important;
}

.service-modal-header,
.project-modal-header {
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.95), rgba(42, 42, 42, 0.9)) !important;
    border-bottom: 2px solid rgba(201, 169, 97, 0.2) !important;
}

/* Buttons - توحيد ألوان الأزرار */
.hero-btn.primary,
.modal-btn-primary,
.submit-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)) !important;
    color: var(--bg-primary) !important;
}

.hero-btn.primary:hover,
.modal-btn-primary:hover,
.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(201, 169, 97, 0.4);
}

/* ==========================================================================
   7. PREVENT LAYOUT SHIFTS - منع تغييرات التخطيط المفاجئة
   ========================================================================== */

* {
    transition: none !important;
    -webkit-transition: none !important;
    -moz-transition: none !important;
    -o-transition: none !important;
}

/* إعادة تفعيل transitions المطلوبة فقط */
.menu-link,
.header-btn,
.hero-btn,
.modal-btn,
.service-category-card,
.tab-btn,
.project-card,
.slider-cards-container,
.card-overlay,
.card-image,
.slider-nav,
.indicator-dot {
    transition: all 0.3s ease !important;
}

/* ==========================================================================
   8. ACCESSIBILITY FIXES
   ========================================================================== */

@media (max-width: 767px) {

    /* Touch targets - الحد الأدنى 44x44px */
    button,
    a,
    .menu-link,
    .header-btn,
    .tab-btn {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Font size minimum 16px لمنع الزوم على iOS */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ==========================================================================
   9. FINAL OVERRIDES - تجاوزات نهائية
   ========================================================================== */

/* إزالة أي !important من الملفات القديمة قد تسبب مشاكل */
@media (max-width: 767px) {
    .service-modal.active {
        padding: 0 !important;
    }

    /* Unified modal widths */
    .service-modal-content,
    .project-modal-content,
    .ad-modal-content,
    .service-request-modal-content {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }
}

/* ==========================================================================
   10. PRINT STYLES
   ========================================================================== */

@media print {

    .menu-bar,
    .floating-contact-btn,
    .service-request-btn-floating,
    .menu-toggle {
        display: none !important;
    }

    .service-modal-content,
    .project-modal-content {
        max-width: 100% !important;
        border: none !important;
        box-shadow: none !important;
    }
}

/* ==========================================================================
   10. PROJECTS PAGE MOBILE FIXES
   ========================================================================== */
@media (max-width: 767px) {

    /* Prevent horizontal movement / overflow */
    .home-page,
    .main,
    body {
        overflow-x: hidden !important;
        width: 100% !important;
        position: relative !important;
    }

    #projects-hero .hero-bg-image {
        background-attachment: scroll !important;
        /* Fixed background causes jitter/movement on mobile */
        transform: none !important;
        /* Disable parallax scale on mobile if any */
    }

    .projects-carousel-wrapper {
        overflow: hidden !important;
        width: 100% !important;
    }
}