/* ==========================================================================
   Site header — Medics Online Academy
   Markup: templates/header.html     Script: js/site_header.js

   Isolation contract
   - Every selector starts with #mhp-site-header, so nothing here can style
     the rest of the page.
   - The reset below reverts any page/legacy CSS (bare `nav`, `button`, `a`,
     `*` rules, LMS Sass, etc.) on header elements back to browser defaults,
     so the header looks identical on every page. SVG internals are skipped
     so icon presentation attributes keep working.
   - Units are px so the page's root font-size cannot rescale the header.
   ========================================================================== */

/* Private font alias: the header/footer use "MHP Montserrat" so that loading it can never
   change how page content that names plain "Montserrat" renders (some pages only load
   certain Montserrat weights and rely on the browser's fallback for the others).
   Same files Google Fonts serves for Montserrat (variable font, weights 400-800). */
@font-face {
  font-family: "MHP Montserrat";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/montserrat/v31/JTUSjIg1_i6t8kCHKm459Wdhyzbi.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "MHP Montserrat";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/montserrat/v31/JTUSjIg1_i6t8kCHKm459Wlhyw.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


#mhp-site-header,
#mhp-site-header :where(*:not(svg, svg *)),
#mhp-site-header :where(*:not(svg, svg *))::before,
#mhp-site-header :where(*:not(svg, svg *))::after {
  all: revert;
  box-sizing: border-box;
}
#mhp-site-header [hidden] { display: none !important; }

/* Some legacy page stylesheets set typography with !important on bare elements
   (e.g. `h2 { font-family: Roboto !important }`, `button { font-family: Inter !important }`).
   Pin it here, scoped to this component only. */
#mhp-site-header :where(*:not(svg, svg *)) {
  font-size: inherit !important;
  line-height: inherit !important;
  font-weight: inherit !important;
}
#mhp-site-header,
#mhp-site-header :where(*:not(svg, svg *)) {
  font-family: "MHP Montserrat", "Segoe UI", Arial, sans-serif !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  text-shadow: none !important;
}

#mhp-site-header {
  --mhp-red: #ee343b;
  --mhp-red-dark: #c92830;
  --mhp-red-soft: #fff0f1;
  --mhp-ink: #171717;
  position: sticky;
  top: 0;
  z-index: 1000;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  background: #fff;
  border-bottom: 1px solid #eee;
  box-shadow: none;
  color: var(--mhp-ink);
  font-family: "MHP Montserrat", "Segoe UI", Arial, sans-serif;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
  letter-spacing: normal;
  text-align: left;
  text-transform: none;
  -webkit-font-smoothing: antialiased;
}
#mhp-site-header a { color: inherit; text-decoration: none; cursor: pointer; }
#mhp-site-header button { font: inherit; color: inherit; cursor: pointer; }
#mhp-site-header :focus-visible { outline: 3px solid var(--mhp-red); outline-offset: 3px; }
#mhp-site-header .mhp-sh-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
#mhp-site-header .mhp-sh-icon { display: block; width: 22px; height: 22px; flex: 0 0 auto; }

/* ---------- Bar ---------- */
#mhp-site-header .mhp-sh-container { width: min(1640px, 85.4167%); margin: 0 auto; }
#mhp-site-header .mhp-sh-bar { position: relative; display: flex; align-items: center; gap: 14px; height: 108px; }
#mhp-site-header .mhp-sh-logo { display: flex; align-items: center; flex: 0 0 auto; width: 250px; }
#mhp-site-header .mhp-sh-logo-img { display: block; width: 100%; max-width: 100%; height: auto; border: 0; }

/* ---------- Primary navigation ---------- */
#mhp-site-header .mhp-sh-nav {
  display: flex; align-items: center; gap: 40px; margin: 0 0 0 auto; padding: 0;
  background: transparent; box-shadow: none; position: static;
}
#mhp-site-header .mhp-sh-link,
#mhp-site-header .mhp-sh-trigger {
  display: inline-flex; align-items: center; padding: 12px 0; margin: 0;
  border: 0; background: transparent; box-shadow: none; text-shadow: none;
  font-size: 13px !important; font-weight: 500 !important; line-height: 1.4 !important; white-space: nowrap;
  transition: color .2s ease;
}
#mhp-site-header .mhp-sh-link:hover,
#mhp-site-header .mhp-sh-trigger:hover,
#mhp-site-header .mhp-sh-trigger[aria-expanded="true"] { color: var(--mhp-red); }
#mhp-site-header .mhp-sh-dropdown { position: relative; flex: 0 0 auto; }

