/* =====================================================
   HEADER (logged-in B2B panel), premium pass
   Markup: app/Views/template/home-header.php
   Top bar (agency, wallet, user) + main bar (logo, menu)
   + mobile drawer. Colours come from theme.css tokens.
   Previous version: header_bkp_22102026.css
===================================================== */

/* local tokens: tweak the header look from one place */
.header {
  --hdr-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --hdr-fs-xs: 12px;
  --hdr-fs-sm: 13px;
  --hdr-fs-md: 14px;
  --hdr-top-h: 42px;
  --hdr-main-h: 76px;
  --hdr-shadow-pop: 0 2px 4px rgba(15, 27, 51, 0.06), 0 24px 48px -16px rgba(15, 27, 51, 0.32);

  position: relative;
  z-index: 1030;
  font-family: inherit;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* one container for every header row, so edges line up */
.hdr-container {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
}

/* consistent keyboard focus across the header */
.header a:focus-visible,
.header button:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

/* -----------------------------------------------------
   TOP BAR
----------------------------------------------------- */
.hdr-top {
  color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(100deg, var(--primary-deep) 0%, var(--primary-dark) 55%, var(--primary) 130%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.hdr-top .hdr-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--hdr-top-h);
}

.hdr-top__greet {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: var(--hdr-fs-sm);
  line-height: 1.2;
  white-space: nowrap;
}

.hdr-top__greet>i {
  font-size: var(--hdr-fs-sm);
  opacity: 0.75;
}

.hdr-top__greet strong {
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.005em;
}

.hdr-top__id {
  padding: 3px 10px;
  font-size: var(--hdr-fs-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

.hdr-top__links {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* :where keeps this reset at zero specificity so component colours win */
:where(.hdr-top) a {
  color: inherit;
  text-decoration: none;
}

.hdr-wallet,
.hdr-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  font-size: var(--hdr-fs-sm);
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  transition: background 0.25s var(--hdr-ease), border-color 0.25s var(--hdr-ease);
}

.hdr-wallet {
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.hdr-wallet__label {
  font-weight: 500;
  opacity: 0.8;
}

.hdr-wallet:hover,
.hdr-user:hover,
.hdr-wallet[aria-expanded="true"],
.hdr-user[aria-expanded="true"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
}

.hdr-user {
  padding-left: 4px;
}

.hdr-avatar {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: var(--hdr-fs-xs);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--on-secondary);
  background: var(--secondary);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22);
}

.hdr-caret {
  font-size: 9px;
  opacity: 0.75;
  transition: transform 0.25s var(--hdr-ease);
}

[aria-expanded="true"]>.hdr-caret {
  transform: rotate(180deg);
}

/* top-bar dropdowns (Bootstrap click dropdowns) */
.hdr-dropdown.dropdown-menu {
  min-width: 250px;
  margin-top: 8px !important;
  padding: 8px;
  font-size: var(--hdr-fs-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--hdr-shadow-pop);
}

.hdr-dropdown .dropdown-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  font-size: var(--hdr-fs-md);
  font-weight: 800;
  letter-spacing: -0.005em;
  color: var(--heading);
  background: var(--primary-soft);
  border-radius: 10px;
}

.hdr-dropdown .dropdown-header span {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.hdr-dropdown .dropdown-divider {
  margin: 6px 0;
  border-color: var(--border);
}

.hdr-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 10px 14px;
  font-weight: 500;
  color: var(--heading);
  border-radius: 10px;
  transition: background 0.2s var(--hdr-ease), color 0.2s var(--hdr-ease);
}

.hdr-dropdown .dropdown-item i {
  width: 22px;
  color: var(--text-muted);
  transition: color 0.2s var(--hdr-ease);
}

.hdr-dropdown .dropdown-item:hover,
.hdr-dropdown .dropdown-item:focus {
  color: var(--primary);
  background: var(--primary-soft);
}

.hdr-dropdown .dropdown-item:hover i {
  color: var(--primary);
}

.hdr-dropdown .dropdown-item.text-danger,
.hdr-dropdown .dropdown-item.text-danger i {
  color: var(--danger) !important;
}

.hdr-dropdown .dropdown-item.text-danger:hover {
  background: color-mix(in srgb, var(--danger), #fff 92%);
}

/* -----------------------------------------------------
   MAIN BAR
----------------------------------------------------- */
.hdr-main {
  position: relative;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15, 27, 51, 0.04), 0 10px 28px -22px rgba(15, 27, 51, 0.5);
}

.hdr-main__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: var(--hdr-main-h);
}

