/* Unified Patient Header & Navigation Drawer — معمل الإيمان للتحاليل الطبية */
:root {
  --site-head-brand: #cf397b;
  --site-head-dark: #9d1d55;
  --site-head-ink: #20202c;
  --site-head-muted: #686878;
  --site-head-soft: #fff3f8;
  --site-head-line: #f2dce6;
}

body.menu-open {
  overflow: hidden !important;
}

body.menu-open .prime-pwa-banner,
body.menu-open .prime-pwa-floating-trigger {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.header {
  position: sticky;
  top: 0;
  z-index: 900;
  width: 100%;
  height: 78px;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(207, 57, 123, 0.12);
  box-shadow: 0 8px 28px rgba(45, 23, 35, 0.045);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-family: 'Cairo', sans-serif;
  direction: rtl;
}

.nav-wrap {
  width: min(1240px, calc(100% - 32px));
  max-width: 1240px;
  height: 78px;
  margin-inline: auto;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header .brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
  min-width: 0;
  text-decoration: none;
  color: var(--site-head-ink);
}

.header .brand img {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 14px;
  object-fit: contain;
  background: #fff;
  padding: 2px;
  border: 1px solid rgba(207, 57, 123, 0.14);
  box-shadow: 0 6px 18px rgba(207, 57, 123, 0.12);
}

.header .brand > span,
.header .brand > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: right;
}

.header .brand strong {
  display: block;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--site-head-ink);
  white-space: nowrap;
}

.header .brand small {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--site-head-brand);
  white-space: nowrap;
}

.desktop-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
}

.desktop-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--site-head-ink);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.desktop-nav a:hover,
.desktop-nav a:focus-visible,
.desktop-nav a.active,
.desktop-nav a[aria-current="page"] {
  background: var(--site-head-soft);
  color: var(--site-head-dark);
}

