/* ============================================================
   App-style navigation for phones (≤ 768px)
   ============================================================ */
.mab, .mab-sheet, .pwa-card { display: none; }
.nav-link__ico { display: none; }

@media (max-width: 768px) {
    :root { --mab-h: 66px; --mab-safe: env(safe-area-inset-bottom, 0px); --mab-grad: linear-gradient(135deg, #bc0000 0%, #e06228 100%); }

    /* Room for the bar, and the floating buttons it replaces */
    body { padding-bottom: calc(var(--mab-h) + var(--mab-safe)); }
    .wa-widget, .lcw-launcher, .lcw-teaser { display: none !important; }
    #analytics-consent-banner { bottom: calc(var(--mab-h) + var(--mab-safe) + 10px) !important; }
    html.mab-lock, html.mab-lock body { overflow: hidden; }

    /* Bottom tab bar */
    .mab {
        position: fixed; inset-inline: 0; bottom: 0; z-index: 9990; direction: rtl;
        display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
        height: calc(var(--mab-h) + var(--mab-safe)); padding: 0 6px var(--mab-safe);
        background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
        border-top: 1px solid #f1e4da; box-shadow: 0 -8px 24px -14px rgba(120, 40, 20, .25);
        font-family: inherit;
    }
    .mab__item {
        position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        height: var(--mab-h); color: #8a7d74; text-decoration: none; border: 0; background: none; font: inherit; cursor: pointer;
        -webkit-tap-highlight-color: transparent; transition: color .2s ease;
    }
    .mab__item i { font-size: 1.4rem; line-height: 1; transition: transform .25s cubic-bezier(.34, 1.56, .64, 1); }
    .mab__label { font-size: .68rem; font-weight: 700; letter-spacing: .01em; }
    .mab__item.is-active { color: #c8260f; }
    .mab__item.is-active i { transform: translateY(-2px); }
    .mab__item.is-active::before {
        content: ""; position: absolute; top: 6px; width: 34px; height: 3px; border-radius: 0 0 4px 4px; background: var(--mab-grad);
    }
    .mab__item:active i { transform: scale(.88); }

    /* Raised centre "تواصل" button */
    .mab__item--center { justify-content: flex-end; padding-bottom: 8px; color: #c8260f; }
    .mab__fab {
        position: relative; display: grid; place-items: center; width: 56px; height: 56px; margin-top: -26px; margin-bottom: 3px;
        border-radius: 50%; background: var(--mab-grad); color: #fff; border: 4px solid #fff;
        box-shadow: 0 10px 22px -8px rgba(188, 0, 0, .65);
    }
    .mab__fab i { font-size: 1.55rem; }
    .mab__fab::after {
        content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid rgba(212, 43, 30, .45);
        animation: mab-pulse 2.4s ease-out infinite;
    }
    .mab__item--center:active .mab__fab { transform: scale(.94); }
    .mab__badge {
        position: absolute; top: -4px; left: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
        background: #16a34a; color: #fff; font-size: .7rem; font-weight: 800; display: grid; place-items: center; border: 2px solid #fff;
    }
    .mab__badge[hidden] { display: none; }

    /* Bottom sheet */
    .mab-sheet { display: block; position: fixed; inset: 0; z-index: 9995; direction: rtl; }
    .mab-sheet[hidden] { display: none; }
    .mab-sheet__backdrop { position: absolute; inset: 0; background: rgba(17, 24, 39, .45); opacity: 0; transition: opacity .25s ease; }
    .mab-sheet__panel {
        position: absolute; inset-inline: 0; bottom: 0; padding: 10px 16px calc(18px + var(--mab-safe));
        background: #fff; border-radius: 24px 24px 0 0; box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, .35);
        transform: translateY(105%); transition: transform .3s cubic-bezier(.22, 1, .36, 1);
    }
    .mab-sheet.is-open .mab-sheet__backdrop { opacity: 1; }
    .mab-sheet.is-open .mab-sheet__panel { transform: none; }
    .mab-sheet__handle { display: block; width: 42px; height: 5px; border-radius: 999px; background: #e5d8cf; margin: 0 auto 10px; }
    .mab-sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
    .mab-sheet__title { margin: 0; font-size: 1.05rem; font-weight: 800; color: #1f2937; }
    .mab-sheet__x { width: 34px; height: 34px; border: 0; border-radius: 10px; background: #f7f1ea; color: #6b7280; font-size: 1.15rem; display: grid; place-items: center; }

    .mab-opt {
        width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 8px;
        background: #fff; border: 1px solid #f1e4da; border-radius: 16px; color: #1f2937; text-decoration: none; text-align: right; font: inherit;
        -webkit-tap-highlight-color: transparent; transition: background .15s ease, transform .1s ease;
    }
    .mab-opt[hidden] { display: none; }
    .mab-opt:active { transform: scale(.985); background: #fffaf7; }
    .mab-opt--main { border-color: #efcfbf; background: #fff7f3; }
    .mab-opt__ico { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 1.35rem; color: #fff; background: var(--mab-grad); }
    .mab-opt__ico--dark { background: linear-gradient(135deg, #111827, #374151); }
    .mab-opt__ico--wa { background: #25d366; }
    .mab-opt__ico--call { background: #0f766e; }
    .mab-opt__ico--gold { background: linear-gradient(135deg, #f59e0b, #ea580c); }
    .mab-opt__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
    .mab-opt__txt b { font-size: .95rem; }
    .mab-opt__txt small { font-size: .75rem; color: #6b7280; }
    .mab-opt__arrow { color: #c9b8ab; font-size: 1.3rem; }

    @keyframes mab-pulse { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }

    /* ── Phone menu (hamburger): language + actions on top, sections as a 2-column grid ── */
    .navbar__links.is-open {
        display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start;
        top: calc(var(--navbar-mobile-top, 80px) + 8px); left: 10px; right: 10px; padding: 12px; border-radius: 22px;
        max-height: calc(100dvh - var(--navbar-mobile-top, 80px) - var(--mab-h) - var(--mab-safe) - 24px);
        background: rgba(247, 241, 234, .985);
    }
    .navbar__links.is-open > .nav-link {
        order: 2; display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 10px 12px;
        font-size: .9rem; font-weight: 700; color: #374151; background: #fff; border: 1px solid #f1e4da; border-radius: 14px;
    }
    .navbar__links.is-open > .nav-link.is-active { background: #fff1ea; border-color: #efcfbf; color: #c8260f; }
    .navbar__links.is-open .nav-link__ico {
        display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 10px;
        background: #fff4ee; color: #c8260f; font-size: 1rem;
    }
    .navbar__links.is-open > .nav-dropdown { order: 3; grid-column: 1 / -1; }
    .navbar__links.is-open .nav-dropdown__trigger { font-weight: 700; background: #fff; border: 1px solid #f1e4da; border-radius: 14px; }

    /* Language + الباقات + بروفايل الشركة: first row, always visible */
    .navbar__links.is-open .navbar__mobile-actions {
        order: 1; grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
        margin: 0 0 4px; padding: 0 0 10px; border-top: 0; border-bottom: 1px dashed #e8d5c7;
    }
    .navbar__links.is-open .navbar__mobile-actions .lang-mobile-btn {
        order: -1; grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 8px;
        width: 100%; min-height: 44px; margin: 0; border-radius: 12px; border: 1px solid #e8d5c7; background: #fff;
        color: #1f2937; font: inherit; font-size: .9rem; font-weight: 800; cursor: pointer;
    }
    .navbar__links.is-open .navbar__packages--mobile,
    .navbar__links.is-open .navbar__cta--mobile { min-height: 44px; padding: 10px 12px !important; font-size: .88rem !important; border-radius: 12px !important; }
    .navbar__links.is-open .navbar__mobile-actions > :only-child { grid-column: 1 / -1; }

    /* ── Install-as-app card ── */
    .pwa-card {
        position: fixed; inset-inline: 10px; bottom: calc(var(--mab-h) + var(--mab-safe) + 10px); z-index: 9991; direction: rtl;
        display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fff; border: 1px solid #f1e4da; border-radius: 18px;
        box-shadow: 0 18px 40px -16px rgba(120, 30, 10, .45); transform: translateY(16px); opacity: 0; transition: all .3s cubic-bezier(.22, 1, .36, 1);
    }
    .pwa-card[hidden] { display: none; }
    .pwa-card.is-on { transform: none; opacity: 1; }
    .pwa-card img { width: 46px; height: 46px; border-radius: 13px; flex: none; }
    .pwa-card__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
    .pwa-card__txt b { font-size: .9rem; color: #1f2937; }
    .pwa-card__txt small { font-size: .72rem; color: #6b7280; line-height: 1.5; }
    .pwa-card__btn { flex: none; border: 0; border-radius: 12px; padding: 9px 14px; background: var(--mab-grad); color: #fff; font: inherit; font-size: .85rem; font-weight: 800; }
    .pwa-card__x { flex: none; border: 0; background: none; color: #9ca3af; font-size: 1.3rem; line-height: 1; padding: 4px; }
    .pwa-steps { list-style: none; margin: 4px 0 6px; padding: 0; display: grid; gap: 10px; }
    .pwa-steps li { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #f1e4da; border-radius: 14px; font-size: .9rem; color: #374151; }
    .pwa-steps li span { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--mab-grad); color: #fff; font-weight: 800; font-size: .85rem; }
    .pwa-steps li i { color: #c8260f; font-size: 1.15rem; }
    html.is-app .pwa-card { display: none !important; }
}

@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
    .mab__fab::after { animation: none; }
    .mab-sheet__panel, .mab-sheet__backdrop { transition: none; }
}
