/* ================================================
   Critical Mobile Fixes Override
   يضمن عدم وجود تعارضات من style.css القديم
   ================================================ */

/* Force Logo Size on Mobile */
@media screen and (max-width: 991px) {
    .header__logo,
    .header__logo img,
    .header__logo .custom-logo,
    .header__logo .custom-logo-link,
    .header__logo .custom-logo-link img,
    .header__logo-img {
        width: clamp(120px, 28vw, 180px) !important;
        max-width: clamp(120px, 28vw, 180px) !important;
        min-width: 120px !important;
    }
}

@media screen and (max-width: 480px) {
    .header__logo,
    .header__logo img,
    .header__logo .custom-logo,
    .header__logo .custom-logo-link,
    .header__logo .custom-logo-link img,
    .header__logo-img {
        width: clamp(110px, 26vw, 160px) !important;
        max-width: clamp(110px, 26vw, 160px) !important;
        min-width: 110px !important;
    }
}

@media screen and (max-width: 360px) {
    .header__logo,
    .header__logo img,
    .header__logo .custom-logo,
    .header__logo .custom-logo-link,
    .header__logo .custom-logo-link img,
    .header__logo-img {
        width: clamp(100px, 24vw, 140px) !important;
        max-width: clamp(100px, 24vw, 140px) !important;
        min-width: 100px !important;
    }
}

/* Force Burger Button Visibility */
@media screen and (max-width: 991px) {
    .header__burger {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        cursor: pointer !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        background: #006aff !important;
        border-radius: 50% !important;
        border: none !important;
        padding: 10px !important;
        gap: 4px !important;
        z-index: 100001 !important;
        position: relative !important;
    }
    
    .header__burger i {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        height: 3px !important;
        background: #ffffff !important;
        border-radius: 3px !important;
        transition: all 0.35s cubic-bezier(0.68, -0.55, 0.265, 1.55) !important;
    }
    
    .header__burger i:nth-child(1) {
        width: 100% !important;
    }
    
    .header__burger i:nth-child(2) {
        width: 85% !important;
        margin-left: auto !important;
    }
    
    .header__burger i:nth-child(3) {
        width: 100% !important;
    }
    
    .header__burger:hover i:nth-child(2) {
        width: 100% !important;
    }
    
    /* Active state */
    .header__burger.active {
        transform: rotate(90deg) !important;
    }
    
    .header__burger.active i:nth-child(1) {
        transform: rotate(45deg) translate(8px, 8px) !important;
        width: 100% !important;
    }
    
    .header__burger.active i:nth-child(2) {
        opacity: 0 !important;
        transform: scale(0) !important;
    }
    
    .header__burger.active i:nth-child(3) {
        transform: rotate(-45deg) translate(8px, -8px) !important;
        width: 100% !important;
    }
}

/* Force Mobile Menu Display */
@media screen and (max-width: 991px) {
    /* Keep header visible above menu when open */
    body:has(.header__navigation-wrapper.active) .header {
        z-index: 100002 !important;
    }
    
    .header__navigation-wrapper {
        display: none !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 100vh !important;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(249, 250, 251, 0.98)) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        z-index: 100000 !important;
        overflow-y: auto !important;
        padding: 90px 28px 40px !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    
    .header__navigation-wrapper.active {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }
    
    /* Dark mode mobile drawer */
    [data-theme="dark"] .header__navigation-wrapper {
        background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.98)) !important;
    }
    
    [data-theme="dark"] .header__navigation-wrapper.active {
        background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.98)) !important;
    }
    
    /* Force clickable menu items */
    .header__list-item,
    .header__list li,
    .header__list-item > a,
    .header__list li > a {
        pointer-events: auto !important;
        cursor: pointer !important;
        touch-action: manipulation !important;
    }
    
    /* Force clickable submenu parent items */
    .header__list .menu-item-has-children,
    .header__list .menu-item-has-children > a {
        pointer-events: auto !important;
        cursor: pointer !important;
        touch-action: manipulation !important;
    }
    
    /* Force hide desktop ::before indicator on mobile */
    .header__list .menu-item-has-children > a::before {
        display: none !important;
        content: none !important;
        opacity: 0 !important;
        width: 0 !important;
        height: 0 !important;
    }
    
    [data-theme="dark"] .header__list .menu-item-has-children > a::before {
        display: none !important;
        content: none !important;
        opacity: 0 !important;
        width: 0 !important;
        height: 0 !important;
    }
    
    /* Force submenu display on mobile */
    .header__list .sub-menu {
        position: static !important;
        display: block !important;
        width: 100% !important;
        max-height: 0 !important;
        overflow: hidden !important;
        opacity: 1 !important;
        visibility: visible !important;
        transition: max-height 0.4s ease !important;
        background: rgba(0, 106, 255, 0.08) !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Show submenu when parent has submenu-open class */
    .header__list .menu-item-has-children.submenu-open > .sub-menu {
        max-height: 1000px !important;
        padding: 8px !important;
        overflow: visible !important;
    }
    
    /* Force submenu items clickable */
    .header__list .sub-menu li {
        pointer-events: auto !important;
        cursor: pointer !important;
        display: block !important;
        margin: 0 !important;
        padding: 6px 0 !important;
    }
    
    .header__list .sub-menu li:first-child {
        padding-top: 0 !important;
    }
    
    .header__list .sub-menu li:last-child {
        padding-bottom: 0 !important;
    }
    
    .header__list .sub-menu li a {
        pointer-events: auto !important;
        cursor: pointer !important;
        display: block !important;
        margin: 0 !important;
        padding: 13px 18px !important;
        color: #334155 !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    /* Dark mode mobile menu items */
    [data-theme="dark"] .header__list-item > a,
    [data-theme="dark"] .header__list li > a {
        background: rgba(99, 102, 241, 0.08) !important;
        color: #e2e8f0 !important;
    }
    
    [data-theme="dark"] .header__list-item > a:hover,
    [data-theme="dark"] .header__list li > a:hover {
        background: rgba(99, 102, 241, 0.15) !important;
        color: #a5b4fc !important;
    }
    
    [data-theme="dark"] .header__list .sub-menu {
        background: rgba(99, 102, 241, 0.12) !important;
    }
    
    [data-theme="dark"] .header__list .sub-menu li a {
        background: rgba(30, 41, 59, 0.9) !important;
        color: #e2e8f0 !important;
    }
    
    [data-theme="dark"] .header__list .sub-menu li a:hover {
        background: rgba(99, 102, 241, 0.25) !important;
        color: #a5b4fc !important;
    }
}

/* Remove old styles that might conflict */
@media screen and (max-width: 991px) {
    .header__navigation-wrapper.open {
        /* This class is deprecated, use .active instead */
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
}

