/* 
 * global-navigation.css 
 * Used for styling the main application global navigation menu
 */

.global-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  display: flex;
  justify-content: space-between;
  align-items: center;

  .logo-wrapper {
    display: flex;

    .logo-breadcrumb {
      list-style: none;
      padding: 0;

      #lblSubHeader {
        color: #000 !important;
      }

      @media (max-width: 768px) {
        #lblSubHeader {
          position: absolute !important;
          margin: 2px 5px 0 0 !important;
          right: 10px;
          top: 72px;
          color: #ffffff !important;
        }
      }
    }
  }
}

.nav-overlay-background {
  display: none;  
  height: 100vh;
  position: fixed;
  top: 60px;
  float: none;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(5px);
  z-index: -1;
}

/* .global-header:has(.navigation-menu li.dropdown:hover) .nav-overlay-background, */
.global-nav-wrapper:has(.navigation-menu .dropdown.open) ~ .nav-overlay-background {
  display: block;
  pointer-events: none;
}



#topNav.global-nav-wrapper {
  margin: 0;
  padding: 0;
  overflow: visible;
  z-index: 0;
  padding-left: 0;
  position: relative;
  height: 100%;
  min-width: auto;
  color: #fff;
}

.navigation-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
  align-items: center;

  > li {
    border-bottom: 5px solid transparent;
    height: 100%;
    position: relative;

    &:hover > label,
    &:hover > span,
    &:hover > a {
      text-shadow: 0.5px 0px 0px currentColor, -0.5px 0px 0px currentColor;
    }

    &.dropdown:hover,
    &.dropdown.open {
      border-bottom: 5px solid #fff;
      border-bottom: 5px solid color-mix(in srgb, #fff 70%, transparent);
    }
  }

  a.dropdown-toggle, /* Top-level menu items */
  > li > label,
  > li > span,
  > li > a {
    color: #fff;
    height: 100%;
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: clamp(11px, calc(1.2vw), 14px);
    padding-right: clamp(8px, 1vw, 15px);
    padding-left: clamp(8px, 1vw, 15px);
    margin-top: 4px;
    font-weight: normal;
    cursor: pointer;
  }

  /* First child links */
  a.dropdown-toggle + .dropdown-menu > li:not([class]) {
    a {
      padding: 10px 10px 6px !important;
    }
  }

  li.dropdown {
    > .dropdown-menu { /* Mega-menu container */
      display: grid !important;
      grid-auto-flow: column dense;
      /* grid-auto-columns: minmax(160px, 220px); */
      grid-auto-columns:  max-content;
      grid-template-rows: repeat(20, auto);
      align-items: start;
      gap: 0 8px;
      visibility: hidden;
      opacity: 0;
      transform: translateY(6px);
      transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s 0.2s;
      pointer-events: none;
      position: fixed;
      left: 0;
      right: 0;
      width: 100vw;
      top: 50px;
      /* max-height: 0; */
      max-height: calc(100vh - 120px);
      overflow-y: auto;
      overflow-x: hidden;
      padding: 8px 24px 16px;
      margin: 0;
      border: none;
      border-top: 2px solid var(--brand-primary-color, #d4d4d8);
      border-radius: 0;
      box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
      background-color: #fff;
      cursor: default;
    }

    > .dropdown-menu > .dropdown-submenu-nested {
      grid-row: 1 / span 20;
    }

    > .dropdown-menu > li:not(.dropdown-submenu-nested) {
      align-self: start;
    }

    &.open > ul.dropdown-menu {
      /* max-height: calc(100vh - 120px); */
      visibility: visible;
      opacity: 1;
      transform: translateY(0);
      transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s;
      pointer-events: auto;
    }

    ul.dropdown-menu {
      > .dropdown-submenu-nested {
        flex: 0 0 auto;
        min-width: 160px;
        max-width: min-content;
        margin: 0 0 16px 0;

        > label, /* section header */
        > span[id] { /* section header (legacy) */
          display: block;
          background-color: #525252;
          background-color: var(--brand-primary-color);
          color: #fff;
          padding: 5px 10px;
          font-size: 12px;
          font-weight: 500;
          text-transform: uppercase;
          letter-spacing: 0.06em;
          border-radius: 4px 4px 0 0;
          cursor: default;
          white-space: nowrap;
          margin: 0;
        }

        > .dropdown-menu { /* section links container */
          display: block !important;
          visibility: visible !important;
          opacity: 1 !important;
          transform: none !important;
          /* pointer-events: auto; */
          position: static;
          top: initial;
          left: initial;
          right: initial;
          width: 100%;
          min-width: 0;
          /* border: 1px solid #e4e4e7; */
          border-top: 0;
          border-radius: 0 0 4px 4px;
          padding: 4px 0;
          background-color: #fafafa;
          box-shadow: none;
          margin: 0;
          flex-direction: column;
          max-height: none;
        }

        /* Nested section levels */
        .dropdown-submenu-nested {
          display: flow-root;
          margin: 6px 0 0;
          min-width: 0;
          max-width: none;

          > label,
          > span[id] {
            font-size: 10px;
            background-color: color-mix(in srgb, var(--brand-primary-color) 65%, #fff);
            border-radius: 0;
          }
          
          .dropdown-submenu-nested {
            margin-left: 15px;
          }
          .dropdown-submenu-nested > label,
          .dropdown-submenu-nested > span[id] {
            background-color: color-mix(in srgb, var(--brand-primary-color) 30%, #fff);
          }
        }
      }

      > li > a {
        display: block;
        text-decoration: none;
        font-weight: normal;
        font-size: 13px;
        white-space: nowrap;
        padding: 5px 10px;
        color: #3f3f46 !important;
        background: transparent;
        border-radius: 0;
        clear: both;

        &:first-child {
          padding-top: 7px;
        }

        &:hover {
          color: #fff !important;
          background-color: rgb(from var(--brand-primary-color) r g b / 0.85) !important;
        }
      }

      > li > .dropdown-menu {
        display: block;
        position: static;
        top: initial;
        left: inherit;
        right: initial;
        box-shadow: none;
        border: none;
        background-color: transparent;
      }
    }
  }

}

@media screen and (max-width: 900px) {
  .global-nav-wrapper > .dropdown.mobile-dropdown {
    display: flex !important;
    color: inherit;
    width: fit-content;
    height: 60px;
    align-items: center;
    padding: 0;
    text-decoration: none;
    font-size: 16px;
    margin-top: -4px;

    :hover {
      cursor: pointer;
    }

    > .dropdown-toggle {
      display: flex;
      flex-direction: row;
      align-items: center;
    }
  }

  .navigation-menu {
    visibility: hidden;
    pointer-events: none;

    .dropdown-toggle {
      color: #000;
      display: block;
      text-decoration: none;
      font-weight: bold;
      font-size: 16px;
      white-space: nowrap;
      clear: both;
      padding: 0;
      height: auto;
      cursor: pointer;
      padding: 10px 0;
      margin: 0;
    }

    li.dropdown {

      &:hover > label,
      &:hover > span,
      &:hover > a {
        text-shadow: none;
      }

      > input[type="checkbox"] {
        display: none;
      }

      > input[type="checkbox"] ~ .dropdown-menu {
        display: none !important;
      }

      > input[type="checkbox"]:checked ~ .dropdown-menu { 
        display: flex !important;
        pointer-events: auto;
      }


      > .dropdown-menu { /* Primary Menu Container */
        flex-direction: column;
        position: fixed;
        top: 0;
        width: 100%;
        max-height: 100vh;
        height: 100%;
        transform: none;
        opacity: 1;
        visibility: visible;
        transition: none;
        overflow-x: hidden;
        overflow-y: auto;
        background-color: #f4f4f5;

        
        li.dropdown-submenu-nested {
          margin-left: 0;

          > label { /* submenu title  */
            cursor: pointer;
            border: none;
            background: transparent;
            color: #000;
            border-radius: 5px;
            text-decoration: none;
            padding: 0;
            margin: 0;
          }

          > span[id] { /* fallback */
            margin-top: 10px;
            cursor: default;
            border: none;
            background: transparent;
            color: #000;
            border-radius: 5px;
            text-decoration: underline;
            padding: 10px 20px 6px;
          }
        }
      }
    }
  }

  .global-nav-wrapper.mobile-nav-open > .navigation-menu {
    visibility: visible;
    pointer-events: auto;
    flex-direction: column;
    align-items: flex-start;
    height: calc(100svh - 110px);
    background-color: #f4f4f5;
    position: fixed;
    left: 0;
    top: 49px;
    bottom: 0;
    border: 1px solid black;
    overflow-y: auto;
    padding: 10px 20px;
    box-shadow: 0 4px 6px 1px rgb(0 0 0 / 0.25), 0 2px 4px -2px rgb(0 0 0 / 0.25);

    .dropdown-menu {
      visibility: visible;
      position: static;
      flex-direction: column;
      padding: 0;
      margin: 0;
      box-shadow: none;
      border: none;
      flex-wrap: initial;
      overflow: visible;
    }

    .dropdown-menu,
    label {
      background-color: transparent !important;
    }
    
    > li {
      height: auto;
      border: none;

      a {
        font-size: 16px;
        font-weight: normal;
        white-space: nowrap;
        clear: both;
        padding: 10px 0;
        margin: 0;
        border-radius: 0;
        color: #000;
        text-shadow: none;
        background: transparent;
        outline: none;
        text-decoration: underline !important;

        &:hover {
          color: #000 !important;
          font-weight: bold;
          background-color: transparent !important;
        }
      }
    }
  }
}

/*  05/26/26 temporarily changes mobile since this is broken on mobile until the new menu design rolls out */
@media (max-width: 768px) {
  #topNav, #ShowSearchBox, #liUserHistory, dtx-mentions-indicator {
    display: none !important; 
  }
  
  #ctl00_userDropdownMenu {
    margin: 0 !important;
    width: max-content !important;
    padding: 0 !important;
  }
}