/* =========================================================
   بازطراحی هدر — سایت نوبت‌دهی پزشکی
   پالت «آرامش بالینی» (Clinical Calm)
   این فایل را بعد از CSS اصلی تم لود کنید (override)
   ========================================================= */

@import url("https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap");

:root {
  --clinic-bg: #ffffff;
  --clinic-bg-soft: #f5faf9;
  --clinic-ink: #0f3d3e; /* سبز-نفتی تیره: رنگ اصلی متن/برند */
  --clinic-ink-soft: #526b69; /* رنگ پیش‌فرض لینک‌های منو */
  --clinic-teal: #17968f; /* هاور/تاکید */
  --clinic-teal-dark: #0d726c;
  --clinic-coral: #ff6f59; /* لهجه‌ی گرم برای CTA (ورود/ثبت‌نام) */
  --clinic-coral-dark: #e6573f;
  --clinic-border: #e3efed;
  --clinic-shadow: 0 10px 30px -14px rgba(15, 61, 62, 0.18);
}

.header-custom,
.header-custom * {
  font-family: "Vazirmatn", Tahoma, sans-serif;
}

/* آیکون‌های Boxicons باید فونت اختصاصی خودشون رو حفظ کنن،
   وگرنه با قانون بالا override می‌شن و نمایش داده نمی‌شن */
.header-custom .bx,
.header-custom [class*=" bx-"],
.header-custom [class^="bx-"] {
  font-family: "boxicons" !important;
}

/* ---------- ساختار کلی هدر ---------- */
.header-custom.header-fixed {
  position: fixed;
  inset-inline: 0;
  top: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--clinic-border);
  box-shadow: var(--clinic-shadow);
  transition:
    background 0.3s ease,
    box-shadow 0.3s ease;
  z-index: 1060; /* باید بالاتر از .sidebar-overlay (1040) باشد، چون backdrop-filter اینجا یک stacking context جدید می‌سازد و z-index داخلی main-menu-wrapper محدود به همین عدد می‌شود */
}

.header-custom .container {
  padding-block: 3px;
}
.header-custom .navbar {
  align-items: center;
}

/* ---------- لوگو ---------- */
.header-custom .navbar-brand.logo img {
    margin-top: 12px;
  height: 46px;
  width: auto;
  filter: drop-shadow(0 4px 10px rgba(15, 61, 62, 0.15));
  transition: transform 0.25s ease;
}
.header-custom .navbar-brand.logo:hover img {
  transform: scale(1.04);
}

/* ---------- دکمه‌های موبایل‌منو و جستجو ---------- */
.header-custom #mobile_btn,
.header-custom #search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--clinic-bg-soft);
  border: 1px solid var(--clinic-border);
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}
.header-custom #mobile_btn:hover,
.header-custom #search-btn:hover {
  background: var(--clinic-teal);
  border-color: var(--clinic-teal);
  /* خط transform حذف شد تا دکمه تکان نخورد */
}

/* برای اطمینان کامل از اینکه در لحظه کلیک هم جابجا نمی‌شود */
.header-custom #mobile_btn:active {
  transform: none !important;
}

/* آیکون‌های Boxicons (bx) — جایگزین svg اینلاین و Font Awesome */
.header-custom #mobile_btn .bar-icon,
.header-custom #search-btn .bar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.header-custom #mobile_btn .bx,
.header-custom #search-btn .bx,
.header-custom #menu_close .bx {
  font-size: 22px;
  line-height: 1;
  color: var(--clinic-ink);
  transition: color 0.2s ease;
}
.header-custom #mobile_btn:hover .bx,
.header-custom #search-btn:hover .bx {
  color: #fff;
}
/* در صورتی که هنوز svg اینلاین قبلی جایگزین نشده باشد، بازهم رنگش هماهنگ می‌ماند */
.header-custom #mobile_btn svg path {
  fill: var(--clinic-ink);
  transition: fill 0.2s ease;
}
.header-custom #mobile_btn:hover svg path {
  fill: #fff;
}
.header-custom #search-btn i {
  color: var(--clinic-ink) !important;
  transition: color 0.2s ease;
}
.header-custom #search-btn:hover i {
  color: #fff !important;
}

/* ---------- منوی اصلی ---------- */
.header-custom .main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-custom .main-nav > li > a {
  position: relative;
  color: var(--clinic-ink-soft);
  font-weight: 500;
  font-size: 15.5px;
  padding: 10px 14px !important;
  border-radius: 10px;
  transition:
    color 0.2s ease,
    background 0.2s ease;
}
.header-custom .main-nav > li > a:hover,
.header-custom .main-nav > li > a:focus-visible {
  color: var(--clinic-teal-dark);
  background: var(--clinic-bg-soft);
  outline: none;
}

