/* Product Tab Bar - Sticky navigation for product detail page */
div[data-settings-id="shopline-section-product-tab-bar"] {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: #F9FAFB;
  box-shadow: none;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

/* 吸顶时：白底 + 外阴影（0 / 4 / 模糊 4 / 扩展 0 / #000 25%） */
@media screen and (min-width: 992px) {
  div[data-settings-id="shopline-section-product-tab-bar"]:has(.product-tab-bar.is-sticky) {
    background-color: #ffffff;
    box-shadow: 0 4px 12px 0 rgba(7, 31, 30, 0.08);
  }
}

@media screen and (max-width: 991px) {
  /* 移动端 tab 吸顶；与桌面一致使用较高 z-index */
  div[data-settings-id="shopline-section-product-tab-bar"] {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: transparent;
    margin-top: 32px;
  }

  /* 吸顶时整块白底 + 底阴影（与桌面一致） */
  div[data-settings-id="shopline-section-product-tab-bar"]:has(.product-tab-bar.is-sticky) {
    background-color: #ffffff;
    box-shadow: 0 4px 12px 0 rgba(7, 31, 30, 0.08);
  }

  /* 底部固定 CTA 占位，需与 .product-tab-bar__amazon-footer 可视高度一致 */
  body:has(div[data-settings-id="shopline-section-product-tab-bar"] .product-tab-bar.is-sticky) {
    padding-bottom: var(
      --product-tab-mobile-fixed-cta-height,
      calc(80px + env(safe-area-inset-bottom, 0px))
    );
  }
}


.product-tab-bar {
  padding-block-start: var(--section-spacing-block-start, 0);
  padding-block-end: var(--section-spacing-block-end, 40px);
}

.product-tab-bar__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
}

/* SKU 仅在对照 sentinel 判定为吸顶（.is-sticky）时显示，与 Amazon 按钮一致 */
.product-tab-bar__product-id {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 16px;
  line-height: 22px;
  color: #0E1424;
  white-space: nowrap;
  overflow: hidden;
  display: none;
}

.product-tab-bar.is-sticky .product-tab-bar__product-id {
  display: block;
}

.product-tab-bar__content {
  display: flex;
  align-items: center;
  gap: 40px;
}

.product-tab-bar__nav {
  display: flex;
  align-items: center;
  gap: 40px;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}

.product-tab-bar__tab {
  background: none;
  border: none;
  padding: 0;
  font-size: 16px;
  line-height: 24px;
  color: #0E1424;
  font-weight: 400;
  cursor: pointer;
  transition: color 0.2s ease, font-weight 0.2s ease;
}

.product-tab-bar__tab.active, .product-tab-bar__tab:hover {
  font-weight: 700;
}

/* 桌面端不参与布局盒，子级仍参与 flex；移动端吸底时单独设为 fixed 容器 */
.product-tab-bar__amazon-footer {
  display: contents;
}

.product-tab-bar__amazon-btn {
  position: relative;
  z-index: 0;
  box-sizing: border-box;
  flex-shrink: 0;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  width: var(--amazon-btn-width, auto);
  height: var(--amazon-btn-height, auto);
  max-width: max-content;
  color: var(--btn-text-color);
  background-color: var(--btn-bg-color);
  font-weight: 600;
  font-size: 14px;
  line-height: 22px;
  text-decoration: none;
  border-radius: 9999px;
  cursor: pointer;
}

.product-tab-bar.is-sticky .product-tab-bar__amazon-btn {
  display: inline-flex;
}

.product-tab-bar__amazon-btn .product-tab-bar__amazon-btn-text {
  position: relative;
  z-index: 1;
  color: var(--btn-text-color);
  transition: color 0.4s ease;
}

.product-tab-bar__amazon-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  width: 0;
  height: 100%;
  pointer-events: none;
  background-color: var(--btn-bg-hover, var(--btn-bg-color));
  border-radius: inherit;
  transition: width 0.4s ease;
}

.product-tab-bar__amazon-btn:hover::before {
  width: 100%;
}

.product-tab-bar__amazon-btn:hover .product-tab-bar__amazon-btn-text {
  color: var(--btn-text-hover, var(--btn-text-color));
}

/* 桌面：未吸顶时无左侧 SKU，导航整体居右对齐；吸顶时恢复 SKU + 居中导航 */
@media screen and (min-width: 992px) {
  .product-tab-bar:not(.is-sticky) .product-tab-bar__content {
    margin-inline-start: auto;
    justify-content: flex-end;
  }

  .product-tab-bar:not(.is-sticky) .product-tab-bar__nav {
    flex: 0 1 auto;
    justify-content: flex-end;
  }
}

@media (max-width: 991px) {
  .product-tab-bar .valki-main-container > .product-tab-bar__bar {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    padding-inline: var(--main-padding, 16px);
    padding-block: 16px;
    flex-wrap: wrap;
    gap: 24px;
    align-items: center;
    min-height: 48px;
    background-color: #F9FAFB;
    border-radius: 0;
  }

  /* SKU 移动端始终隐藏 */
  .product-tab-bar__product-id,
  .product-tab-bar.is-sticky .product-tab-bar__product-id {
    display: none;
  }

  .product-tab-bar__content {
    flex: 1;
    min-width: 0;
    width: 100%;
    gap: 12px;
    align-items: center;
  }

  .product-tab-bar__nav {
    order: 0;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 24px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-block: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .product-tab-bar__nav::-webkit-scrollbar {
    display: none;
  }

  .product-tab-bar__tab {
    position: relative;
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 16px;
    line-height: 24px;
    color: #666666;
    font-weight: 400;
    padding-block-end: 12px;
    margin-block-end: -12px;
  }

  /* 当前 tab：粗体 + 底部指示条（与设计稿一致） */
  .product-tab-bar__tab.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background-color: #0e1424;
    border-radius: 1px;
    pointer-events: none;
  }

  .product-tab-bar__tab.active,
  .product-tab-bar__tab:hover {
    color: #0e1424;
    font-weight: 700;
  }

  /* 吸顶时仅保留横向 tab；Amazon 通过 footer 固定在视口底部 */
  .product-tab-bar.is-sticky .product-tab-bar__content {
    flex-wrap: nowrap;
  }

  div[data-settings-id="shopline-section-product-tab-bar"]:has(.product-tab-bar.is-sticky)
    .product-tab-bar
    .valki-main-container
    > .product-tab-bar__bar {
    background-color: #ffffff;
  }

  .product-tab-bar.is-sticky .product-tab-bar__amazon-footer {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    padding: 16px var(--main-padding, 16px);
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    background-color: #ffffff;
    box-sizing: border-box;
  }

  .product-tab-bar.is-sticky .product-tab-bar__amazon-btn {
    display: flex;
    width: 100%;
    max-width: none;
    justify-content: center;
  }
}
