/* Header quick tools — compact pill design, brand blues + right-aligned nav */

.nav-bg {
  clear: both;
}

/* ---- Desktop / tablet: pin main menu + quick tools to the right ---- */
@media (min-width: 768px) {
  #header .top-header .row-col {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
  }

  /* Override Bootstrap col widths/floats so logo + menu never overlap */
  #header .top-header .row-col > .left-header {
    float: none !important;
    width: auto !important;
    max-width: min(200px, 28vw);
    flex: 0 0 auto;
    position: relative;
    z-index: 2;
  }

  #header .top-header .row-col > .middle-header {
    float: none !important;
    width: auto !important;
    flex: 1 1 0%;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    min-width: 0;
    max-width: 100%;
    text-align: right;
    position: relative;
    z-index: 1;
  }

  /* Column stacks nav + quick tools; align end so 2nd row isn’t full-width empty space */
  #header .middle-header .nav-bg {
    float: none !important;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    width: 100%;
    max-width: 100%;
    gap: 6px;
  }

  /*
   * Main menu: block + text-align:right + inline-flex ul so the bar stays right-aligned
   * but overflow scroll starts at the left (Home stays visible). Pure flex-end + scroll
   * clips the start of the row and hides Home.
   */
  #header .middle-header nav {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    text-align: right;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  /* Override menu-css float:left on top-level items */
  #header .middle-header nav .menu {
    display: inline-flex !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start;
    align-items: center;
    float: none !important;
    width: max-content;
    max-width: none;
    margin: 0;
    vertical-align: top;
    text-align: left;
    background: linear-gradient(180deg, #fafcff 0%, #f0f6fc 100%);
    border: 1px solid rgba(0, 86, 179, 0.14);
    border-radius: 8px;
    padding: 2px 3px 3px;
    gap: 1px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  }

  /* responsive.css adds large margin-left on li — remove so Home isn’t pushed off-screen */
  #header .middle-header nav .menu > li {
    float: none !important;
    flex-shrink: 0;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Compact main links so they fit one line on laptop widths */
  #header .middle-header nav .menu > li:not(.nav-qf-mobile-only) > a.main-nav-link {
    padding: 3px 5px !important;
    font-size: 11px !important;
    border-radius: 4px;
    gap: 0.3em !important;
    white-space: nowrap;
  }

  #header .middle-header nav .menu > li:not(.nav-qf-mobile-only) > a.main-nav-link .fa {
    font-size: 11px !important;
    width: 1.05em;
  }

  /* Wrapper only as wide as the chips — no full-width band with empty left gap */
  #header .header-quickfind {
    align-self: flex-end;
    width: max-content;
    max-width: 100%;
    min-width: 0;
    display: block;
    margin-left: auto;
    margin-right: 0;
    padding: 0;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    border-top: none !important;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  /* Visual “card” sits on inner so it hugs label + pills */
  #header .header-qf-inner {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    padding: 4px 5px 5px 6px;
    justify-content: flex-start;
    width: max-content;
    max-width: none;
    margin: 0;
    vertical-align: top;
    text-align: left;
    box-sizing: border-box;
    background: linear-gradient(180deg, #f5f9ff 0%, #eef4fc 100%);
    border: 1px solid rgba(0, 86, 179, 0.14);
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  }

  #header .header-qf-label {
    margin-right: 2px;
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 10px;
    letter-spacing: 0.05em;
  }

  #header .header-quickfind-list {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 4px;
    min-width: 0;
  }

  #header .header-qf-chip {
    flex-shrink: 0;
    padding: 3px 7px;
    font-size: 11px;
    gap: 3px;
  }

  #header .header-qf-chip .fa {
    font-size: 10px;
  }

  /* Duplicate Quick tools links only for mobile hamburger — hidden on larger screens */
  #header .middle-header nav .menu > li.nav-qf-mobile-only {
    display: none !important;
  }
}