/* Dropdown panels (nav + user menu share the link styling) */
#mhp-site-header .mhp-sh-panel,
#mhp-site-header .mhp-sh-user-menu {
  display: none; position: absolute; top: 100%; z-index: 20;
  min-width: 245px; padding: 8px; margin: 0;
  background: #fff; border: 1px solid #f0f0f0; border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .13);
}
#mhp-site-header .mhp-sh-panel { left: -18px; }
#mhp-site-header .mhp-sh-dropdown.is-open > .mhp-sh-panel { display: block; }
#mhp-site-header .mhp-sh-panel-link {
  display: block; padding: 11px 14px; border-radius: 6px;
  font-size: 13px !important; font-weight: 500 !important; line-height: 1.35 !important; color: #242424; white-space: nowrap;
}
#mhp-site-header .mhp-sh-panel-link:hover,
#mhp-site-header .mhp-sh-panel-link:focus-visible { background: var(--mhp-red-soft); color: var(--mhp-red); outline: none; }
#mhp-site-header .mhp-sh-panel-link--danger { color: var(--mhp-red); font-weight: 600 !important; }
#mhp-site-header .mhp-sh-panel-label {
  display: block; padding: 10px 14px 4px; font-size: 10px !important; font-weight: 700 !important;
  letter-spacing: .08em !important; text-transform: uppercase !important; color: #999;
}
#mhp-site-header .mhp-sh-panel-sep { display: block; height: 1px; margin: 6px 8px; background: #f0f0f0; }

/* Search inside the mobile menu only */
#mhp-site-header .mhp-sh-nav-search { display: none; }

/* ---------- Right-hand actions ---------- */
#mhp-site-header .mhp-sh-actions { display: flex; align-items: center; gap: 16px; flex: 0 0 auto; margin-left: 30px; }
#mhp-site-header .mhp-sh-search-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px; margin: 0; border: 0; border-radius: 50%; background: transparent; color: #181818;
}
#mhp-site-header .mhp-sh-search-toggle:hover { color: var(--mhp-red); }
#mhp-site-header .mhp-sh-search,
#mhp-site-header .mhp-sh-nav-search { align-items: center; gap: 6px; margin: 0; }
#mhp-site-header .mhp-sh-search { display: flex; width: 280px; }
#mhp-site-header .mhp-sh-input {
  flex: 1; min-width: 0; width: auto; height: 38px; margin: 0; padding: 6px 10px;
  border: 1px solid #d8d8d8; border-radius: 6px; background: #fff; box-shadow: none;
  color: #222; font: inherit; font-size: 12px !important; outline: none;
}
#mhp-site-header .mhp-sh-input:focus { border-color: var(--mhp-red); box-shadow: 0 0 0 2px rgba(238, 52, 59, .1); }
#mhp-site-header .mhp-sh-search-submit {
  flex: 0 0 auto; height: 38px; margin: 0; padding: 0 12px; border: 0; border-radius: 6px;
  background: var(--mhp-red); background-image: none; box-shadow: none; text-shadow: none;
  color: #fff; font-size: 12px !important; font-weight: 600 !important;
}
#mhp-site-header .mhp-sh-search-submit:hover { background: var(--mhp-red-dark); }
#mhp-site-header .mhp-sh-search-close {
  flex: 0 0 auto; min-width: 22px; margin: 0; padding: 2px 4px; border: 0; background: transparent;
  font-size: 22px !important; line-height: 1 !important; color: #333;
}
#mhp-site-header.is-search-open .mhp-sh-search-toggle { display: none; }

#mhp-site-header .mhp-sh-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 24px; border: 1px solid transparent; border-radius: 5px;
  background: var(--mhp-red); color: #fff; font-size: 13px !important; font-weight: 650 !important; line-height: 1.2 !important; white-space: nowrap;
  transition: transform .28s ease, box-shadow .28s ease, background-color .25s ease;
}
#mhp-site-header .mhp-sh-btn:hover { background: #d9202b; transform: translateY(-2px); box-shadow: 0 7px 17px rgba(238, 52, 59, .17); }

