/* ═══════════════════════════════════════════════════════════════
   GPB Header (top-menu.php)
   Loaded last in head.php so it wins over the RedStar theme rules.
   Desktop: white bar beside the brand-blue logo block.
   Mobile (< 992px): brand-blue sticky bar; the sidebar becomes a drawer (sidebar.css).
   ═══════════════════════════════════════════════════════════════ */

.gpb-header {
  --gpb-blue: var(--blue, #0d10cc);
  --gpb-green: var(--green, #187007);
  --gpb-orange: var(--orange, #FF6500);
  --gpb-ink: #1d2433;
  --gpb-text: #4a5267;
  --gpb-muted: #8a93a6;
  --gpb-line: #e8ebf1;
  --gpb-hover: #f3f5fa;
  --gpb-brand-gradient: linear-gradient(135deg, #0d10cc 0%, #0a0c9e 55%, #070a6b 100%);
}
.gpb-header .min-w-0 { min-width: 0; }

.page-header.navbar.gpb-header {
  min-height: 56px;
  background: #fff;
  border: 0;
  box-shadow: 0 1px 0 var(--gpb-line), 0 4px 16px rgba(16, 24, 40, .05);
}
.page-header.navbar .page-header-inner.gpb-platform-header {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  width: 100%;
  height: 56px;
  min-height: 56px;
  padding: 0 14px 0 0;
  text-align: left;
  overflow: visible;
}
/* Admin states: user swap / tier override */
.gpb-platform-header.gpb-hdr-swap { outline: 4px solid #c00; outline-offset: -4px; }
.gpb-platform-header.gpb-hdr-tier-override { outline: 4px solid orange; outline-offset: -4px; }

/* ── Logo block ── */
.page-header.navbar.gpb-header .gpb-platform-logo {
  flex: 0 0 auto;
  align-items: center;
  width: 235px;
  height: 56px;
  margin: 0 !important;
  padding: 0 16px !important;
  float: none;
  background: var(--gpb-brand-gradient);
  transition: width .2s ease;
}
.page-header.navbar .gpb-platform-logo > a,
.page-header.navbar .gpb-platform-mobile-logo > a { display: flex; align-items: center; min-width: 0; height: 100%; }
.page-header.navbar .gpb-platform-logo img.gpb-logo-full {
  display: block;
  width: auto;
  height: auto;
  max-width: 190px;
  max-height: 34px;
}
.page-header.navbar .gpb-platform-logo .gpb-logo-icon { display: none; width: 30px; height: auto; }

/* Collapsed sidebar: shrink to the 45px strip and show the icon */
@media (min-width: 992px) {
  .sidemenu-closed .page-header.navbar.gpb-header .gpb-platform-logo {
    width: 45px;
    padding: 0 !important;
    justify-content: center;
  }
  .sidemenu-closed .page-header.navbar .gpb-platform-logo img.gpb-logo-full { display: none; }
  .sidemenu-closed .page-header.navbar .gpb-platform-logo .gpb-logo-icon { display: block; }
}

/* ── Icon buttons ── */
.gpb-hdr-btn {
  position: relative;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  padding: 0 !important;
  border: 0;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--gpb-text) !important;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.gpb-hdr-btn:hover,
.gpb-hdr-btn:focus-visible,
.gpb-hdr-btn[aria-expanded="true"] {
  background: var(--gpb-hover);
  color: var(--gpb-blue) !important;
  outline: none;
}
.gpb-hdr-btn.gpb-desktop-sidebar-toggle { margin-left: 8px; }
.gpb-hdr-btn.gpb-hdr-warn { color: #d39200 !important; }
.gpb-hdr-play { background: var(--gpb-green); color: #fff !important; font-size: 13px; }
.gpb-hdr-play.is-active { background: var(--gpb-orange); }
.gpb-hdr-play:hover { color: #fff !important; filter: brightness(1.08); }

.gpb-hdr-count {
  position: absolute;
  top: 2px;
  right: 1px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: var(--gpb-orange);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  pointer-events: none;
}
.gpb-hdr-count-inline {
  margin-left: auto;
  background: var(--gpb-orange);
  color: #fff;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
}

/* ── Practice in progress pill ── */
.gpb-hdr-live {
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 440px;
  height: 36px;
  margin-left: 6px;
  padding: 0 4px 0 12px;
  border-radius: 999px;
  background: #fff6ef;
  border: 1px solid #ffdcc4;
  color: #c24d00;
  font-size: 12.5px;
  text-decoration: none;
  transition: box-shadow .15s ease;
}
.gpb-hdr-live:hover { color: #c24d00; box-shadow: 0 4px 14px rgba(255, 101, 0, .18); }
.gpb-hdr-live-label { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.gpb-hdr-live-name { color: var(--gpb-ink); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gpb-hdr-live-cta {
  flex-shrink: 0;
  background: var(--gpb-orange);
  color: #fff;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Right-hand actions ── */
.page-header.navbar .gpb-header-actions {
  display: flex !important;
  align-items: center;
  flex: 0 0 auto;
  float: none !important;
  height: 56px;
  margin: 0 0 0 auto !important;
  padding: 0 !important;
  width: auto !important;
}
.gpb-hdr-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.gpb-hdr-nav > li { position: relative; display: flex; align-items: center; }

/* Admin debug tier chip */
.gpb-hdr-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  margin-right: 4px;
  border-radius: 999px;
  border: 1px dashed #f0b9b5;
  background: #fff5f5;
  color: #d0342c;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.gpb-hdr-chip.is-override { background: #d0342c; border-style: solid; border-color: #d0342c; color: #fff; }

/* Account button */
.gpb-hdr-user {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: 4px;
  padding: 3px 10px 3px 3px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--gpb-ink);
  cursor: pointer;
  transition: background .15s ease;
}
.gpb-hdr-user:hover,
.gpb-hdr-user[aria-expanded="true"] { background: var(--gpb-hover); }
.gpb-hdr-user img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #cfd3ff;
}
.gpb-hdr-user-text { flex-direction: column; line-height: 1.15; text-align: left; }
.gpb-hdr-user-text strong { font-size: 13px; font-weight: 600; }
.gpb-hdr-user-text small { font-size: 11px; color: var(--gpb-muted); }
.gpb-hdr-user .fa-chevron-down { font-size: 10px; color: var(--gpb-muted); }

/* ── Dropdown menus ── */
.gpb-header .dropdown-menu.gpb-hdr-menu {
  min-width: 220px;
  margin-top: 8px !important;
  padding: 6px;
  border: 1px solid var(--gpb-line);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(16, 24, 40, .14);
  font-size: 13px;
  animation: gpb-menu-in .14s ease-out;
}
@keyframes gpb-menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .gpb-header .dropdown-menu.gpb-hdr-menu { animation: none; }
}
.gpb-header .gpb-hdr-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--gpb-text);
  font-size: 13px;
  white-space: nowrap;
}
.gpb-header .gpb-hdr-menu .dropdown-item i { width: 18px; text-align: center; color: var(--gpb-muted); }
.gpb-header .gpb-hdr-menu .dropdown-item:hover,
.gpb-header .gpb-hdr-menu .dropdown-item:focus { background: var(--gpb-hover); color: var(--gpb-ink); }
.gpb-header .gpb-hdr-menu .dropdown-item:hover i { color: var(--gpb-blue); }
.gpb-header .gpb-hdr-menu .dropdown-item.active { background: #eceeff; color: var(--gpb-blue); }
.gpb-header .gpb-hdr-menu .dropdown-divider { margin: 6px 4px; border-color: var(--gpb-line); }
.gpb-hdr-menu-label {
  padding: 6px 10px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gpb-muted);
}

/* Account menu */
.gpb-header .gpb-user-menu { width: 272px; }
.gpb-user-menu-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: -6px -6px 6px;
  padding: 14px 14px 13px;
  border-radius: 13px 13px 0 0;
  color: #fff;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 255, 255, .2), transparent 50%),
    var(--gpb-brand-gradient);
}
.gpb-user-menu-head img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .5);
  flex-shrink: 0;
}
.gpb-user-menu-head strong { display: block; font-size: 14px; line-height: 1.2; }
.gpb-user-menu-head span {
  display: block;
  font-size: 11.5px;
  opacity: .75;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gpb-user-menu-head em { display: inline-block; margin-top: 4px; font-style: normal; }
.gpb-header .gpb-hdr-menu .gpb-user-upgrade { color: #c24d00; font-weight: 600; }
.gpb-header .gpb-hdr-menu .gpb-user-upgrade i { color: var(--gpb-orange); }
.gpb-header .gpb-hdr-menu .gpb-user-logout:hover { background: #fdecea; color: #d0342c; }
.gpb-header .gpb-hdr-menu .gpb-user-logout:hover i { color: #d0342c; }

/* Notifications menu */
.gpb-header .dropdown-menu.gpb-notif-menu {
  width: 360px;
  max-width: calc(100vw - 16px);
  padding: 0;
  overflow: hidden;
}
.gpb-notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--gpb-line);
}
.gpb-notif-head strong { font-size: 14px; color: var(--gpb-ink); }
.gpb-notif-head a { font-size: 12px; font-weight: 500; color: var(--gpb-blue); }
.gpb-notif-list { max-height: 380px; overflow-y: auto; padding: 4px; }
.gpb-header .notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  white-space: normal;
  transition: background .12s ease;
}
.gpb-header .notif-item:hover,
.gpb-header .notif-item:focus-visible { background: var(--gpb-hover); outline: none; }
.gpb-header .notif-item.notif-unread { background: #f2f3ff; }
.gpb-header .notif-item.notif-unread:hover { background: #e9ebff; }
.gpb-notif-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--gpb-hover);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 13px;
}
.notif-unread .gpb-notif-icon { background: #fff; }
.gpb-notif-body { flex: 1; min-width: 0; }
.gpb-notif-title { font-size: 13px; line-height: 1.3; color: var(--gpb-ink); }
.notif-unread .gpb-notif-title { font-weight: 600; }
.gpb-notif-text { font-size: 12px; line-height: 1.35; color: var(--gpb-muted); margin-top: 2px; }
.gpb-notif-time { font-size: 11px; color: #a0a7b6; margin-top: 3px; }
.notif-dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--gpb-blue); flex-shrink: 0; }
.gpb-notif-empty { text-align: center; padding: 32px 16px; color: var(--gpb-muted); font-size: 13px; }
.gpb-notif-empty i { display: block; font-size: 22px; margin-bottom: 8px; opacity: .5; }
.gpb-notif-foot {
  display: block;
  padding: 10px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gpb-blue);
  background: #fafbfd;
  border-top: 1px solid var(--gpb-line);
  text-decoration: none;
}
.gpb-notif-foot:hover { background: var(--gpb-hover); color: var(--gpb-blue); }

/* App download menu */
.gpb-header .portal-app-links-menu { width: 17rem; max-width: calc(100vw - 1.5rem); padding: .8rem; }
.portal-app-links-header { padding: .15rem .2rem .65rem; }
.portal-app-links-title { display: block; font-size: .9rem; font-weight: 700; color: #102a43; }
.portal-app-links-copy { display: block; margin-top: .2rem; font-size: .78rem; line-height: 1.4; color: #607086; }
.portal-app-links-item + .portal-app-links-item { margin-top: .55rem; }
.portal-app-badge-link {
  display: block;
  padding: .35rem;
  border-radius: .95rem;
  border: 1px solid #d8e3f0;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.portal-app-badge-link:hover,
.portal-app-badge-link:focus {
  border-color: #b7cae2;
  box-shadow: 0 14px 28px rgba(15, 23, 42, .12);
  transform: translateY(-1px);
}
.portal-app-badge { display: block; width: 100%; height: auto; border-radius: .75rem; }

/* ══════════════════════════════════════════════════════════════
   MOBILE / TABLET (< 992px): brand-blue sticky bar
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 991.98px) {
  .page-header.navbar.gpb-header {
    position: sticky !important;
    top: 0;
    z-index: 1030;
    background:
      radial-gradient(circle at 100% 0%, rgba(255, 255, 255, .16), transparent 40%),
      var(--gpb-brand-gradient);
    box-shadow: 0 4px 16px rgba(13, 16, 204, .25);
  }
  .page-header.navbar .page-header-inner.gpb-platform-header { padding: 0 8px; gap: 4px; }

  .page-header.navbar .gpb-platform-mobile-logo {
    display: flex !important;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    height: 56px;
    margin: 0 !important;
    padding: 0 6px;
    overflow: hidden;
  }
  .page-header.navbar .gpb-platform-mobile-logo img {
    display: block;
    width: auto;
    max-height: 30px;
    max-width: clamp(96px, 38vw, 170px);
  }

  .gpb-header .gpb-hdr-btn { color: #fff !important; }
  .gpb-header .gpb-hdr-btn:hover,
  .gpb-header .gpb-hdr-btn:focus-visible,
  .gpb-header .gpb-hdr-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .16); color: #fff !important; }
  .gpb-header .gpb-mobile-sidebar-toggle { background: rgba(255, 255, 255, .14); font-size: 17px; }
  .gpb-header .gpb-hdr-play { margin-right: 2px; box-shadow: 0 4px 12px rgba(0, 0, 0, .2); }
  .gpb-header .gpb-hdr-count { border-color: #0a0c9e; }
  .gpb-header .gpb-hdr-chip { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .35); color: #fff; padding: 0 9px; }
  .gpb-header .gpb-hdr-user { padding: 3px; margin-left: 2px; }
  .gpb-header .gpb-hdr-user:hover,
  .gpb-header .gpb-hdr-user[aria-expanded="true"] { background: rgba(255, 255, 255, .16); }
  .gpb-header .gpb-hdr-user img { box-shadow: 0 0 0 2px rgba(255, 255, 255, .55); }
}

@media (max-width: 400px) {
  .page-header.navbar .page-header-inner.gpb-platform-header { padding: 0 4px; gap: 2px; }
  .gpb-header .gpb-hdr-btn { width: 36px; height: 36px; }
}