/* امضای طراحی: خط ضربان قلب (ECG) که با هاور روی هر آیتم منو ظاهر می‌شود */
.header-custom .main-nav > li > a::after {
  content: "";
  position: absolute;
  right: 14px;
  left: 14px;
  bottom: 4px;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--clinic-teal) 15%,
    var(--clinic-coral) 50%,
    var(--clinic-teal) 85%,
    transparent
  );
  clip-path: polygon(
    0 50%,
    15% 50%,
    20% 15%,
    25% 85%,
    30% 50%,
    100% 50%,
    100% 60%,
    30% 60%,
    25% 100%,
    20% 0,
    15% 60%,
    0 60%
  );
  opacity: 0;
  transform: scaleX(0.4);
  transform-origin: center;
  transition:
    opacity 0.25s ease,
    transform 0.3s ease;
}
.header-custom .main-nav > li > a:hover::after {
  opacity: 1;
  transform: scaleX(1);
}

/* ---------- دکمه CTA (ورود و ثبت‌نام پزشکان / خروج) — آخرین آیتم منو ---------- */
.header-custom .main-nav > li:last-child > a {
  background: var(--clinic-coral) !important;
  color: #fff !important;
  font-weight: 600;
  padding: 10px 20px !important;
  border-radius: 999px !important;
  box-shadow: 0 6px 16px -6px rgb(146 141 141 / 55%);
}
.header-custom .main-nav > li:last-child > a::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  margin-inline-start: 8px;
  animation: clinic-pulse 1.8s ease-in-out infinite;
  margin: 7px 0 0 8px;
}
.header-custom .main-nav > li:last-child > a::after {
  display: none;
}
.header-custom .main-nav > li:last-child > a:hover {
  background: var(--clinic-coral-dark) !important;
  box-shadow: 0 8px 20px -6px rgba(230, 87, 63, 0.6);
}

@keyframes clinic-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(255, 255, 255, 0);
  }
}

/* ---------- پنل منوی موبایل (off-canvas) ---------- */
.header-custom .main-menu-wrapper {
  background: var(
    --clinic-bg
  ) !important; /* پس‌زمینه‌ی روشن، حتی اگر تم اصلی پس‌زمینه‌ی تیره تعریف کرده باشد */
}
.header-custom .main-menu-wrapper .main-nav {
  background: var(--clinic-bg) !important;
}
.header-custom .main-menu-wrapper .main-nav > li > a {
  color: var(--clinic-ink) !important; /* متن تیره روی پس‌زمینه‌ی روشن */
}
.header-custom .main-menu-wrapper .main-nav > li:last-child > a {
  color: #fff; /* دکمه‌ی CTA همچنان متن سفید روی پس‌زمینه‌ی مرجانی دارد */
}
.header-custom .menu-header {
  background: var(--clinic-bg) !important;
  border-bottom: 1px solid var(--clinic-border);
  padding-bottom: 14px;
  margin-bottom: 10px;
}
.header-custom .menu-logo img {
  height: 36px;
}
.header-custom #menu_close {
  color: var(--clinic-ink);
  transition: color 0.2s ease;
}
.header-custom #menu_close:hover {
  color: var(--clinic-coral);
}

/* =========================================================
   ریسپانسیو — دسکتاپ / تبلت / موبایل
   بر اساس main.js واقعی قالب Doccure:
   - $('html').toggleClass('menu-opened')  -> کلاس روی <html>
   - $('.sidebar-overlay') مستقیم به <body> append می‌شود
     (خارج از هدر) و کلاس opened می‌گیرد/از دست می‌دهد
   - toggleClass('slide-nav') روی 'main-wrapper' در main.js باگ
     دارد (بدون نقطه، یعنی تگ) و عملاً هیچ‌جا اعمال نمی‌شود؛
     پس فقط از html.menu-opened و .sidebar-overlay.opened
     به‌عنوان hook واقعی استفاده می‌کنیم.
   ========================================================= */

/* جلوگیری از اسکرول پس‌زمینه وقتی منو باز است */
html.menu-opened {
  overflow: hidden;
}

/* وقتی منو باز است، کل هدر (به‌جز خود پنل منو) باید مثل بقیه‌ی صفحه تیره و غیرقابل‌کلیک باشد */
html.menu-opened .header-custom.header-fixed {
  pointer-events: none; /* اجازه می‌دهد کلیک روی نوار بالا از زیرش به sidebar-overlay واقعی برسد و منو بسته شود */
}
html.menu-opened .header-custom .main-menu-wrapper {
  pointer-events: auto; /* خود پنل منو باید کاملاً کلیک‌پذیر بماند */
}
html.menu-opened .header-custom .navbar-header {
  position: relative;
}
html.menu-opened .header-custom .navbar-header::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

