/* Load this file LAST, after theme.css + module CSS */

/* ===== Reset the manual offsets that break mobile/tablet ===== */
@media (max-width: 1366px) {
  .nomclient,
  .menu-main-wrapper,
  #mobile_bonmm_0,
  .bon-nav-bar-menu,
  .bon-nav-bar-icons,
  #_desktop_user_info,
  #_desktop_cart,
  #_desktop_search_widget,
  #bonwishlist,
  #boncompare,
  #_desktop_user_info .user-info,
  #_desktop_cart .blockcart,
  #bonwishlist .block-wishlist,
  #_desktop_search_widget.bonsearch,
  .bonsearch {
    margin: 0 !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
  }
}

/* ===== Mobile + tablet portrait/tablet small landscape ===== */
@media (max-width: 1024px) {
  body #header,
  body #header .header-top {
    background: #41729b !important;
  }

  body #header .header-top > .container,
  body #header .header-top > .container > .row,
  body #header .header-top .position-static {
    position: relative !important;
  }

  body #header .header-top .position-static {
    display: grid !important;
    grid-template-columns: 44px 1fr auto !important;
    align-items: center !important;
    min-height: 72px !important;
    column-gap: 10px !important;
    flex-wrap: nowrap !important;
  }

  /* desktop menu off, mobile burger on */
  #desktop_bonmm_0 { display: none !important; }
  #mobile_bonmm_0 { display: block !important; }

  .bon-nav-bar-menu {
    grid-column: 1 !important;
    justify-self: start !important;
    width: 44px !important;
    height: auto !important;
    overflow: visible !important;
  }

  .menu-main-wrapper {
    width: auto !important;
    padding-right: 0 !important;
    margin: 0 !important;
  }

  #mobile_bonmm_0 {
    position: static !important;
    width: auto !important;
  }

  .bonmm-mobile-button {
    padding: 0 !important;
  }

  .burger-lines {
    width: 26px !important;
    height: 22px !important;
    margin-top: 0 !important;
  }

  .burger-lines span {
    margin-bottom: 4px !important;
  }

  body #header #_mobile_logo {
    display: none !important;
  }

  body #header #_desktop_logo {
    display: block !important;
    grid-column: 2 !important;
    justify-self: center !important;
    position: static !important;
    margin: 0 !important;
  }

  body #header #_desktop_logo .logo {
    max-height: 46px !important;
    width: auto !important;
  }

  .bon-nav-bar-icons {
    grid-column: 3 !important;
    justify-self: end !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
    width: auto !important;
    overflow: visible !important;
    padding-right: 8px !important;
  }

  #boncompare { display: none !important; }

  #_desktop_user_info,
  #_desktop_cart,
  #_desktop_search_widget,
  #bonwishlist {
    display: block !important;
    position: static !important;
    width: auto !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
  }

  #_desktop_user_info .user-info,
  #_desktop_cart .blockcart,
  #bonwishlist .block-wishlist,
  #_desktop_search_widget.bonsearch {
    display: block !important;
    position: static !important;
    width: auto !important;
    min-width: 0 !important;
  }

  #_desktop_user_info .user-info a,
  #_desktop_cart .blockcart a,
  #bonwishlist .wishlist-tooltip,
  #_desktop_search_widget .bonsearch_button,
  #_desktop_search_widget .bonsearch_button.current {
    display: block !important;
    line-height: 1 !important;
    text-decoration: none !important;
  }

  #_desktop_user_info i,
  #_desktop_cart i,
  #bonwishlist i,
  #_desktop_search_widget i {
    display: block !important;
    font-size: 24px !important;
    line-height: 1 !important;
    margin: 0 !important;
  }

  body #header .blockcart .cart-products-count,
  #bonwishlist .wishlist-count {
    top: -8px !important;
    right: -8px !important;
    left: auto !important;
    margin: 0 !important;
  }

  .nomclient { display: none !important; }

  /* search */
  #_desktop_search_widget.bonsearch {
    width: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
  }

  #_desktop_search_widget .bonsearch_box {
    right: 0 !important;
    left: auto !important;
    top: calc(100% + 10px) !important;
    width: min(320px, calc(100vw - 20px)) !important;
    margin: 0 !important;
  }

  /* popups */
  #bonwishlist #wishlist-popup .wishlist-wrapper,
  #_desktop_cart .header .alert,
  body #header .header-top .position-static #_desktop_user_info .user-info .bon-login-popup {
    right: 0 !important;
    left: auto !important;
    top: calc(100% + 10px) !important;
    margin: 0 !important;
  }

  /* mobile menu panel */
  #mobile_bonmm_0 > .bonmm-top-menu[data-bonmm-depth="0"] {
    top: 72px !important;
    background: #fff !important;
  }
}

/* narrower phones: tighten the right icon group so everything stays visible */
@media (max-width: 480px) {
  .bon-nav-bar-icons {
    gap: 7px !important;
    padding-right: 4px !important;
  }

  #_desktop_user_info i,
  #_desktop_cart i,
  #bonwishlist i,
  #_desktop_search_widget i {
    font-size: 22px !important;
  }

  body #header .blockcart .cart-products-count,
  #bonwishlist .wishlist-count {
    top: -7px !important;
    right: -7px !important;
  }
}

/* ===== Tablet landscape / small laptops ===== */
@media (min-width: 1025px) and (max-width: 1366px) {
  body #header .header-top {
    background: #41729b !important;
  }

  body #header .header-top .position-static {
    display: grid !important;
    grid-template-columns: auto minmax(0,1fr) auto !important;
    align-items: start !important;
    column-gap: 18px !important;
  }

  #mobile_bonmm_0 { display: none !important; }
  #desktop_bonmm_0 { display: block !important; }

  body #header #_desktop_logo {
    display: block !important;
    position: static !important;
    margin: 0 !important;
    transform: none !important;
    justify-self: start !important;
  }

  .bon-nav-bar-menu {
    margin: 0 !important;
    min-width: 0 !important;
    width: auto !important;
    height: auto !important;
  }

  .menu-main-wrapper {
    width: auto !important;
    margin: 0 !important;
    padding-right: 0 !important;
  }

  #desktop_bonmm_0,
  #desktop_bonmm_0 .bonmm-top-menu,
  #top-menu-0[data-bonmm-depth="0"] {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    row-gap: 8px !important;
    column-gap: 2px !important;
  }

  #top-menu-0[data-bonmm-depth="0"] > li > a {
    font-size: 13px !important;
    padding: 0 8px !important;
    white-space: nowrap !important;
  }

  .bon-nav-bar-icons {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    justify-self: end !important;
    width: auto !important;
    padding-top: 18px !important;
  }

  #_desktop_user_info,
  #_desktop_cart,
  #_desktop_search_widget,
  #bonwishlist {
    display: block !important;
    position: static !important;
    width: auto !important;
    min-width: 0 !important;
  }

  #_desktop_user_info .user-info,
  #_desktop_cart .blockcart,
  #bonwishlist .block-wishlist,
  #_desktop_search_widget.bonsearch {
    margin: 0 !important;
    position: static !important;
  }

  .nomclient { display: none !important; }

  body #header .blockcart .cart-products-count,
  #bonwishlist .wishlist-count {
    top: -8px !important;
    right: -8px !important;
    left: auto !important;
    margin: 0 !important;
  }
}