/* ---------- Signed-in user menu ---------- */
#mhp-site-header .mhp-sh-user { position: relative; flex: 0 0 auto; }
#mhp-site-header .mhp-sh-user-toggle {
  display: inline-flex; align-items: center; gap: 9px; max-width: 230px;
  margin: 0; padding: 4px 10px 4px 4px; border: 1px solid #e6e6e6; border-radius: 999px;
  background: #fff; box-shadow: none; text-shadow: none;
  font-size: 13px !important; font-weight: 600 !important; transition: border-color .2s ease, box-shadow .2s ease;
}
#mhp-site-header .mhp-sh-user-toggle:hover,
#mhp-site-header .mhp-sh-user-toggle[aria-expanded="true"] { border-color: var(--mhp-red); box-shadow: 0 3px 10px rgba(238, 52, 59, .12); }
#mhp-site-header .mhp-sh-avatar {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: var(--mhp-red); color: #fff;
}
#mhp-site-header .mhp-sh-avatar-initials { font-size: 13px !important; font-weight: 700 !important; letter-spacing: .02em !important; }
#mhp-site-header .mhp-sh-avatar-img {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  object-fit: cover; border: 0; border-radius: 50%; background: #fff;
}
#mhp-site-header .mhp-sh-user-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#mhp-site-header .mhp-sh-chevron { display: block; width: 16px; height: 16px; flex: 0 0 auto; color: var(--mhp-red); transition: transform .2s ease; }
#mhp-site-header .mhp-sh-user-toggle[aria-expanded="true"] .mhp-sh-chevron { transform: rotate(180deg); }
#mhp-site-header .mhp-sh-user-menu { right: 0; min-width: 240px; margin-top: 8px; }
#mhp-site-header .mhp-sh-user.is-open > .mhp-sh-user-menu { display: block; }
#mhp-site-header .mhp-sh-user-head { display: block; padding: 10px 14px 12px; margin-bottom: 6px; border-bottom: 1px solid #f0f0f0; }
#mhp-site-header .mhp-sh-user-head-name { display: block; font-size: 14px !important; font-weight: 700 !important; color: #111; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#mhp-site-header .mhp-sh-user-head-meta { display: block; margin-top: 2px; font-size: 12px !important; color: #777; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Mobile menu toggle (hidden on desktop) ---------- */
#mhp-site-header .mhp-sh-menu-toggle {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin: 0; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: #181818;
}
#mhp-site-header .mhp-sh-menu-toggle .mhp-sh-icon { width: 26px; height: 26px; }
#mhp-site-header .mhp-sh-icon--close,
#mhp-site-header.is-menu-open .mhp-sh-icon--open { display: none; }
#mhp-site-header.is-menu-open .mhp-sh-icon--close { display: block; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (min-width: 1025px) {
  #mhp-site-header .mhp-sh-dropdown:hover > .mhp-sh-panel,
  #mhp-site-header .mhp-sh-dropdown:focus-within > .mhp-sh-panel { display: block; }
  #mhp-site-header .mhp-sh-dropdown:hover > .mhp-sh-trigger { color: var(--mhp-red); }
  /* bridge so the pointer can travel from trigger to panel */
  #mhp-site-header .mhp-sh-panel::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
}
@media (max-width: 1440px) {
  #mhp-site-header .mhp-sh-nav { gap: 28px; }
  #mhp-site-header .mhp-sh-user-name { max-width: 120px; }
}
@media (max-width: 1280px) {
  #mhp-site-header .mhp-sh-container { width: 92%; }
  #mhp-site-header .mhp-sh-bar { height: 92px; }
  #mhp-site-header .mhp-sh-logo { width: 200px; }
  #mhp-site-header .mhp-sh-nav { gap: 20px; }
  #mhp-site-header .mhp-sh-actions { margin-left: 16px; gap: 12px; }
  #mhp-site-header .mhp-sh-search { width: 220px; }
  #mhp-site-header.is-search-open .mhp-sh-nav { gap: 14px; }
  #mhp-site-header.is-search-open .mhp-sh-link,
  #mhp-site-header.is-search-open .mhp-sh-trigger { font-size: 12px !important; }
}