/* ---------- دسکتاپ (≥ 992px) ---------- */
@media (min-width: 992px) {
  .header-custom #mobile_btn,
  .header-custom #search-btn {
    display: none;
  }

  .header-custom .navbar-header {
    display: flex;
    align-items: center;
  }
  .header-custom .main-menu-wrapper {
    display: block !important;
  }
  .header-custom .menu-header {
    display: none;
  }
}

/* ---------- تبلت (768px تا 991.98px) ---------- */
@media (min-width: 768px) and (max-width: 991.98px) {
  .header-custom .container {
    padding-inline: 16px;
  }
  .header-custom .navbar-brand.logo img {
    height: 40px;
    margin-top: 12px;
  }
  .header-custom .main-menu-wrapper {
    position: fixed;
    inset-block: 0;
    right: -320px;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    overflow-y: auto;
    background: var(--clinic-bg);
    box-shadow: -12px 0 40px -10px rgba(15, 61, 62, 0.25);
    padding: 20px;
    transition: right 0.32s ease;
    z-index: 1050; /* بالاتر از sidebar-overlay (1040) */
  }
  html.menu-opened .header-custom .main-menu-wrapper {
    right: 0;
  }

  .header-custom .main-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }
  .header-custom .main-nav > li > a {
    display: block;
    padding: 13px 12px !important;
    color: var(--clinic-ink);
  }
  .header-custom .main-nav > li:last-child > a {
    display: inline-flex;
    justify-content: center;
    margin-top: 10px;
  }
}

/* ---------- موبایل (≤ 767.98px) ---------- */
@media (max-width: 767.98px) {
  .header-custom .container {
    padding-inline: 12px;
  }

  .header-custom .navbar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .header-custom .navbar-brand.logo {
    margin-top: -16px !important;
  }
  .header-custom .navbar-brand.logo img {
    height: 34px;
  }

  .header-custom #mobile_btn,
  .header-custom #search-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  /* پنل منو تمام‌عرض روی موبایل، از سمت راست (RTL) باز می‌شود */
  .header-custom .main-menu-wrapper {
    position: fixed;
    inset-block: 0;
    right: -100%;
    width: 88%;
    max-width: 340px;
    height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--clinic-bg);
    box-shadow: -12px 0 40px -10px rgba(15, 61, 62, 0.3);
    padding: 18px 16px 32px;
    transition: right 0.3s ease;
    z-index: 1050; /* بالاتر از sidebar-overlay (1040) */
  }
  html.menu-opened .header-custom .main-menu-wrapper {
    right: 0;
  }

  .header-custom .menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .header-custom .menu-logo img {
    height: 32px;
  }
  .header-custom #menu_close {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--clinic-bg-soft);
  }

  .header-custom .main-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    margin-top: 8px;
  }
  .header-custom .main-nav > li > a {
    display: block;
    width: 100%;
    padding: 14px 12px !important;
    font-size: 15px;
    color: var(--clinic-ink);
    border-bottom: 1px solid var(--clinic-border);
    border-radius: 0;
  }
  .header-custom .main-nav > li > a::after {
    display: none;
  } /* خط ECG فقط برای هاور دسکتاپ */

  .header-custom .main-nav > li:last-child > a {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 14px;
    border-bottom: none;
  }
}

/* موبایل خیلی کوچک */
@media (max-width: 380px) {
  .header-custom .navbar-brand.logo img {
    height: 30px;
  }
  .header-custom #mobile_btn,
  .header-custom #search-btn {
    width: 36px;
    height: 36px;
  }
}

/* =========================================================
   sidebar-overlay — این عنصر خارج از هدر، مستقیم زیر <body>
   قرار می‌گیرد (توسط main.js ساخته می‌شود)، پس نباید سلکتورش
   را زیر .header-custom بنویسیم.
   ========================================================= */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 61, 62, 0.45);
  z-index: 1040; /* پایین‌تر از main-menu-wrapper (1050) */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}
.sidebar-overlay.opened {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

@media (max-width: 770px) {
  .header-custom .main-nav > li:last-child > a::before {
    display: none;
  }
}
@media (min-width: 568px) {
  .header-custom #mobile_btn,
  .header-custom #mobile_btn:hover,
  .header-custom #mobile_btn:active,
  .header-custom #mobile_btn:focus {
    transform: none !important;
  }
}
