/* =====================================================================
   Dedicated Mobile Navigation (max-width: 767px only)
   - Sticky app-style header (56px)
   - Right-side slide drawer (RTL)
   - Bottom nav lives in mobile-optimizations.css
   Additive: desktop layout is untouched.
   ===================================================================== */

.em-mheader,
.em-drawer,
.em-drawer__scrim { display: none; }

@media (max-width: 767px) {
  /* Hide the desktop-derived header on phones */
  .tp-header-10-main,
  #header-sticky.tp-header-10-main { display: none !important; }

  /* Hide legacy offcanvas / side widgets — we use our own drawer */
  .tpoffcanvas,
  .body-overlay,
  .uv-side { display: none !important; }

  /* The Bexon-style hamburger panel replaces the legacy drawer on phones */
  .em-drawer,
  .em-drawer__scrim { display: none !important; }


  /* --------------------------------------------------------
     Sticky app-style header
     -------------------------------------------------------- */
  .em-mheader {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    padding: 0 10px;
    padding-top: env(safe-area-inset-top);
    box-sizing: content-box;
    background: transparent;
    border-bottom: 0;
    box-shadow: none;
    pointer-events: none;
    z-index: 1200;
    direction: rtl;
  }
  /* Only the menu button — no header bar, no logo, no cart */
  .em-mheader__logo,
  .em-mheader__cart { display: none !important; }
  .em-mheader__btn[data-em-drawer-open] {
    pointer-events: auto;
    position: absolute;
    top: calc(6px + env(safe-area-inset-top));
    left: 10px;
    right: auto;
    margin: 0;
  }
  body.is-scrolled .em-mheader {
    background: transparent;
    box-shadow: none;
  }
  .em-mheader__btn {
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 12px;
    background: transparent;
    border: 0; padding: 0;
    color: #1a2332;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform .18s cubic-bezier(.2,.8,.2,1), background-color .18s ease;
    position: relative;
  }
  .em-mheader__btn:active { transform: scale(.92); background: rgba(15,23,42,0.05); }
  .em-mheader__btn svg { width: 24px; height: 24px; stroke: currentColor; }

  .em-mheader__logo {
    justify-self: center;
    height: 34px;
    display: inline-flex; align-items: center;
  }
  .em-mheader__logo img { height: 100%; width: auto; display: block; }

  /* Cart badge on the header cart button */
  .em-mheader__cart { position: relative; }
  .em-mheader__badge {
    position: absolute;
    top: 4px; inset-inline-end: 4px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #f7ab24;
    color: #fff; font-size: 10px; font-weight: 700;
    display: none; align-items: center; justify-content: center;
    line-height: 1;
    box-shadow: 0 0 0 2px #fff;
  }
  .em-mheader__badge.has-items { display: inline-flex; }
  body.is-scrolled .em-mheader__badge { box-shadow: 0 0 0 2px rgba(255,255,255,0.94); }


  /* --------------------------------------------------------
     Right-side slide drawer (RTL) + scrim
     -------------------------------------------------------- */

  /* --------------------------------------------------------
     Right-side slide drawer (RTL) + scrim
     -------------------------------------------------------- */
  .em-drawer__scrim {
    display: block;
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.42);
    opacity: 0; pointer-events: none;
    transition: opacity .22s ease;
    z-index: 99998;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }
  .em-drawer {
    display: flex; flex-direction: column;
    position: fixed;
    top: 0; bottom: 0;
    right: 0; left: auto;                 /* always visual right edge */
    width: min(86vw, 360px);
    background: #ffffff;
    z-index: 99999;
    transform: translateX(100%);          /* off-screen to the right */
    transition: transform .26s cubic-bezier(.2,.8,.2,1);
    box-shadow: -20px 0 40px -20px rgba(15,23,42,0.25);
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    font-family: 'IBM Plex Sans Arabic','Tajawal','Cairo',sans-serif;
    will-change: transform;
    overscroll-behavior: contain;
  }



  body.em-drawer-open { overflow: hidden; }
  body.em-drawer-open .em-drawer__scrim { opacity: 1; pointer-events: auto; }
  body.em-drawer-open .em-drawer { transform: translateX(0); }

  .em-drawer__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(15,23,42,0.06);
  }
  .em-drawer__brand { display: inline-flex; align-items: center; }
  .em-drawer__brand img { height: 34px; width: auto; display: block; }
  .em-drawer__close {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 12px;
    background: rgba(15,23,42,0.04);
    border: 0; color: #1a2332;
    transition: transform .18s cubic-bezier(.2,.8,.2,1), background-color .18s ease;
  }
  .em-drawer__close:active { transform: scale(.92); background: rgba(15,23,42,0.09); }
  .em-drawer__close svg { width: 20px; height: 20px; }

  .em-drawer__body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 8px 24px;
  }
  .em-drawer__list { list-style: none; margin: 0; padding: 0; }
  .em-drawer__link {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 14px;
    margin: 2px 6px;
    border-radius: 14px;
    color: #1a2332;
    text-decoration: none;
    font-size: 16px; font-weight: 600;
    transition: background-color .18s ease, transform .18s cubic-bezier(.2,.8,.2,1);
    opacity: 0;
    transform: translateX(14px);
  }
  html[dir="rtl"] .em-drawer__link,
  [dir="rtl"] .em-drawer__link { transform: translateX(-14px); }
  body.em-drawer-open .em-drawer__link {
    animation: em-drawer-item-in .32s cubic-bezier(.2,.8,.2,1) both;
  }
  body.em-drawer-open .em-drawer__list li:nth-child(1) .em-drawer__link { animation-delay: .04s; }
  body.em-drawer-open .em-drawer__list li:nth-child(2) .em-drawer__link { animation-delay: .08s; }
  body.em-drawer-open .em-drawer__list li:nth-child(3) .em-drawer__link { animation-delay: .12s; }
  body.em-drawer-open .em-drawer__list li:nth-child(4) .em-drawer__link { animation-delay: .16s; }
  body.em-drawer-open .em-drawer__list li:nth-child(5) .em-drawer__link { animation-delay: .20s; }
  body.em-drawer-open .em-drawer__list li:nth-child(6) .em-drawer__link { animation-delay: .24s; }
  body.em-drawer-open .em-drawer__list li:nth-child(7) .em-drawer__link { animation-delay: .28s; }
  body.em-drawer-open .em-drawer__list li:nth-child(8) .em-drawer__link { animation-delay: .32s; }

  @keyframes em-drawer-item-in {
    to { opacity: 1; transform: translateX(0); }
  }
  .em-drawer__link:active { background: rgba(247,171,36,0.10); transform: scale(.985); }
  .em-drawer__link.is-active {
    background: rgba(247,171,36,0.12);
    color: #b47a13;
  }
  .em-drawer__ico {
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: rgba(247,171,36,0.10);
    color: #f7ab24;
    flex-shrink: 0;
  }
  .em-drawer__link.is-active .em-drawer__ico { background: rgba(247,171,36,0.22); }
  .em-drawer__ico svg { width: 18px; height: 18px; }

  .em-drawer__foot {
    border-top: 1px solid rgba(15,23,42,0.06);
    padding: 14px 16px calc(14px + var(--safe-bottom));
    display: flex; flex-direction: column; gap: 10px;
  }
  .em-drawer__cta {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: #f7ab24;
    color: #1a2332;
    font-weight: 700; font-size: 15px;
    text-decoration: none;
    height: 48px; border-radius: 14px;
    transition: transform .18s cubic-bezier(.2,.8,.2,1), background-color .18s ease;
  }
  .em-drawer__cta:active { transform: scale(.97); background: #eea019; }
  .em-drawer__cta svg,
  .em-drawer__lang svg { width: 18px; height: 18px; flex-shrink: 0; }
  .em-drawer__lang {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: transparent;
    color: #526669;
    font-weight: 600; font-size: 14px;
    text-decoration: none;
    height: 44px; border-radius: 12px;
    border: 1px solid rgba(15,23,42,0.10);
    transition: background-color .18s ease;
  }
  .em-drawer__lang:active { background: rgba(15,23,42,0.04); }
}