.hdr-logo {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
}

.hdr-logo img {
  display: block;
  width: auto;
  max-width: 180px;
  max-height: 46px;
}

.hdr-main__end {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.hdr-agent-logo {
  display: inline-flex;
  align-items: center;
  padding-left: 18px;
  border-left: 1px solid var(--border);
}

.hdr-agent-logo img {
  display: block;
  width: auto;
  max-width: 150px;
  max-height: 38px;
}

/* --- desktop menu --- */
.main-menu {
  flex: 1 1 auto;
  min-width: 0;
}

.main-menu ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.main-menu>ul {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.main-menu>ul>li {
  position: relative;
}

.main-menu>ul>li>a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--hdr-main-h);
  padding: 0 10px;
  font-size: var(--hdr-fs-md);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.005em;
  color: var(--heading);
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.25s var(--hdr-ease);
}

/* chevron drawn with borders: no icon-font dependency */
.main-menu>ul>li.menu-item-has-children>a::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  opacity: 0.55;
  transform: rotate(45deg);
  transition: transform 0.25s var(--hdr-ease), margin 0.25s var(--hdr-ease);
}

.main-menu>ul>li:hover>a::after,
.main-menu>ul>li:focus-within>a::after {
  margin-top: 3px;
  transform: rotate(-135deg);
}

/* active / hover underline */
.main-menu>ul>li>a::before {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 16px;
  height: 3px;
  background: var(--secondary);
  border-radius: 3px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--hdr-ease);
}

.main-menu>ul>li:hover>a,
.main-menu>ul>li:focus-within>a,
.main-menu>ul>li>a.active {
  color: var(--primary);
}

.main-menu>ul>li:hover>a::before,
.main-menu>ul>li:focus-within>a::before,
.main-menu>ul>li>a.active::before {
  transform: scaleX(1);
}

/* dropdown */
.main-menu .sub-menu {
  position: absolute;
  top: calc(100% - 14px);
  left: 0;
  z-index: 1000;
  min-width: 240px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--hdr-shadow-pop);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.25s var(--hdr-ease), transform 0.25s var(--hdr-ease), visibility 0.25s var(--hdr-ease);
}

/* invisible bridge so the pointer never loses hover between link and panel */
.main-menu .sub-menu::before {
  content: "";
  position: absolute;
  top: -14px;
  left: 0;
  right: 0;
  height: 14px;
}

.main-menu li:hover>.sub-menu,
.main-menu li:focus-within>.sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.main-menu>ul>li:nth-last-child(-n + 2)>.sub-menu {
  left: auto;
  right: 0;
}

.main-menu .sub-menu li a {
  display: block;
  padding: 10px 14px;
  font-size: var(--hdr-fs-sm);
  font-weight: 500;
  line-height: 1.3;
  color: var(--heading);
  white-space: nowrap;
  text-decoration: none;
  border-radius: 10px;
  transition: background 0.2s var(--hdr-ease), color 0.2s var(--hdr-ease), padding 0.2s var(--hdr-ease);
}

.main-menu .sub-menu li a:hover {
  padding-left: 18px;
  color: var(--primary);
  background: var(--primary-soft);
}

/* call-to-action in the public header (login / register pages) */
.hdr-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  font-size: var(--hdr-fs-md);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.005em;
  color: var(--on-secondary);
  text-decoration: none;
  background: var(--secondary);
  border-radius: 12px;
  box-shadow: 0 10px 20px -12px var(--secondary);
  transition: background 0.25s var(--hdr-ease), transform 0.25s var(--hdr-ease), box-shadow 0.25s var(--hdr-ease);
}

.hdr-cta:hover {
  color: var(--on-secondary);
  background: var(--secondary-dark);
  transform: translateY(-1px);
  box-shadow: 0 14px 24px -12px var(--secondary);
}

/* burger */
.hdr-burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 18px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 0;
  border-radius: 12px;
  transition: background 0.25s var(--hdr-ease), color 0.25s var(--hdr-ease);
}

.hdr-burger:hover {
  color: var(--on-primary);
  background: var(--primary);
}

/* -----------------------------------------------------
   MOBILE DRAWER (.open toggled by the script in home-header.php)
----------------------------------------------------- */
.th-menu-wrapper {
  position: fixed;
  inset: 0;
  z-index: 1060;
  background: rgba(6, 14, 30, 0.5);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--hdr-ease), visibility 0.3s var(--hdr-ease);
}

