/* ── Portal top header: SaaS dashboard design ────────────────────────────────────
   Shared by the admin panel and the therapist portal (montherapy.pk/assets/portal/), loaded by
   their includes/header.php when ADMIN_HEADER_STYLE / PORTAL_HEADER_STYLE is 'saas'. Every rule
   is scoped to .header.hd-saas (or what follows it), so 'classic' brings back the old header.
   The brand block matches the sidebar width: set --portal-sidebar-w when it is not 255px. */

.header.hd-saas {
  --hd-ink: #1f2b1a;
  --hd-text: #445040;
  --hd-muted: #8b9586;
  --hd-line: #edf0ea;
  --hd-soft: #f4f7f1;
  --hd-accent: #556F44;
  --hd-pink: #df5593;
  height: 64px;
  padding: 0 20px 0 0;
  background: rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: saturate(160%) blur(8px);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--hd-line);
  box-shadow: 0 1px 2px rgba(31, 43, 26, .04);
}

/* The page and the sidebar start right under the 64px header */
.header.hd-saas ~ .sidebar { top: 64px; }
.header.hd-saas ~ #main { margin-top: 64px; }

/* Brand: lines up with the 255px sidebar below it */
.header.hd-saas .logo {
  width: auto;
  height: 64px;
  padding: 0 18px;
  gap: 10px;
}
@media (min-width: 1200px) {
  .header.hd-saas .logo { width: var(--portal-sidebar-w, 255px); border-right: 1px solid var(--hd-line); }
}
.header.hd-saas .logo img {
  width: 36px;
  height: 36px;
  max-height: none;
  margin: 0;
  padding: 5px;
  border-radius: 10px;
  background: var(--hd-accent);
  object-fit: contain;
  box-shadow: 0 2px 6px rgba(85, 111, 68, .25);
}
.header.hd-saas .logo span {
  color: var(--hd-ink);
  font-family: Inter, 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.01em;
}
.header.hd-saas .toggle-sidebar-btn {
  margin-left: 4px;
  padding: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--hd-text);
  font-size: 24px;
  line-height: 38px;
  text-align: center;
}
.header.hd-saas .toggle-sidebar-btn:hover { background: var(--hd-soft); }

/* Search */
.header.hd-saas .search-bar { min-width: 380px; padding: 0 24px; }
.header.hd-saas .search-form { position: relative; }
.header.hd-saas .hd-search-ic {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--hd-muted);
  font-size: 14px;
  pointer-events: none;
}
.header.hd-saas .search-form input {
  height: 40px;
  padding: 0 14px 0 36px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--hd-soft);
  color: var(--hd-ink);
  font-size: 13.5px;
  box-shadow: none;
}
.header.hd-saas .search-form input::placeholder { color: var(--hd-muted); }
.header.hd-saas .search-form input:hover { border-color: var(--hd-line); box-shadow: none; }
.header.hd-saas .search-form input:focus {
  background: #fff;
  border-color: rgba(85, 111, 68, .45);
  box-shadow: 0 0 0 3px rgba(85, 111, 68, .12);
}
.header.hd-saas .search-form button { display: none; }
@media (max-width: 1199px) {
  .header.hd-saas .search-bar { top: 64px; min-width: 0; }
}

/* Right side */
.header.hd-saas .header-nav { padding-right: 0 !important; }
.header.hd-saas .header-nav > ul { gap: 10px; }
.header.hd-saas .sc-open-btn { margin-right: 4px; height: 38px; padding: 0 14px; border-radius: 10px; }

.header.hd-saas .header-nav .nav-icon {
  width: 38px;
  height: 38px;
  margin: 0;
  border: 1px solid var(--hd-line);
  border-radius: 10px;
  background: #fff;
  color: var(--hd-text);
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.header.hd-saas .header-nav .nav-icon:hover { background: var(--hd-soft); color: var(--hd-accent); }
.header.hd-saas .header-nav .badge-number {
  inset: -6px -6px auto auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--hd-pink) !important;
  font-size: 10px;
  font-weight: 700;
  line-height: 14px;
}

/* Profile menu */
.header.hd-saas .hd-profile {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 4px 4px;
  border: 1px solid var(--hd-line);
  border-radius: 12px;
  color: var(--hd-ink);
  text-decoration: none;
  transition: background .15s;
}
.header.hd-saas .hd-profile:hover { background: var(--hd-soft); }
.header.hd-saas .hd-av {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: var(--hd-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.header.hd-saas .hd-av img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.header.hd-saas .hd-who { flex-direction: column; line-height: 1.15; max-width: 150px; }
.header.hd-saas .hd-who b { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header.hd-saas .hd-who i { font-size: 11px; font-style: normal; color: var(--hd-muted); }
.header.hd-saas .hd-chev { color: var(--hd-muted); font-size: 12px; }
.header.hd-saas .hd-menu {
  min-width: 230px;
  margin-top: 8px !important;
  padding: 6px;
  border: 1px solid var(--hd-line);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(31, 42, 23, .14), 0 2px 8px rgba(31, 42, 23, .05);
}
.header.hd-saas .hd-menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--hd-line); margin-bottom: 4px; }
.header.hd-saas .hd-menu-head b { display: block; color: var(--hd-ink); font-size: 13.5px; }
.header.hd-saas .hd-menu-head i { display: block; color: var(--hd-muted); font-size: 11.5px; font-style: normal; }
.header.hd-saas .hd-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--hd-text);
  font-size: 13px;
  font-weight: 600;
}
.header.hd-saas .hd-menu .dropdown-item i { color: var(--hd-muted); font-size: 15px; width: 16px; text-align: center; }
.header.hd-saas .hd-menu .dropdown-item:hover { background: var(--hd-soft); color: var(--hd-ink); }
.header.hd-saas .hd-menu .dropdown-item:hover i { color: var(--hd-accent); }
.header.hd-saas .hd-menu .hd-logout:hover { background: #fdecef; color: #b3261e; }
.header.hd-saas .hd-menu .hd-logout:hover i { color: #b3261e; }
.header.hd-saas .hd-menu .dropdown-divider { margin: 4px 0; border-color: var(--hd-line); }

@media (max-width: 575px) {
  .header.hd-saas { padding-right: 10px; }
  .header.hd-saas .logo { padding: 0 10px; }
  .header.hd-saas .header-nav > ul { gap: 6px; }
}