.desktop-nav a.highlight-btn {
  margin-inline-start: 6px;
  padding: 9px 16px;
  border-radius: 13px;
  background: linear-gradient(135deg, #cf397b 0%, #9d1d55 100%);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(207, 57, 123, 0.34);
}

.desktop-nav a.highlight-btn svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.desktop-nav a.highlight-btn:hover,
.desktop-nav a.highlight-btn:focus-visible {
  background: linear-gradient(135deg, #df4888 0%, #ad2261 100%);
  color: #fff;
  box-shadow: 0 6px 22px rgba(207, 57, 123, 0.45);
  transform: translateY(-1px);
}

.desktop-nav a.highlight-btn.active,
.desktop-nav a.highlight-btn[aria-current="page"] {
  background: linear-gradient(135deg, #9d1d55 0%, #cf397b 100%);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(207, 57, 123, 0.2), 0 6px 20px rgba(207, 57, 123, 0.42);
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.header-actions .logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--site-head-line);
  background: #fff;
  color: var(--site-head-dark);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.header-actions .logout-button:hover,
.header-actions .logout-button:focus-visible {
  background: var(--site-head-soft);
  border-color: var(--site-head-brand);
}

.header-actions .logout-button[hidden] {
  display: none !important;
}

.menu-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--site-head-line);
  background: #fff;
  color: var(--site-head-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.menu-btn:hover,
.menu-btn:focus-visible {
  background: var(--site-head-soft);
  border-color: rgba(207, 57, 123, 0.35);
  color: var(--site-head-dark);
}

.header a:focus-visible,
.header button:focus-visible,
.mobile-menu a:focus-visible,
.mobile-menu button:focus-visible {
  outline: 2px solid var(--site-head-brand);
  outline-offset: 2px;
}

/* Mobile Drawer Overlay & Panel */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(24, 15, 22, 0.56);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1101;
  width: min(86vw, 350px);
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #fff;
  box-shadow: -20px 0 60px rgba(32, 32, 44, 0.18);
  transform: translate3d(105%, 0, 0);
  visibility: hidden;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.28s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Cairo', sans-serif;
  direction: rtl;
}

.mobile-menu.open {
  transform: translate3d(0, 0, 0);
  visibility: visible;
}

.mobile-head {
  padding: 20px 18px;
  background: linear-gradient(135deg, #9d1d55 0%, #cf397b 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
}

.mobile-head .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mobile-head .brand img {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 14px;
  object-fit: contain;
  background: #fff;
  padding: 2px;
  box-shadow: 0 8px 20px rgba(32, 8, 22, 0.2);
}

.mobile-head .brand > span,
.mobile-head .brand > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mobile-head .brand strong {
  display: block;
  font-size: 1.04rem;
  font-weight: 800;
  line-height: 1.25;
  color: #fff;
}

.mobile-head .brand small {
  display: block;
  margin-top: 2px;
  font-size: 0.74rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
}

.close-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: background-color 0.18s ease;
}

.close-btn:hover,
.close-btn:focus-visible {
  background: rgba(255, 255, 255, 0.28);
}

.mobile-links {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-links a {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--site-head-ink);
  font-size: 0.94rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.mobile-links a .nav-ico {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  background: var(--site-head-soft);
  color: var(--site-head-brand);
  display: grid;
  place-items: center;
}

.mobile-links a:hover,
.mobile-links a:focus-visible,
.mobile-links a.active,
.mobile-links a[aria-current="page"] {
  background: var(--site-head-soft);
  color: var(--site-head-dark);
}

.mobile-links a.active .nav-ico,
.mobile-links a[aria-current="page"] .nav-ico {
  background: var(--site-head-brand);
  color: #fff;
}

.mobile-links a.mobile-result {
  margin-top: 6px;
  background: linear-gradient(135deg, #cf397b 0%, #9d1d55 100%);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(207, 57, 123, 0.24);
}

.mobile-links a.mobile-result .nav-ico {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.mobile-links a.mobile-result:hover,
.mobile-links a.mobile-result:focus-visible,
.mobile-links a.mobile-result.active,
.mobile-links a.mobile-result[aria-current="page"] {
  background: linear-gradient(135deg, #9d1d55 0%, #cf397b 100%);
  color: #fff;
}

.mobile-foot {
  flex: 0 0 auto;
  padding: 14px 18px max(16px, env(safe-area-inset-bottom));
  background: #fff8fb;
  border-top: 1px solid var(--site-head-line);
  color: var(--site-head-muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
}

.mobile-foot a {
  color: var(--site-head-dark);
  text-decoration: none;
  font-weight: 800;
}

.pwa-header-install-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(207, 57, 123, 0.3);
  background: var(--site-head-soft);
  color: var(--site-head-dark);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(207, 57, 123, 0.1);
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.pwa-header-install-btn:hover,
.pwa-header-install-btn:focus-visible {
  background: linear-gradient(135deg, #cf397b 0%, #9d1d55 100%);
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(207, 57, 123, 0.26);
}

.pwa-header-install-btn:active {
  transform: scale(0.97);
}

.pwa-header-install-btn[hidden] {
  display: none !important;
}

.mobile-links .pwa-menu-install-btn {
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 13px;
  border: 1.5px solid rgba(207, 57, 123, 0.26);
  background: var(--site-head-soft);
  color: var(--site-head-dark);
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 800;
  text-align: right;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.mobile-links .pwa-menu-install-btn .nav-ico {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  background: var(--site-head-brand);
  color: #fff;
  display: grid;
  place-items: center;
}

.mobile-links .pwa-menu-install-btn:hover,
.mobile-links .pwa-menu-install-btn:focus-visible {
  background: linear-gradient(135deg, #cf397b 0%, #9d1d55 100%);
  color: #fff;
  border-color: transparent;
}

.mobile-links .pwa-menu-install-btn:hover .nav-ico,
.mobile-links .pwa-menu-install-btn:focus-visible .nav-ico {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.mobile-links .pwa-menu-install-btn[hidden] {
  display: none !important;
}

@media (min-width: 961px) {
  .menu-btn {
    display: none !important;
  }

  .header-actions:not(:has(.logout-button:not([hidden]), .pwa-header-install-btn:not([hidden]))) {
    display: none !important;
  }
}

@media (max-width: 1180px) and (min-width: 961px) {
  .nav-wrap {
    width: calc(100% - 24px);
    gap: 10px;
  }

  .header .brand img {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    border-radius: 12px;
  }

  .header .brand strong {
    font-size: 0.98rem;
  }

  .header .brand small {
    font-size: 0.68rem;
  }

  .desktop-nav {
    gap: 2px;
  }

  .desktop-nav a {
    padding: 7px 8px;
    font-size: 0.78rem;
  }

  .desktop-nav a.highlight-btn {
    margin-inline-start: 4px;
    padding: 8px 11px;
    font-size: 0.78rem;
  }

  .header-actions .logout-button,
  .header-actions .pwa-header-install-btn {
    min-height: 36px;
    padding: 0 10px;
    font-size: 0.76rem;
    gap: 5px;
  }
}

@media (max-width: 960px) {
  .header,
  .nav-wrap {
    height: 68px;
  }

  .nav-wrap {
    width: calc(100% - 24px);
    gap: 10px;
  }

  .desktop-nav,
  .pwa-header-install-btn {
    display: none !important;
  }

  .header .brand {
    gap: 9px;
  }

  .header .brand img {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    border-radius: 12px;
  }

  .header .brand strong {
    font-size: 0.98rem;
  }

  .header .brand small {
    display: block !important;
    font-size: 0.69rem;
  }

  .header-actions .logout-button {
    min-height: 40px;
    padding: 0 10px;
    font-size: 0.8rem;
  }
}

@media (max-width: 370px) {
  .nav-wrap {
    width: calc(100% - 20px);
    gap: 8px;
  }

  .header .brand img {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .header .brand strong {
    font-size: 0.9rem;
  }

  .header .brand small {
    font-size: 0.64rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-menu,
  .overlay,
  .desktop-nav a {
    transition: none !important;
  }
}

/* Shared mobile quick navigation for public pages. Patient report routes are
   intentionally excluded by site-shell.js so report/PDF layouts stay intact. */
.mobile-bottom-nav {
  display: none;
}

body.public-site .site-footer {
  background: #211b24 !important;
  color: rgba(255, 255, 255, .78) !important;
  border-top: 1px solid rgba(255, 255, 255, .08) !important;
  padding: 28px 20px 24px !important;
  margin-top: 0 !important;
  text-align: center;
}

body.public-site .site-footer a {
  color: #fff !important;
}

body.public-site .site-footer .footer-inner {
  width: min(1160px, 100%);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

body.public-site .site-footer .socials,
body.public-site .site-footer .social-icons-mobile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0;
}

body.public-site .site-footer .socials a,
body.public-site .site-footer .social-icons-mobile a {
  color: #fff !important;
  opacity: .88;
}

body.public-site .site-footer .copyright {
  color: rgba(255, 255, 255, .72) !important;
}

/* =======================================================================
   Prime Floating Bottom Navigation Bar (شريط التنقل السفلي العائم الفاخر)
   يظهر حصرياً في وضع الهاتف والشاشات المحمولة فقط
   ======================================================================= */
.mobile-bottom-nav {
  display: none !important;
}

@media (min-width: 769px) {
  .mobile-bottom-nav {
    display: none !important;
  }
  body.mobile-bottom-nav-enabled {
    padding-bottom: 0 !important;
  }
}

@media (max-width: 768px) {
  body.mobile-bottom-nav-enabled {
    padding-bottom: 0 !important;
  }

  .mobile-bottom-nav {
    display: grid !important;
    position: fixed;
    bottom: max(14px, env(safe-area-inset-bottom, 14px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 99990;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: min(400px, calc(100% - 24px));
    padding: 8px 10px 7px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(207, 57, 123, 0.18);
    border-radius: 36px;
    box-shadow: 0 16px 45px rgba(35, 15, 26, 0.16), 0 2px 10px rgba(207, 57, 123, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    direction: rtl;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  }

  .mobile-bottom-nav-item {
    min-width: 0;
    min-height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 3px 2px;
    border-radius: 18px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #6a6273;
    font-family: 'Cairo', system-ui, sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .mobile-bottom-nav-item:active {
    transform: scale(0.92);
  }

  .mobile-bottom-nav-item.is-active {
    color: var(--site-head-brand);
    font-weight: 800;
  }

  .mobile-bottom-nav-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 12px;
    color: #6a6273;
    background: transparent;
    transition: all 0.22s ease;
  }

  .mobile-bottom-nav-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-bottom-nav-item.is-active .mobile-bottom-nav-icon {
    color: var(--site-head-brand);
    background: rgba(207, 57, 123, 0.12);
    box-shadow: 0 4px 12px rgba(207, 57, 123, 0.15);
    transform: translateY(-1px);
  }

  /* النقطة النابضة للعروض */
  .nav-badge-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e11d48;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.25);
    animation: primePing 1.8s infinite;
  }

  /* زر النتائج مطابق لباقي أزرار الشريط السفلي بدون دائرة عائمة */
  .mobile-bottom-nav-item.is-center-action {
    position: relative;
    margin-top: 0;
    margin-bottom: 0;
  }

  .mobile-bottom-nav-fab {
    position: relative;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 12px;
    color: #6a6273;
    background: transparent;
    border: 0;
    box-shadow: none;
    transition: all 0.22s ease;
  }

  .mobile-bottom-nav-fab-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: none;
  }

  .mobile-bottom-nav-item.is-center-action:active .mobile-bottom-nav-fab {
    transform: none;
  }

  .mobile-bottom-nav-item.is-center-action.is-active .mobile-bottom-nav-fab {
    color: var(--site-head-brand);
    background: rgba(207, 57, 123, 0.12);
    box-shadow: 0 4px 12px rgba(207, 57, 123, 0.15);
    transform: translateY(-1px);
  }

  .mobile-bottom-nav-label.fab-label {
    font-weight: inherit;
    color: inherit;
    margin-top: 0;
  }

  /* زر واتساب العائم يعلو الشريط دائماً */
  body.mobile-bottom-nav-enabled .whatsapp-float {
    bottom: calc(92px + env(safe-area-inset-bottom, 16px)) !important;
  }

  body.public-site .site-footer {
    padding: 24px 16px calc(96px + env(safe-area-inset-bottom, 14px)) !important;
    text-align: center !important;
  }
  body.public-site .site-footer .footer-inner {
    justify-content: center !important;
    flex-direction: column !important;
    gap: 10px !important;
  }
}

@media (max-width: 768px) {
  body.mobile-bottom-nav-enabled .whatsapp-float {
    bottom: calc(86px + env(safe-area-inset-bottom, 12px)) !important;
    left: 14px !important;
    right: auto !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: 16px !important;
    font-size: 1.35rem !important;
    box-shadow: 0 8px 22px rgba(37, 211, 102, 0.34) !important;
  }

  body.mobile-bottom-nav-enabled .whatsapp-float a {
    font-size: 1.4rem !important;
  }

  body.menu-open .whatsapp-float {
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

@media (max-width: 440px) {
  .mobile-bottom-nav {
    width: calc(100% - 16px);
    padding: 6px 6px 5px;
    border-radius: 30px;
  }
  .mobile-bottom-nav-item {
    font-size: 0.62rem;
  }
  .mobile-bottom-nav-fab {
    width: 32px;
    height: 32px;
  }
}

@media print {
  .header,
  .overlay,
  .mobile-menu,
  .mobile-bottom-nav,
  .whatsapp-float,
  .pwa-header-install-btn,
  .pwa-menu-install-btn,
  .prime-pwa-banner,
  .prime-pwa-floating-trigger,
  .prime-notif-modal-overlay {
    display: none !important;
  }
}