/* Primary nav: icons + text — desktop drawer + mobile hamburger */
#header .middle-header nav .menu > li:not(.nav-qf-mobile-only) > a.main-nav-link {
  display: inline-flex !important;
  align-items: center;
  gap: 0.5em;
  font-weight: 600;
  color: #0d3a66 !important;
  transition: background 0.2s ease, color 0.2s ease;
}

#header .middle-header nav .menu > li:not(.nav-qf-mobile-only) > a.main-nav-link .fa {
  font-size: 15px;
  color: #0056b3;
  opacity: 0.95;
  width: 1.2em;
  text-align: center;
  flex-shrink: 0;
}

#header .middle-header nav .menu > li:not(.nav-qf-mobile-only) > a.main-nav-link:hover,
#header .middle-header nav .menu > li:not(.nav-qf-mobile-only) > a.main-nav-link:focus {
  background: rgba(0, 86, 179, 0.08) !important;
  color: #003d82 !important;
}

#header .middle-header nav .menu > li:not(.nav-qf-mobile-only) > a.main-nav-link:hover .fa,
#header .middle-header nav .menu > li:not(.nav-qf-mobile-only) > a.main-nav-link:focus .fa {
  color: #004080;
}

.header-quickfind {
  margin-top: 4px;
  padding: 0;
  clear: both;
  border-top: 1px solid rgba(0, 86, 179, 0.12);
  background: linear-gradient(180deg, #f5f9ff 0%, #eef4fc 100%);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.header-qf-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 10px;
  padding: 6px 10px 8px;
}

.header-qf-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1a4d8c;
  flex: 0 0 auto;
}

.header-qf-label .fa {
  font-size: 13px;
  color: #0056b3;
}

.header-quickfind-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 0 1 auto;
  min-width: 0;
}

.header-quickfind-list li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.header-qf-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  color: #0d3a66;
  background: #fff;
  border: 1px solid rgba(0, 86, 179, 0.22);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 40, 100, 0.06);
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  text-decoration: none !important;
  white-space: nowrap;
}

.header-qf-chip .fa {
  font-size: 12px;
  color: #0056b3;
  opacity: 0.9;
}

.header-qf-chip:hover,
.header-qf-chip:focus {
  color: #0056b3;
  border-color: #0056b3;
  box-shadow: 0 2px 8px rgba(0, 86, 179, 0.15);
  transform: translateY(-1px);
}

.header-qf-chip:active {
  transform: translateY(0);
}

/* ~tablet / small laptop: hide “Quick tools” label so chips fit */
@media (min-width: 768px) and (max-width: 1199px) {
  #header .header-qf-label {
    display: none !important;
  }
}

/* Mobile: quick tools inside hamburger only — hide header strip */
@media (max-width: 767px) {
  #header .header-quickfind {
    display: none !important;
  }

  #header .middle-header nav .menu > li.nav-qf-mobile-only {
    display: list-item;
  }

  #header .menu-qf-heading {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    background: #f7f9fc;
  }

  #header .menu-qf-heading span {
    display: block;
    padding: 10px 7px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #1a4d8c;
  }

  #header .menu-qf-heading .fa {
    margin-right: 6px;
    color: #0056b3;
  }

  #header .menu-qf-link .fa {
    width: 1.1em;
    margin-right: 8px;
    color: #0056b3;
    text-align: center;
  }

  #header .top-header .row-col {
    flex-wrap: wrap;
    position: relative;
  }

  #header .middle-header {
    flex: 1 1 100%;
    width: 100%;
    justify-content: stretch;
    text-align: left;
  }

  #header .middle-header .nav-bg {
    align-items: stretch !important;
    width: 100% !important;
  }

  #header .middle-header nav {
    justify-content: flex-start;
    width: 100%;
  }

  #header .middle-header nav .menu {
    justify-content: flex-start !important;
    margin-left: 0 !important;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .header-quickfind-list {
    gap: 6px;
  }

  .header-qf-chip {
    font-size: 11px;
    padding: 5px 9px;
  }
}
