.header-product-mega-menu {
  --hpm-sidebar-width: 270px;
  --hpm-min-height: 520px;
  box-sizing: border-box;
  padding-block: 0 !important;
  color: var(--hpm-text, #111);
  background: var(--hpm-bg, #fff) !important;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.10);
}

.header-product-mega-menu .header-product-mega__shell {
  display: grid;
  grid-template-columns: var(--hpm-sidebar-width) minmax(0, 1fr);
  min-height: var(--hpm-min-height);
  padding-block: 22px 28px;
}

.header-product-mega__sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0 28px 0 0;
  background: var(--hpm-sidebar-bg, #fff);
  border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.header-product-mega__sidebar-scroll {
  flex: 1 1 auto;
}

.header-product-mega__group {
  padding: 20px 20px 8px;
  color: var(--hpm-text, #111);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.header-product-mega__group:first-child {
  padding-top: 0;
}

.header-product-mega__tab {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 20px;
  border: 0;
  border-radius: 0;
  color: var(--hpm-muted, #5f6368);
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  transition:
    background-color .18s ease,
    color .18s ease;
}

.header-product-mega__tab:hover,
.header-product-mega__tab:focus-visible {
  color: var(--hpm-text, #111);
  background: color-mix(in srgb, var(--hpm-active-bg, #f5f5f7) 55%, transparent);
}

.header-product-mega__tab.is-active {
  color: var(--hpm-active-text, #111);
  background: var(--hpm-active-bg, #f5f5f7);
  font-weight: 700;
}

.header-product-mega__tab-arrow {
  flex: 0 0 auto;
  opacity: 0;
  font-size: 22px;
  line-height: 1;
  transform: translateX(-4px);
  transition:
    opacity .18s ease,
    transform .18s ease;
}

.header-product-mega__tab.is-active .header-product-mega__tab-arrow {
  opacity: 1;
  transform: translateX(0);
}

.header-product-mega__all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: fit-content;
  min-height: 46px;
  margin: 28px 20px 0;
  padding: 11px 18px;
  color: #fff;
  background: #111;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  transition:
    opacity .18s ease,
    transform .18s ease;
}

.header-product-mega__all:hover {
  opacity: .86;
  transform: translateY(-1px);
}

.header-product-mega__content {
  min-width: 0;
  padding-left: 30px;
}

.header-product-mega__panel[hidden] {
  display: none !important;
}

.header-product-mega__panel-heading {
  display: flex;
  align-items: center;
  min-height: 42px;
  margin-bottom: 14px;
}

.header-product-mega__panel-title {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--hpm-text, #111);
  text-decoration: none;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.25;
}

a.header-product-mega__panel-title:hover {
  opacity: .68;
}

.header-product-mega__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.header-product-mega__product {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-width: 0;
  min-height: 145px;
  padding: 14px 18px;
  overflow: hidden;
  color: var(--hpm-text, #111);
  background: var(--hpm-card-bg, #f5f5f7);
  text-decoration: none;
  transition:
    transform .2s ease,
    box-shadow .2s ease;
}

.header-product-mega__product:nth-child(n + 10) {
  display: none;
}

.header-product-mega__product:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 18px rgba(0, 0, 0, .08);
}

.header-product-mega__product-media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 132px;
  height: 116px;
  overflow: hidden;
}

.header-product-mega__product-media svg {
  width: 72px;
  height: 72px;
}

.header-product-mega__product-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform .22s ease;
}

.header-product-mega__product:hover .header-product-mega__product-image {
  transform: scale(1.035);
}

.header-product-mega__product-info {
  min-width: 0;
}

.header-product-mega__product-title {
  display: -webkit-box;
  overflow: hidden;
  color: var(--hpm-text, #111);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.header-product-mega__product-price {
  margin-top: 7px;
  color: var(--hpm-muted, #5f6368);
  font-size: 13px;
}

.header-product-mega__product-price .price,
.header-product-mega__product-price * {
  font-size: 13px !important;
}

/* Product Mega Menu gets precedence over the legacy dropdown. */
.header-nav__menu-item:has(.header-product-mega-menu) .header-nav-dropdown-panel,
.header-nav__menu-item:has(.header-product-mega-menu) .header-nav-dropdown-menu-scope {
  display: none !important;
}

/* Mobile clone injected into existing SpeedBike nav drawer. */
.header-product-mega-mobile {
  display: none;
}

@media (max-width: 1200px) and (min-width: 960px) {
  .header-product-mega__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .header-product-mega__product:nth-child(n + 7) {
    display: none;
  }
}

@media (max-width: 959px) {
  header-layout .header-product-mega-menu {
    display: none !important;
  }

  .header-product-mega-mobile {
    padding: 4px 0 18px;
  }

  .header-nav-drawer__menu > ul > li > details[open] ~ .header-product-mega-mobile {
    display: block;
  }

  .header-product-mega-mobile .header-product-mega__shell {
    display: block;
    min-height: 0;
    padding: 0;
  }

  .header-product-mega-mobile .header-product-mega__sidebar {
    display: block;
    padding: 8px 0 12px;
    border-right: 0;
  }

  .header-product-mega-mobile .header-product-mega__sidebar-scroll {
    display: flex;
    gap: 8px;
    padding: 0 16px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .header-product-mega-mobile .header-product-mega__sidebar-scroll::-webkit-scrollbar {
    display: none;
  }

  .header-product-mega-mobile .header-product-mega__group,
  .header-product-mega-mobile .header-product-mega__all {
    display: none;
  }

  .header-product-mega-mobile .header-product-mega__tab {
    flex: 0 0 auto;
    width: auto;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f3f3f3;
    font-size: 13px;
    white-space: nowrap;
  }

  .header-product-mega-mobile .header-product-mega__tab.is-active {
    color: #fff;
    background: #111;
  }

  .header-product-mega-mobile .header-product-mega__tab-arrow {
    display: none;
  }

  .header-product-mega-mobile .header-product-mega__content {
    padding: 0 16px;
  }

  .header-product-mega-mobile .header-product-mega__panel-heading {
    min-height: 34px;
    margin: 4px 0 10px;
  }

  .header-product-mega-mobile .header-product-mega__panel-title {
    font-size: 16px;
  }

  .header-product-mega-mobile .header-product-mega__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .header-product-mega-mobile .header-product-mega__product {
    display: block;
    min-height: 0;
    padding: 10px;
  }

  .header-product-mega-mobile .header-product-mega__product:nth-child(n + 7) {
    display: none;
  }

  .header-product-mega-mobile .header-product-mega__product-media {
    width: 100%;
    height: 100px;
    margin-bottom: 8px;
  }

  .header-product-mega-mobile .header-product-mega__product-title {
    font-size: 12px;
    -webkit-line-clamp: 2;
  }

  .header-product-mega-mobile .header-product-mega__product-price {
    font-size: 11px;
  }
}


/* ===== v1.1 — Per-product badge (Anker-style) ===== */
.header-product-mega__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  min-height: 27px;
  margin-bottom: 7px;
  padding: 3px 10px;
  border: 2px solid var(--hpm-badge-border, #00aeef);
  border-radius: 999px;
  background: var(--hpm-badge-bg, #fff);
  color: var(--hpm-badge-text, #00aeef);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
}

@media (max-width: 959px) {
  .header-product-mega-mobile .header-product-mega__badge {
    min-height: 22px;
    margin-bottom: 5px;
    padding: 2px 8px;
    border-width: 1.5px;
    font-size: 10px;
  }
}
