/* =============================================================================
   MOBILE MENU — BOTTOM SHEET 2026
   -----------------------------------------------------------------------------
   Replaces the old left/right side drawer. The Bootstrap `.navbar-collapse`
   becomes a modal bottom sheet that rises from the bottom edge of the screen:

       ┌───────────────────────────┐
       │            ▬              │  grab handle (drag down to dismiss)
       │  [logo] Brand        (×)  │  sticky header
       │  ─ التنقل ─               │
       │  ◉ الصفحة الرئيسية     ›  │  scrollable link list
       │  ◉ من نحن              ›  │
       │  ─ إجراءات سريعة ─        │
       │  [بحث] [حسابي] [السلة]    │  sticky quick-action grid
       │  [  احجز طاولتك        ]  │
       └───────────────────────────┘

   Markup is injected at runtime by public/user/js/mobile-sheet-2026.js, which
   also owns the open/close state (it adds `.m-sheet` + toggles `.show`).
   Everything here is inside the ≤ 991.98px media query, so the desktop header
   is untouched.
   ============================================================================= */

/* The injected chrome must never leak into the wide-screen header. */
.m-sheet__top,
.m-sheet__label,
.m-sheet__ql { display: none; }

@media (max-width: 991.98px) {

    :root {
        --m-sheet-bg:         var(--theme-surface, #ffffff);
        --m-sheet-bg-soft:    var(--theme-surface-alt, #FBF7EE);
        --m-sheet-ink:        var(--theme-text, #2A1F17);
        --m-sheet-soft:       var(--theme-text-soft, #6E5F51);
        --m-sheet-muted:      var(--theme-text-muted, #9A8B7C);
        --m-sheet-line:       rgba(var(--theme-border-rgb, 232,222,208), .9);
        --m-sheet-brand:      var(--theme-brand, #B8541A);
        --m-sheet-brand-dark: var(--theme-brand-dark, #8B3F12);
        --m-sheet-brand-rgb:  var(--theme-brand-rgb, 184,84,26);
        --m-sheet-radius:     28px;
        --m-sheet-ease:       cubic-bezier(.22, 1, .36, 1);
        --m-sheet-safe:       env(safe-area-inset-bottom, 0px);
    }

    /* ─────────────────────────────────────────────────────────────────────
       0. Host fixes
       ─────────────────────────────────────────────────────────────────────
       `backdrop-filter` on the sticky navbar turns it into the containing
       block for every fixed-position descendant — which would pin the sheet
       to the bottom of the *header* instead of the viewport. Drop the glass
       on mobile (the bar is already 86% opaque) and neutralise any other
       containing-block trigger while the sheet is open. */
    .navbar.main_menu.header_overlay {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    body.m-nav-open .navbar.main_menu.header_overlay {
        filter: none !important;
        transform: none !important;
        perspective: none !important;
        will-change: auto !important;
    }
    body.m-nav-open { overflow: hidden; }

    /* The navbar has to outrank the scrim so the sheet inside it stays on top
       (see §1), which would otherwise leave the header as the one bright strip
       on a dimmed screen. Dim it with a matching overlay of its own — pointer
       transparent, so tapping the hamburger still closes the sheet. */
    body.m-nav-open .navbar.main_menu.header_overlay::after {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 5;
        pointer-events: none;
        background: rgba(var(--theme-dark-rgb, 24, 18, 13), .55);
        animation: mSheetFade .3s ease both;
    }
    /* …except the hamburger, which stays lit as a solid brand chip. */
    .navbar.main_menu .navbar-toggler[aria-expanded="true"] {
        position: relative;
        z-index: 6;
        background: var(--m-sheet-brand) !important;
        background: linear-gradient(135deg, var(--m-sheet-brand), color-mix(in srgb, var(--m-sheet-brand) 72%, #000)) !important;
        color: #fff !important;
    }

    /* ─────────────────────────────────────────────────────────────────────
       1. Scrim
       ───────────────────────────────────────────────────────────────────── */
    body.m-nav-open::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(var(--theme-dark-rgb, 24, 18, 13), .55);
        backdrop-filter: blur(4px) saturate(120%);
        -webkit-backdrop-filter: blur(4px) saturate(120%);
        z-index: 100000;
        animation: mSheetFade .3s ease both;
    }
    @keyframes mSheetFade { from { opacity: 0; } to { opacity: 1; } }

    /* ─────────────────────────────────────────────────────────────────────
       2. The sheet
       ───────────────────────────────────────────────────────────────────── */
    .navbar.main_menu .navbar-collapse.m-sheet {
        position: fixed !important;
        inset-inline: 0 !important;
        inset-block-start: auto !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        max-height: 88vh;
        max-height: min(88dvh, 780px);
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        flex-direction: column;
        /* Bootstrap's `.navbar-collapse` carries `align-items: center`, which in
           a column flex container shrink-wraps every row to its content width
           and floats it off-centre. The sheet's rows must fill it edge to edge. */
        align-items: stretch !important;
        justify-content: flex-start;
        background: var(--m-sheet-bg);
        border-radius: var(--m-sheet-radius) var(--m-sheet-radius) 0 0;
        box-shadow: 0 -24px 60px -18px rgba(var(--theme-dark-rgb, 24,18,13), .38),
                    0 -1px 0 rgba(var(--theme-border-rgb, 232,222,208), .6);
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        z-index: 100010;
        visibility: hidden;
        transform: translate3d(0, calc(100% + 48px), 0);
        transition: transform .46s var(--m-sheet-ease), visibility 0s linear .46s;
    }
    .navbar.main_menu .navbar-collapse.m-sheet.show {
        visibility: visible;
        transform: translate3d(0, var(--m-sheet-drag, 0px), 0);
        transition: transform .46s var(--m-sheet-ease), visibility 0s;
    }
    /* While the finger is on the handle the sheet follows it 1:1. */
    .navbar.main_menu .navbar-collapse.m-sheet.is-dragging { transition: none; }

    /* modern-2026.css paints the old drawer panel through `.main_menu #navbarNav`
       (an id, with !important) — only an id selector can take the surface back. */
    .main_menu #navbarNav.m-sheet {
        background: var(--m-sheet-bg) !important;
        box-shadow: 0 -24px 60px -18px rgba(var(--theme-dark-rgb, 24,18,13), .38),
                    0 -1px 0 rgba(var(--theme-border-rgb, 232,222,208), .6) !important;
    }

    /* ─────────────────────────────────────────────────────────────────────
       3. Sticky top — grab handle + brand header
       ───────────────────────────────────────────────────────────────────── */
    .m-sheet .m-sheet__top {
        display: block;
        position: sticky;
        top: 0;
        z-index: 3;
        flex: 0 0 auto;
        padding: 10px 18px 12px;
        background: var(--m-sheet-bg);
        border-bottom: 1px solid var(--m-sheet-line);
        border-radius: var(--m-sheet-radius) var(--m-sheet-radius) 0 0;
        touch-action: none;               /* the drag-to-dismiss surface */
    }
    .m-sheet .m-sheet__grab {
        display: block;
        width: 46px;
        height: 5px;
        margin: 0 auto 14px;
        border-radius: 999px;
        background: rgba(var(--theme-text-rgb, 42,31,23), .18);
        transition: background .2s ease, width .2s ease;
    }
    .m-sheet.is-dragging .m-sheet__grab {
        background: var(--m-sheet-brand);
        width: 64px;
    }

    .m-sheet .m-sheet__head {
        display: flex;
        align-items: center;
        gap: 12px;
    }
    .m-sheet .m-sheet__logo {
        width: 52px;
        height: 52px;
        flex: 0 0 52px;
        border-radius: 16px;
        object-fit: contain;
        padding: 6px;
        background: var(--m-sheet-bg-soft);
        border: 1px solid var(--m-sheet-line);
    }
    .m-sheet .m-sheet__mark {
        width: 52px;
        height: 52px;
        flex: 0 0 52px;
        border-radius: 16px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        color: #fff;
        background: var(--m-sheet-brand);
        background: linear-gradient(135deg, var(--m-sheet-brand), color-mix(in srgb, var(--m-sheet-brand) 72%, #000));
        box-shadow: 0 10px 20px -10px rgba(var(--m-sheet-brand-rgb), .8);
    }
    .m-sheet .m-sheet__titles {
        min-width: 0;
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    .m-sheet .m-sheet__name {
        font-size: 16px;
        font-weight: 800;
        line-height: 1.25;
        color: var(--m-sheet-ink);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .m-sheet .m-sheet__sub {
        font-size: 11.5px;
        font-weight: 600;
        color: var(--m-sheet-muted);
        letter-spacing: .02em;
    }
    .m-sheet .m-sheet__close {
        flex: 0 0 auto;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 15px;
        padding: 0;
        cursor: pointer;
        color: var(--m-sheet-soft);
        background: var(--m-sheet-bg-soft);
        border: 1px solid var(--m-sheet-line);
        transition: background .2s ease, color .2s ease, transform .2s ease;
    }
    .m-sheet .m-sheet__close:hover,
    .m-sheet .m-sheet__close:focus-visible {
        background: var(--m-sheet-brand);
        border-color: var(--m-sheet-brand);
        color: #fff;
        transform: rotate(90deg);
        outline: 0;
    }

    /* ─────────────────────────────────────────────────────────────────────
       4. Section captions
       ───────────────────────────────────────────────────────────────────── */
    .m-sheet .m-sheet__label {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 0;
        padding: 16px 20px 8px;
        font-size: 10.5px;
        font-weight: 800;
        letter-spacing: .14em;
        text-transform: uppercase;
        color: var(--m-sheet-muted);
    }
    /* The rule sits after the caption text, so it fades away from it — which
       way that is depends on the writing direction. */
    .m-sheet .m-sheet__label::after {
        content: "";
        flex: 1 1 auto;
        height: 1px;
        background: linear-gradient(to right, transparent, var(--m-sheet-line));
    }
    [dir="rtl"] .m-sheet .m-sheet__label::after {
        background: linear-gradient(to left, transparent, var(--m-sheet-line));
    }
    .m-sheet .m-sheet__label i {
        font-size: 11px;
        color: var(--m-sheet-brand);
    }

    /* ─────────────────────────────────────────────────────────────────────
       5. Navigation list
       ───────────────────────────────────────────────────────────────────── */
    .m-sheet .navbar-nav {
        display: flex !important;
        flex-direction: column;
        width: 100%;
        gap: 6px;
        margin: 0 !important;
        padding: 0 14px 6px !important;
        list-style: none;
        flex: 0 0 auto;
    }
    .m-sheet .navbar-nav .nav-item { margin: 0; width: 100%; }

    .main_menu .m-sheet .navbar-nav .nav-item .nav-link {
        display: flex !important;
        align-items: center;
        gap: 13px;
        width: 100%;
        margin: 0 !important;
        padding: 11px 12px !important;
        border-radius: 18px;
        border: 1px solid transparent;
        background: transparent;
        font-size: 15px !important;
        font-weight: 700 !important;
        line-height: 1.3;
        color: var(--m-sheet-ink) !important;
        text-align: start;
        text-decoration: none;
        transition: background .22s ease, border-color .22s ease,
                    color .22s ease, transform .18s ease;
    }
    .main_menu .m-sheet .navbar-nav .nav-item .nav-link .m-nav-ico {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        flex: 0 0 42px;
        width: 42px;
        height: 42px;
        border-radius: 14px;
        font-size: 15px;
        color: var(--m-sheet-brand);
        background: rgba(var(--m-sheet-brand-rgb), .10);
        transition: background .22s ease, color .22s ease, transform .22s ease;
    }
    /* Trailing chevron — flips with the writing direction. modern-2026.css
       kills this pseudo-element under 1000px to hide the legacy decorative
       blob it used to carry, so it has to be switched back on explicitly. */
    .main_menu .m-sheet .navbar-nav .nav-item .nav-link::after {
        display: inline-block !important;
        content: "\f054";
        font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", FontAwesome;
        font-weight: 900;
        margin-inline-start: auto;
        font-size: 11px;
        opacity: .3;
        transform: none;
        transition: opacity .2s ease, transform .2s ease;
        position: static;
        width: auto;
        height: auto;
        background: none;
        inset: auto;
    }
    [dir="rtl"] .main_menu .m-sheet .navbar-nav .nav-item .nav-link::after { content: "\f053"; }

    .main_menu .m-sheet .navbar-nav .nav-item .nav-link:hover,
    .main_menu .m-sheet .navbar-nav .nav-item .nav-link:focus-visible {
        background: var(--m-sheet-bg-soft);
        border-color: var(--m-sheet-line);
        color: var(--m-sheet-brand) !important;
        outline: 0;
    }
    .main_menu .m-sheet .navbar-nav .nav-item .nav-link:active { transform: scale(.985); }
    .main_menu .m-sheet .navbar-nav .nav-item .nav-link:hover::after { opacity: .85; }

    .main_menu .m-sheet .navbar-nav .nav-item .nav-link.active,
    .main_menu .m-sheet .navbar-nav .nav-item .nav-link[aria-current="page"] {
        background: var(--m-sheet-brand);
        background: linear-gradient(135deg, var(--m-sheet-brand), color-mix(in srgb, var(--m-sheet-brand) 72%, #000));
        border-color: transparent;
        color: #fff !important;
        box-shadow: 0 14px 26px -14px rgba(var(--m-sheet-brand-rgb), .95);
    }
    .main_menu .m-sheet .navbar-nav .nav-item .nav-link.active .m-nav-ico,
    .main_menu .m-sheet .navbar-nav .nav-item .nav-link[aria-current="page"] .m-nav-ico {
        background: rgba(255,255,255,.22);
        color: #fff;
    }
    .main_menu .m-sheet .navbar-nav .nav-item .nav-link.active::after,
    .main_menu .m-sheet .navbar-nav .nav-item .nav-link[aria-current="page"]::after { opacity: .9; }

    /* The desktop mega-menu caret has no place in the sheet. */
    .main_menu .m-sheet .navbar-nav .nav-item .nav-link .nx-mega-caret { display: none !important; }

    /* ─────────────────────────────────────────────────────────────────────
       6. Quick actions — sticky footer grid
       ───────────────────────────────────────────────────────────────────── */
    .m-sheet .menu_icon {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
        gap: 10px;
        margin: 0 !important;
        padding: 4px 14px calc(16px + var(--m-sheet-safe)) !important;
        list-style: none;
        position: sticky;
        bottom: 0;
        z-index: 2;
        flex: 0 0 auto;
        background: var(--m-sheet-bg);
        box-shadow: 0 -14px 20px -14px rgba(var(--theme-dark-rgb, 24,18,13), .18);
    }
    .m-sheet .menu_icon > li {
        margin: 0;
        min-width: 0;
        position: relative;
        list-style: none;
    }
    .m-sheet .menu_icon > li.m-sheet__qi--cta { grid-column: 1 / -1; }

    /* Icon tiles */
    .m-sheet .menu_icon > li > a:not(.common_btn):not(.nx-reserve-btn) {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 7px;
        width: 100%;
        height: 100%;
        min-height: 76px;
        padding: 10px 6px;
        border-radius: 20px;
        background: var(--m-sheet-bg-soft);
        border: 1px solid var(--m-sheet-line);
        color: var(--m-sheet-ink);
        text-decoration: none;
        transition: background .22s ease, border-color .22s ease,
                    color .22s ease, transform .18s ease;
    }
    .m-sheet .menu_icon > li > a:not(.common_btn):not(.nx-reserve-btn) > i {
        font-size: 17px;
        color: var(--m-sheet-brand);
        transition: color .22s ease, transform .22s ease;
    }
    /* style.css turns EVERY span inside `.menu_icon li a` into the round cart
       badge (`.main_menu .menu_icon li a span`, absolute + 20px circle). The
       caption has to out-specify it and undo the badge geometry. */
    .main_menu .m-sheet .menu_icon li a .m-sheet__ql {
        display: block;
        position: static;
        inset: auto;
        width: auto;
        height: auto;
        min-width: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: none;
        box-shadow: none;
        font-size: 11.5px;
        font-weight: 700;
        letter-spacing: .01em;
        line-height: 1;
        text-align: center;
        color: var(--m-sheet-soft);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    .m-sheet .menu_icon > li > a:not(.common_btn):not(.nx-reserve-btn):hover,
    .m-sheet .menu_icon > li > a:not(.common_btn):not(.nx-reserve-btn):focus-visible {
        background: rgba(var(--m-sheet-brand-rgb), .10);
        border-color: rgba(var(--m-sheet-brand-rgb), .35);
        outline: 0;
    }
    .m-sheet .menu_icon > li > a:not(.common_btn):not(.nx-reserve-btn):active {
        transform: scale(.97);
    }
    .m-sheet .menu_icon > li > a:hover .m-sheet__ql { color: var(--m-sheet-brand); }

    /* Cart badge on its tile — same specificity battle as the caption above. */
    .main_menu .m-sheet .menu_icon li a .topbar_cart_qty {
        position: absolute;
        top: 8px;
        bottom: auto;
        left: auto;
        right: auto;
        inset-inline-end: 8px;
        inset-inline-start: auto;
        min-width: 20px;
        height: 20px;
        padding: 0 5px;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 11px;
        font-weight: 800;
        line-height: 1;
        color: #fff;
        background: var(--theme-accent, #E0A82E);
        border: 2px solid var(--m-sheet-bg);
        box-shadow: 0 4px 10px -3px rgba(var(--theme-accent-rgb, 224,168,46), .8);
    }

    /* Reservation CTA — full-width primary button */
    .m-sheet .menu_icon > li > a.common_btn,
    .m-sheet .menu_icon > li > a.nx-reserve-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 9px;
        /* modern-2026.css pins this button to `width: auto !important` for the
           desktop header — the sheet needs it edge to edge. */
        width: 100% !important;
        margin: 6px 0 0 !important;
        padding: 15px 18px !important;
        border: 0 !important;
        border-radius: 18px !important;
        font-size: 14.5px !important;
        font-weight: 800 !important;
        letter-spacing: .01em;
        text-decoration: none;
        color: #fff !important;
        background: var(--m-sheet-brand) !important;
        background: linear-gradient(135deg, var(--m-sheet-brand), color-mix(in srgb, var(--m-sheet-brand) 72%, #000)) !important;
        box-shadow: 0 16px 30px -14px rgba(var(--m-sheet-brand-rgb), .95) !important;
        transition: transform .18s ease, box-shadow .22s ease, filter .22s ease;
    }
    .m-sheet .menu_icon > li > a.common_btn:hover,
    .m-sheet .menu_icon > li > a.nx-reserve-btn:hover { filter: brightness(1.06); }
    .m-sheet .menu_icon > li > a.common_btn:active,
    .m-sheet .menu_icon > li > a.nx-reserve-btn:active { transform: scale(.985); }
    .m-sheet .menu_icon > li > a.common_btn i,
    .m-sheet .menu_icon > li > a.nx-reserve-btn i { font-size: 15px; }
    .m-sheet .menu_icon > li > a.common_btn::before,
    .m-sheet .menu_icon > li > a.common_btn::after,
    .m-sheet .menu_icon > li > a.nx-reserve-btn::before,
    .m-sheet .menu_icon > li > a.nx-reserve-btn::after { display: none !important; }

    /* The legacy inline search form never belongs inside the sheet. */
    .m-sheet .wsus__search_form { display: none !important; }

    /* ─────────────────────────────────────────────────────────────────────
       7. Entrance choreography
       ───────────────────────────────────────────────────────────────────── */
    @keyframes mSheetItem {
        from { opacity: 0; transform: translateY(16px); }
        to   { opacity: 1; transform: none; }
    }
    .m-sheet.show .navbar-nav > .nav-item,
    .m-sheet.show .menu_icon > li {
        animation: mSheetItem .5s var(--m-sheet-ease) both;
    }
    .m-sheet.show .navbar-nav > .nav-item:nth-child(1) { animation-delay: .10s; }
    .m-sheet.show .navbar-nav > .nav-item:nth-child(2) { animation-delay: .15s; }
    .m-sheet.show .navbar-nav > .nav-item:nth-child(3) { animation-delay: .20s; }
    .m-sheet.show .navbar-nav > .nav-item:nth-child(4) { animation-delay: .25s; }
    .m-sheet.show .navbar-nav > .nav-item:nth-child(5) { animation-delay: .30s; }
    .m-sheet.show .navbar-nav > .nav-item:nth-child(6) { animation-delay: .35s; }
    .m-sheet.show .navbar-nav > .nav-item:nth-child(7) { animation-delay: .40s; }
    .m-sheet.show .navbar-nav > .nav-item:nth-child(8) { animation-delay: .45s; }
    .m-sheet.show .menu_icon > li:nth-child(1) { animation-delay: .30s; }
    .m-sheet.show .menu_icon > li:nth-child(2) { animation-delay: .35s; }
    .m-sheet.show .menu_icon > li:nth-child(3) { animation-delay: .40s; }
    .m-sheet.show .menu_icon > li:nth-child(4) { animation-delay: .45s; }
    /* Dragging must not re-trigger the stagger. */
    .m-sheet.is-dragging .navbar-nav > .nav-item,
    .m-sheet.is-dragging .menu_icon > li { animation: none; }

    /* ─────────────────────────────────────────────────────────────────────
       8. Very small phones
       ───────────────────────────────────────────────────────────────────── */
    @media (max-width: 359.98px) {
        .main_menu .m-sheet .navbar-nav .nav-item .nav-link { font-size: 14px !important; padding: 10px !important; }
        .main_menu .m-sheet .navbar-nav .nav-item .nav-link .m-nav-ico { flex-basis: 38px; width: 38px; height: 38px; }
        .m-sheet .menu_icon { gap: 8px; }
        .m-sheet .menu_icon > li > a:not(.common_btn):not(.nx-reserve-btn) { min-height: 70px; }
        .m-sheet .menu_icon .m-sheet__ql { font-size: 10.5px; }
    }

    /* ─────────────────────────────────────────────────────────────────────
       9. Dark mode
       ───────────────────────────────────────────────────────────────────── */
    body.nx-dark .navbar.main_menu .navbar-collapse.m-sheet {
        --m-sheet-bg:      #1E1813;
        --m-sheet-bg-soft: #2A221B;
        --m-sheet-ink:     #F5E6D0;
        --m-sheet-soft:    #CBB49A;
        --m-sheet-muted:   #9C8974;
        --m-sheet-line:    rgba(245,230,208,.14);
    }
    body.nx-dark .m-sheet .m-sheet__top { background: #1E1813; }
    body.nx-dark .m-sheet .menu_icon    { background: #1E1813; }

    /* ─────────────────────────────────────────────────────────────────────
       10. Reduced motion
       ───────────────────────────────────────────────────────────────────── */
    @media (prefers-reduced-motion: reduce) {
        .navbar.main_menu .navbar-collapse.m-sheet,
        .navbar.main_menu .navbar-collapse.m-sheet.show { transition-duration: .01ms; }
        .m-sheet.show .navbar-nav > .nav-item,
        .m-sheet.show .menu_icon > li { animation: none; }
        body.m-nav-open::before { animation: none; }
    }
}
