/**
 * Mobile Header Navigation Bar
 * Full-width × 56px, #1C48F0 background, white elements.
 * Visible only on mobile (≤767px).
 */

/* ===== Hide on desktop ===== */
.iai-mobile-header,
.iai-mobile-header__extras {
  display: none;
}

@media (max-width: 767px) {

  /* Remove margin/padding that compensated for old fixed header */
  .product-hero,
  .general-hero {
    margin-top: 0 !important;
  }

  /* ===== Show mobile header, hide desktop header ===== */
  .iai-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 56px;
    background: #1C48F0;
    padding: 0 16px;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 9999;
  }

  /* Hide the old header bar visually, but keep #iai-mm-nav in the render tree.
     We cannot use display:none because the plugin's .iai-mm-nav is position:fixed
     and needs to remain renderable when body.mobile-menu-active is set. */
  .header-wrap {
    visibility: hidden !important;
    height: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    overflow: visible !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    pointer-events: none !important;
    z-index: 9998 !important;
  }

  /* When menu is active, make the mega nav visible and interactive */
  body.mobile-menu-active .iai-mm-nav {
    visibility: visible !important;
    pointer-events: auto !important;
    top: 96px !important;  /* 56px header + ~40px extras strip */
  }

  /* ===== Left group ===== */
  .iai-mobile-header__left {
    display: flex;
    align-items: center;
    gap: 20px;
  }

  /* --- Hamburger: 3 lines of decreasing width --- */
  .iai-mobile-burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 4px;
    background: none;
    border: none;
    padding: 8px 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .iai-mobile-burger:hover,
  .iai-mobile-burger:focus,
  .iai-mobile-burger:active {
    background: transparent !important;
    background-color: transparent !important;
  }

  .iai-mobile-burger__line {
    display: block;
    height: 1.5px;
    background: #fff;
    border-radius: 1px;
    transition: transform 0.25s ease, width 0.25s ease, opacity 0.2s ease;
    transform-origin: center;
  }

  .iai-mobile-burger__line--long {
    width: 20px;
  }

  .iai-mobile-burger__line--medium {
    width: 16px;
  }

  .iai-mobile-burger__line--short {
    width: 12px;
  }

  /* X state when open */
  .iai-mobile-burger[aria-expanded="true"] .iai-mobile-burger__line--short {
    width: 20px;
    transform: translateY(5.5px) rotate(45deg);
  }

  .iai-mobile-burger[aria-expanded="true"] .iai-mobile-burger__line--medium {
    opacity: 0;
    width: 0;
  }

  .iai-mobile-burger[aria-expanded="true"] .iai-mobile-burger__line--long {
    transform: translateY(-5.5px) rotate(-45deg);
  }

  /* --- Logo --- */
  .iai-mobile-header__logo {
    display: flex;
    align-items: center;
    text-decoration: none;
  }

  .iai-mobile-header__logo-img {
    height: 28px;
    width: auto;
  }

  /* ===== Right group ===== */
  .iai-mobile-header__right {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  /* --- Global Presence link --- */
  .iai-mobile-header__global {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #fff;
  }

  .iai-mobile-header__globe-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }

  .iai-mobile-header__global-text {
    font-size: 13px;
    font-weight: 400;
    color: #fff;
    white-space: nowrap;
  }

  /* --- Divider --- */
  .iai-mobile-header__divider {
    display: block;
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.6);
  }

  /* --- Search button --- */
  .iai-mobile-header__search {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  /* ===== Extras panel (envelope, suppliers, HE) ===== */
  .iai-mobile-header__extras {
    display: none;
    width: 100%;
    background: #1C48F0;
    padding: 0 16px 12px;
    box-sizing: border-box;
    position: fixed;
    top: 56px;
    left: 0;
    z-index: 9999;
  }

  .iai-mobile-header__extras[aria-hidden="false"] {
    display: block;
  }

  .iai-mobile-header__extras-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
  }

  .iai-mobile-extras__item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 13px;
    font-weight: 400;
    text-decoration: none;
    white-space: nowrap;
  }

  .iai-mobile-extras__item--suppliers {
    margin-left: auto;
  }

  .iai-mobile-extras__item--he {
    width: 24px;
    height: 24px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid #FFFFFF;
    border-radius: 4px;
    padding: 0;
    font-weight: 600;
    font-size: 12px;
    line-height: 1;
    color: #fff;
  }
}

/* ===== Desktop fallback: restore globe icon before "Global Presence" =====
   (Mirrors plugin rule in iai-mega.css to survive LiteSpeed CSS combine.) */
@media (min-width: 768px) {
  .right-menu a.mm-global::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 6px;
    background-image: url('/wp-content/themes/generatepress_child/assets/images/globe.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    vertical-align: middle;
  }
}
