/* ============================================
   Modern Mobile Menu Design - El Shorbagy
   ============================================ */

/* Mobile Header Toggle Wrapper - sits inside header .row */
.mobile-header-toggle-wrapper {
    display: none;
    /* Hidden on desktop */
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 99999;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e62b2b 0%, #c41a1f 100%);
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(230, 43, 43, 0.3);
}

.mobile-menu-toggle:hover {
    background: linear-gradient(135deg, #c72525 0%, #a11818 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(230, 43, 43, 0.4);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

/* Hamburger Icon */
.mobile-menu-toggle .hamburger {
    position: relative;
    width: 24px;
    height: 18px;
    margin: 0 auto;
}

.mobile-menu-toggle .hamburger span {
    display: block;
    position: absolute;
    height: 3px;
    width: 100%;
    background: #ffffff;
    border-radius: 3px;
    opacity: 1;
    left: 0;
    transition: all 0.3s ease;
}

.mobile-menu-toggle .hamburger span:nth-child(1) {
    top: 0;
}

.mobile-menu-toggle .hamburger span:nth-child(2) {
    top: 7.5px;
}

.mobile-menu-toggle .hamburger span:nth-child(3) {
    top: 15px;
}

/* Hamburger Animation when menu is open */
.mobile-menu-toggle.active .hamburger span:nth-child(1) {
    top: 7.5px;
    transform: rotate(135deg);
}

.mobile-menu-toggle.active .hamburger span:nth-child(2) {
    opacity: 0;
    left: -60px;
}

.mobile-menu-toggle.active .hamburger span:nth-child(3) {
    top: 7.5px;
    transform: rotate(-135deg);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modern Mobile Menu Container */
.mobile-menu-modern {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    max-width: 85%;
    height: 100vh;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    z-index: 999999;
    overflow-y: auto;
    overflow-x: hidden;
    transition: right 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
}

.mobile-menu-modern.active {
    right: 0;
}

/* Menu Header */
.mobile-menu-modern .menu-header {
    padding: 25px 20px;
    background: linear-gradient(135deg, #e62b2b 0%, #c72525 100%);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-modern .menu-header .logo {
    max-width: 120px;
    height: auto;
    filter: brightness(0) invert(1);
}

/* Menu Items */
.mobile-menu-modern .menu-items {
    padding: 20px 0;
}

.mobile-menu-modern .menu-items li {
    list-style: none;
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.3s ease;
}

.mobile-menu-modern.active .menu-items li {
    opacity: 1;
    transform: translateX(0);
}

/* Stagger animation for menu items */
.mobile-menu-modern.active .menu-items li:nth-child(1) {
    transition-delay: 0.1s;
}

.mobile-menu-modern.active .menu-items li:nth-child(2) {
    transition-delay: 0.15s;
}

.mobile-menu-modern.active .menu-items li:nth-child(3) {
    transition-delay: 0.2s;
}

.mobile-menu-modern.active .menu-items li:nth-child(4) {
    transition-delay: 0.25s;
}

.mobile-menu-modern.active .menu-items li:nth-child(5) {
    transition-delay: 0.3s;
}

.mobile-menu-modern .menu-items li a {
    display: flex;
    align-items: center;
    padding: 18px 25px;
    color: #ffffff;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    transition: all 0.3s ease;
}

.mobile-menu-modern .menu-items li a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: #e62b2b;
    transition: height 0.3s ease;
}

.mobile-menu-modern .menu-items li a:hover::before,
.mobile-menu-modern .menu-items li.active a::before {
    height: 70%;
}

.mobile-menu-modern .menu-items li a:hover {
    background: rgba(230, 43, 43, 0.1);
    padding-left: 35px;
}

.mobile-menu-modern .menu-items li.active a {
    background: rgba(230, 43, 43, 0.15);
    color: #e62b2b;
}

/* Menu Icon for each item */
.mobile-menu-modern .menu-items li a .menu-icon {
    margin-right: 15px;
    font-size: 18px;
    width: 24px;
    text-align: center;
    color: #e62b2b;
}

/* Menu Footer */
.mobile-menu-modern .menu-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-modern .menu-footer .contact-info {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    margin-bottom: 15px;
}

.mobile-menu-modern .menu-footer .contact-info a {
    color: #e62b2b;
    text-decoration: none;
    font-weight: 600;
}

.mobile-menu-modern .menu-footer .social-links {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.mobile-menu-modern .menu-footer .social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(230, 43, 43, 0.2);
    border-radius: 50%;
    color: #ffffff;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 16px;
}

.mobile-menu-modern .menu-footer .social-links a:hover {
    background: #e62b2b;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(230, 43, 43, 0.3);
}

/* Scrollbar Styling */
.mobile-menu-modern::-webkit-scrollbar {
    width: 6px;
}

.mobile-menu-modern::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.mobile-menu-modern::-webkit-scrollbar-thumb {
    background: rgba(230, 43, 43, 0.5);
    border-radius: 3px;
}

.mobile-menu-modern::-webkit-scrollbar-thumb:hover {
    background: #e62b2b;
}

/* Show mobile menu elements only on tablets and mobile */
@media only screen and (max-width: 991px) {

    /* Show the wrapper containing the toggle button */
    .mobile-header-toggle-wrapper {
        display: block;
    }

    .mobile-menu-overlay,
    .mobile-menu-modern {
        display: block;
    }

    /* Hide the old navbar toggle */
    .navbar-toggle,
    .navbar-header .navbar-toggle {
        display: none !important;
    }

    /* Hide the entire navbar collapse on mobile since we have the modern menu */
    .main-menu .navbar-collapse {
        display: none !important;
    }

    /* Make header row a flex container for perfect alignment */
    .header-area.style-2 .row {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        height: 100%;
        margin: 0 !important;
    }

    /* Ensure logo column takes strict space */
    .header-area.style-2 .col-lg-3,
    .header-area.style-2 .col-md-3,
    .header-area.style-2 .col-sm-12,
    .header-area.style-2 .col-xs-12 {
        width: auto !important;
        flex: 0 1 auto !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: 80%;
        /* Prevent logo from pushing toggle out */
    }

    /* Hide nav column completely */
    .header-area.style-2 .col-lg-9,
    .header-area.style-2 .col-md-9 {
        display: none !important;
    }

    /* Reset wrapper position to flow naturally in flex container */
    .mobile-header-toggle-wrapper {
        display: flex !important;
        align-items: center !important;
        position: absolute !important;
        right: 20px !important;
        top: 0 !important;
        bottom: 0 !important;
        margin: auto 0 !important;
        height: 60px !important;
        /* Sufficient height to catch events but centered */
        z-index: 1000;
        pointer-events: none;
        /* Let clicks pass closely around */
    }

    .mobile-header-toggle-wrapper>* {
        pointer-events: auto;
        /* Re-enable clicks on button */
    }

    .navbar-toggle {
        display: none !important;
    }

    /* Prevent body scroll when menu is open */
    body.mobile-menu-open {
        overflow: hidden;
    }

    /* Animation for menu opening */
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Adjust toggle for mobile screens - position relative to header */
    @media only screen and (max-width: 767px) {
        .mobile-menu-toggle {
            position: relative;
            /* Flexbox centering handles alignment */
            width: 38px;
            height: 38px;
            margin: 0 !important;
            /* Ensure no external margins break centering */
            background: linear-gradient(135deg, #e62b2b 0%, #c41a1f 100%);
            border-radius: 10px;
            box-shadow: 0 4px 12px rgba(230, 43, 43, 0.3);
        }

        .mobile-menu-toggle .hamburger {
            width: 18px;
            height: 13px;
            margin: 0 auto;
            position: relative;
        }

        .mobile-menu-toggle .hamburger span {
            height: 2px;
            background: #fff;
        }

        .mobile-menu-toggle .hamburger span:nth-child(1) {
            top: 0;
        }

        .mobile-menu-toggle .hamburger span:nth-child(2) {
            top: 5.5px;
        }

        .mobile-menu-toggle .hamburger span:nth-child(3) {
            top: 11px;
        }

        .mobile-menu-toggle.active .hamburger span:nth-child(1) {
            top: 5.5px;
            transform: rotate(135deg);
        }

        .mobile-menu-toggle.active .hamburger span:nth-child(2) {
            opacity: 0;
        }

        .mobile-menu-toggle.active .hamburger span:nth-child(3) {
            top: 5.5px;
            transform: rotate(-135deg);
        }
    }

    @media only screen and (max-width: 479px) {
        .mobile-menu-toggle {
            top: 22px !important;
            right: 7% !important;
            width: 36px;
            height: 36px;
        }

        .mobile-menu-toggle .hamburger {
            width: 16px;
            height: 12px;
        }

        .mobile-menu-toggle .hamburger span:nth-child(2) {
            top: 5px;
        }

        .mobile-menu-toggle .hamburger span:nth-child(3) {
            top: 10px;
        }
    }
}

/* Standardization for Inner Pages - Visibility Toggles Only */
@media only screen and (min-width: 992px) {
    .mobile-only-header {
        display: none !important;
    }
}

@media only screen and (max-width: 991px) {
    .desktop-only-header {
        display: none !important;
    }

    .mobile-only-header {
        display: block !important;
        /* Note: Appearance is handled by header-enhanced.css loaded via media query */
    }
}