/* ============================================================
   Merbouhi - Mobile Menu (drawer style)
   Hijacks the theme's existing .navbar-toggler button on phone/tablet
   to open a clean slide-in drawer instead of the Bootstrap collapse.
   ============================================================ */

@media (max-width: 991.98px) {

    /* ---- Hide the theme's collapsed menu, but KEEP the toggler button ---- */
    /* The theme's hamburger stays visible (same look/position) but its       */
    /* click now opens our drawer (see mobile-menu.js).                       */
    .navbar .navbar-collapse#navbarNav,
    .navbar-toggler-clone,
    .navbar-collapse-clone,
    .navbar-modern-inner,
    .navbar-full-screen-menu-inner,
    .navbar-show-modern-bg { display: none !important; }

    /* ---- Backdrop ---- */
    .mm-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9996;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.28s ease;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
    body.mm-open .mm-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    /* ---- Drawer ---- */
    .mm-drawer {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        height: 100dvh;
        width: 86%;
        max-width: 360px;
        background: #ffffff;
        z-index: 9997;
        transform: translateX(100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        flex-direction: column;
        box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
        overflow: hidden;
    }
    html[dir="rtl"] .mm-drawer {
        right: auto;
        left: 0;
        transform: translateX(-100%);
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.12);
    }
    body.mm-open .mm-drawer { transform: translateX(0); }

    /* ---- Drawer header (logo + close X) ---- */
    .mm-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 18px 20px;
        border-bottom: 1px solid #f0f0f0;
        flex-shrink: 0;
    }
    .mm-header img {
        height: 32px;
        width: auto;
    }
    .mm-close {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        border: 1px solid rgba(0,0,0,0.08);
        background: #fafafa;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        padding: 0;
        transition: background 0.2s ease;
    }
    .mm-close:hover { background: #f0f0f0; }
    .mm-close svg {
        width: 18px;
        height: 18px;
        stroke: #1a1a1a;
    }

    /* ---- Drawer nav links ---- */
    .mm-nav {
        flex: 1;
        overflow-y: auto;
        padding: 14px 0;
        list-style: none;
        margin: 0;
    }
    .mm-nav li { list-style: none; }
    .mm-nav a {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 16px 24px;
        font-size: 17px;
        font-weight: 600;
        color: #1a1a1a;
        text-decoration: none;
        border-left: 3px solid transparent;
        transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    }
    html[dir="rtl"] .mm-nav a {
        border-left: none;
        border-right: 3px solid transparent;
    }
    .mm-nav a:hover,
    .mm-nav a:focus,
    .mm-nav a.mm-active {
        background: #e8f5ee;
        color: #1D9E75;
        border-color: #1D9E75;
    }
    .mm-nav a .mm-arrow {
        margin-left: auto;
        opacity: 0;
        transition: opacity 0.15s ease, transform 0.15s ease;
        color: #1D9E75;
    }
    html[dir="rtl"] .mm-nav a .mm-arrow {
        margin-left: 0;
        margin-right: auto;
        transform: scaleX(-1);
    }
    .mm-nav a:hover .mm-arrow,
    .mm-nav a.mm-active .mm-arrow { opacity: 1; }

    /* ---- Drawer footer (CTA + phone + lang) ---- */
    .mm-footer {
        padding: 18px 20px 24px;
        border-top: 1px solid #f0f0f0;
        flex-shrink: 0;
        background: #fafafa;
    }
    .mm-cta {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        padding: 15px 20px;
        background: #1D9E75;
        color: #ffffff;
        font-size: 16px;
        font-weight: 600;
        text-decoration: none;
        border-radius: 12px;
        border: none;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(29, 158, 117, 0.30);
        transition: background 0.2s ease, transform 0.1s ease;
    }
    .mm-cta:hover, .mm-cta:focus { background: #157a55; color: #ffffff; }
    .mm-cta:active { transform: scale(0.98); }

    .mm-phone {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-top: 14px;
        padding: 12px 16px;
        background: #ffffff;
        border: 1px solid #e5e5e5;
        border-radius: 12px;
        font-size: 14px;
        color: #1a1a1a;
        text-decoration: none;
        font-weight: 500;
    }
    .mm-phone svg { color: #1D9E75; }

    .mm-lang {
        display: flex;
        gap: 8px;
        margin-top: 14px;
    }
    .mm-lang a {
        flex: 1;
        text-align: center;
        padding: 10px 12px;
        font-size: 13px;
        font-weight: 600;
        color: #6b7280;
        text-decoration: none;
        background: #ffffff;
        border: 1px solid #e5e5e5;
        border-radius: 10px;
        transition: all 0.15s ease;
    }
    .mm-lang a.mm-active-lang {
        background: #1D9E75;
        color: #ffffff;
        border-color: #1D9E75;
    }

    /* ---- Lock body scroll when drawer is open ---- */
    body.mm-open {
        overflow: hidden;
        touch-action: none;
    }
}

/* Always hide on desktop */
@media (min-width: 992px) {
    .mm-backdrop,
    .mm-drawer { display: none !important; }
}