/* Tablet & mobile: collapsible menu */
@media (max-width: 1024px) {
  /* static bar => the menu is positioned against the (sticky) header root and spans full width */
  #mhp-site-header .mhp-sh-bar { position: static; height: 72px; gap: 8px; }
  #mhp-site-header .mhp-sh-logo { width: 170px; }
  #mhp-site-header .mhp-sh-menu-toggle { display: inline-flex; order: 3; }
  #mhp-site-header .mhp-sh-actions { margin-left: auto; gap: 8px; }
  #mhp-site-header .mhp-sh-search-toggle,
  #mhp-site-header .mhp-sh-search { display: none !important; }

  #mhp-site-header .mhp-sh-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; margin: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    max-height: calc(100vh - 72px); max-height: calc(100dvh - 72px); overflow-y: auto; overscroll-behavior: contain;
    padding: 6px 4% 20px; background: #fff; border-top: 1px solid #eee;
    box-shadow: 0 16px 24px rgba(0, 0, 0, .12);
  }
  #mhp-site-header.is-menu-open .mhp-sh-nav { display: flex; }
  #mhp-site-header .mhp-sh-link,
  #mhp-site-header .mhp-sh-trigger { width: 100%; padding: 14px 0; font-size: 15px !important; border-bottom: 1px solid #f3f3f3; }
  #mhp-site-header .mhp-sh-dropdown { width: 100%; }
  #mhp-site-header .mhp-sh-trigger { justify-content: space-between; border-radius: 0; }
  #mhp-site-header .mhp-sh-trigger::after { content: "+"; font-size: 20px !important; line-height: 1 !important; color: var(--mhp-red); }
  #mhp-site-header .mhp-sh-trigger[aria-expanded="true"]::after { content: "\2212"; }
  #mhp-site-header .mhp-sh-panel {
    position: static; min-width: 0; margin: 4px 0 10px; padding: 2px 0 2px 12px;
    border: 0; border-left: 2px solid var(--mhp-red); border-radius: 0; box-shadow: none;
  }
  #mhp-site-header .mhp-sh-panel-link { white-space: normal; font-size: 14px !important; padding: 10px 12px; }
  #mhp-site-header .mhp-sh-nav-search { display: flex; order: -1; padding: 12px 0 8px; }
  #mhp-site-header .mhp-sh-nav-search .mhp-sh-input { height: 42px; font-size: 14px !important; }
  #mhp-site-header .mhp-sh-nav-search .mhp-sh-search-submit { height: 42px; padding: 0 16px; font-size: 13px !important; }
}
@media (max-width: 760px) {
  #mhp-site-header .mhp-sh-bar { height: 64px; }
  #mhp-site-header .mhp-sh-logo { width: 140px; }
  #mhp-site-header .mhp-sh-nav { max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); }
  #mhp-site-header .mhp-sh-btn { padding: 9px 14px; font-size: 12px !important; }
  /* user menu collapses to the avatar */
  #mhp-site-header .mhp-sh-user-toggle { padding: 3px; gap: 4px; border-radius: 999px; }
  #mhp-site-header .mhp-sh-user-name { display: none; }
  #mhp-site-header .mhp-sh-chevron { width: 14px; height: 14px; margin-right: 4px; }
  #mhp-site-header .mhp-sh-avatar { width: 34px; height: 34px; }
  #mhp-site-header .mhp-sh-user-menu {
    position: fixed; top: 64px; left: 4vw; right: 4vw; min-width: 0; margin-top: 6px;
    max-height: calc(100vh - 80px); overflow-y: auto;
  }
}
@media (max-width: 360px) {
  #mhp-site-header .mhp-sh-logo { width: 118px; }
  #mhp-site-header .mhp-sh-btn { padding: 8px 11px; }
}
@media (prefers-reduced-motion: reduce) {
  #mhp-site-header *, #mhp-site-header *::before, #mhp-site-header *::after { transition: none !important; }
}
@media print {
  #mhp-site-header { position: static; }
  #mhp-site-header .mhp-sh-nav, #mhp-site-header .mhp-sh-actions, #mhp-site-header .mhp-sh-menu-toggle { display: none !important; }
}
