/* yz-app-nav — shared mobile in-app navigation (Phase 1: doctor/admin/home).
   RTL right-side drawer + top-right hamburger trigger. Scoped under #yznav-root / .yznav-*
   so it never touches page styles. iOS/Android PWA safe-area aware. Sits above
   page chrome but below real page modals (root z 9998 < confirm/loading 9999+,
   toasts 11000) and also auto-hides while a full-screen page modal is open. */

#yznav-root,
#yznav-root * {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

#yznav-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  font-family: inherit;
  direction: rtl;
}

/* hidden state (a page modal is open) */
#yznav-root.yznav-suppressed { display: none !important; }

/* ---------- Trigger button (top-left hamburger, RTL; drawer still opens right) ---------- */
#yznav-fab {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: calc(env(safe-area-inset-left, 0px) + 16px);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(145deg, #163150, #0b1a2b);
  color: #f2f7fc;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32), 0 2px 5px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}
#yznav-fab:active { transform: scale(0.94); }
#yznav-fab:focus-visible { outline: 2px solid #4c9ffe; outline-offset: 3px; }
#yznav-fab .yznav-fab-ic { display: flex; }
#yznav-fab .yznav-fab-ic svg { width: 24px; height: 24px; display: block; }
/* hide the trigger while the drawer is open */
#yznav-root.yznav-open #yznav-fab { opacity: 0; pointer-events: none; transform: scale(0.9); }

/* ---------- Overlay ---------- */
#yznav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 15, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
#yznav-root.yznav-anim #yznav-overlay { opacity: 1; pointer-events: auto; }

/* ---------- Right-side drawer ---------- */
#yznav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  height: 100dvh;
  width: min(82vw, 360px);
  background: linear-gradient(180deg, #0d1f34 0%, #0b1a2b 100%);
  color: #eaf1fa;
  border-top-left-radius: 22px;
  border-bottom-left-radius: 22px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -16px 0 44px rgba(0, 0, 0, 0.5);
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  transform: translateX(110%);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
}
#yznav-root.yznav-anim #yznav-drawer { transform: translateX(0); }

/* ---------- Header ---------- */
.yznav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 4px 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.yznav-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.yznav-badge {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: #eaf1fa;
  background: linear-gradient(145deg, #1c3d63, #0b1a2b);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.yznav-brand-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.yznav-brand-name { font-size: 16px; font-weight: 700; color: #f2f7fc; }
.yznav-brand-sub { font-size: 12.5px; font-weight: 600; color: #7f97b3; letter-spacing: 0.02em; }
.yznav-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #cfe0f2;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.15s ease;
}
.yznav-close:hover,
.yznav-close:active { background: rgba(255, 255, 255, 0.12); }
.yznav-close:focus-visible { outline: 2px solid #4c9ffe; outline-offset: 2px; }
.yznav-close svg { width: 20px; height: 20px; display: block; }

/* ---------- List ---------- */
.yznav-nav { flex: 1 1 auto; }
.yznav-list { list-style: none; margin: 0; padding: 6px 0 0; }
.yznav-list li { margin: 0; }

.yznav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: right;
  background: transparent;
  border: 0;
  border-radius: 13px;
  padding: 14px 12px;
  color: #eaf1fa;
  font-size: 16px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}
.yznav-item:hover,
.yznav-item:active,
.yznav-item:focus-visible { background: rgba(255, 255, 255, 0.07); outline: none; }
.yznav-item .yznav-ico {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  color: #8fb0d6;
  display: flex;
  align-items: center;
  justify-content: center;
}
.yznav-item .yznav-ico svg { width: 22px; height: 22px; display: block; }
.yznav-item .yznav-lbl { flex: 1 1 auto; min-width: 0; }

/* ---------- Expandable login section (تسجيل دخول) ---------- */
.yznav-item.yznav-expander .yznav-chev {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: #7f97b3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}
.yznav-item.yznav-expander .yznav-chev svg { width: 18px; height: 18px; display: block; }
li.yznav-has-sub.yznav-open-sub .yznav-expander .yznav-chev { transform: rotate(180deg); }
.yznav-sub {
  list-style: none;
  margin: 0;
  padding: 0;
  padding-inline-start: 18px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.26s ease;
}
li.yznav-has-sub.yznav-open-sub .yznav-sub { max-height: 220px; }
.yznav-subitem { font-size: 15px; padding: 12px 12px; }
.yznav-subitem .yznav-ico { color: #6f8bab; }

.yznav-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 8px 6px;
  border: 0;
}
.yznav-item.yznav-danger { color: #ff8585; }
.yznav-item.yznav-danger .yznav-ico { color: #ff8585; }

@media (prefers-reduced-motion: reduce) {
  #yznav-fab,
  #yznav-overlay,
  #yznav-drawer,
  .yznav-sub,
  .yznav-item.yznav-expander .yznav-chev { transition: none; }
}