.th-menu-wrapper.open {
  opacity: 1;
  visibility: visible;
}

.th-menu-area {
  position: relative;
  width: 330px;
  max-width: 88vw;
  height: 100%;
  overflow-y: auto;
  font-size: var(--hdr-fs-md);
  background: var(--surface);
  box-shadow: 20px 0 40px -20px rgba(6, 14, 30, 0.5);
  transform: translateX(-100%);
  transition: transform 0.35s var(--hdr-ease);
  overscroll-behavior: contain;
}

.th-menu-wrapper.open .th-menu-area {
  transform: translateX(0);
}

.hdr-drawer__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.hdr-drawer__head .hdr-logo img {
  max-width: 150px;
  max-height: 36px;
}

.hdr-drawer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 18px;
  color: var(--heading);
  background: var(--bg);
  border: 0;
  border-radius: 10px;
  transition: background 0.25s var(--hdr-ease), color 0.25s var(--hdr-ease);
}

.hdr-drawer__close:hover {
  color: var(--on-primary);
  background: var(--primary);
}

.hdr-drawer__user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 16px 8px;
  padding: 12px 14px;
  background: var(--primary-soft);
  border-radius: 14px;
}

.hdr-drawer__user .hdr-avatar {
  width: 40px;
  height: 40px;
  font-size: var(--hdr-fs-sm);
  box-shadow: none;
}

.hdr-drawer__user strong {
  display: block;
  font-size: 15px;
  letter-spacing: -0.005em;
  color: var(--heading);
}

.hdr-drawer__user small {
  font-size: var(--hdr-fs-sm);
  color: var(--text-muted);
}

.th-mobile-menu {
  padding: 4px 0 24px;
}

.th-mobile-menu ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.th-mobile-menu>ul>li {
  border-bottom: 1px solid var(--border);
}

.th-mobile-menu>ul>li>a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 13px 20px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--heading);
  text-decoration: none;
}

.th-mobile-menu>ul>li>a.active,
.th-mobile-menu .th-active>a {
  color: var(--primary);
}

/* expand chevron */
.th-mobile-menu .th-mean-expand {
  position: relative;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-left: auto;
  border-radius: 6px;
}

.th-mobile-menu .th-mean-expand::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 9px;
  width: 6px;
  height: 6px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  opacity: 0.6;
  transform: rotate(45deg);
  transition: transform 0.25s var(--hdr-ease), top 0.25s var(--hdr-ease);
}

.th-mobile-menu .th-active>a .th-mean-expand::before {
  top: 11px;
  transform: rotate(-135deg);
}

.th-mobile-menu .sub-menu {
  padding: 4px 0 10px;
  background: var(--bg);
}

.th-mobile-menu .sub-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 20px 9px 34px;
  font-size: var(--hdr-fs-sm);
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

.th-mobile-menu .sub-menu li a::before {
  content: "";
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  background: var(--primary-soft-2);
  border-radius: 50%;
  transition: background 0.2s var(--hdr-ease);
}

.th-mobile-menu .sub-menu li a:hover {
  color: var(--primary);
}

.th-mobile-menu .sub-menu li a:hover::before {
  background: var(--primary);
}

/* -----------------------------------------------------
   RESPONSIVE
----------------------------------------------------- */
/* menu steps DOWN in size as space shrinks (was stepping up before) */
@media (max-width: 1399.98px) {
  .main-menu>ul>li>a {
    padding: 0 10px;
    font-size: 13px;
  }

  .main-menu>ul>li>a::before {
    left: 10px;
    right: 10px;
  }
}

/* below 1200px the 10-item menu no longer fits: switch to the drawer */
@media (max-width: 1199.98px) {
  .header {
    --hdr-main-h: 68px;
  }

  .main-menu {
    display: none;
  }

  .hdr-burger {
    display: inline-flex;
  }
}

@media (max-width: 767.98px) {
  .header {
    --hdr-top-h: 40px;
    --hdr-main-h: 64px;
  }

  .hdr-container {
    padding: 0 16px;
  }

  .hdr-top__greet span:not(.hdr-top__id),
  .hdr-top__greet>i,
  .hdr-wallet__label,
  .hdr-user__name {
    display: none;
  }

  .hdr-agent-logo {
    display: none;
  }

  .hdr-logo img {
    max-width: 150px;
    max-height: 38px;
  }
}

/* respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {

  .header *,
  .th-menu-wrapper,
  .th-menu-area {
    transition-duration: 0.01ms !important;
  }
}