/* H5 统一顶栏 — 与 PC 主站一致，仅保留：LOGO / 商店 / 搜索 / 登录 / 购物车 */
@import url('/css/brand-tokens.css');

:root {
  --bn-h5-header-h: calc(52px + env(safe-area-inset-top, 0px));
  --bn-h5-chrome: var(--bn-text, #000);
  --bn-h5-border: var(--bn-border, #e5e5e5);
}

html.bn-h5-with-header body {
  padding-top: var(--bn-h5-header-h);
}

.bn-h5-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  height: var(--bn-h5-header-h);
  padding-top: env(safe-area-inset-top, 0px);
  background: #fff;
  border-bottom: 1px solid var(--bn-h5-border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  padding-right: 12px;
  box-sizing: border-box;
  font-family: var(--bn-font-chrome);
}

/* 顶栏涟漪点击反馈 */
.bn-h5-header .bn-h5-ripple-host {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.bn-h5-header .bn-h5-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.22);
  transform: scale(0);
  opacity: 0.85;
  animation: bn-h5-ripple-spread 0.5s cubic-bezier(0.2, 0.6, 0.2, 1) forwards;
  pointer-events: none;
  z-index: 0;
}

@keyframes bn-h5-ripple-spread {
  0% {
    transform: scale(0);
    opacity: 0.5;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

.bn-h5-header .bn-h5-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  text-decoration: none;
  height: 40px;
  padding: 4px 6px;
  margin: 0 -6px;
  border-radius: var(--bn-radius, 0);
}

.bn-h5-header .bn-h5-logo img {
  position: relative;
  z-index: 1;
  height: 36px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  pointer-events: none;
}

.bn-h5-header .bn-h5-shop-btn.is-open {
  color: var(--bn-text-muted);
}

.bn-h5-header .bn-h5-spacer {
  flex: 1;
  min-width: 4px;
}

.bn-h5-header .bn-h5-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.bn-h5-header .bn-h5-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--bn-h5-chrome);
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--bn-radius, 0);
}

.bn-h5-header .bn-h5-icon-btn.is-open {
  background: var(--bn-bg-soft, #f7f7f7);
}

.bn-h5-header .bn-h5-icon-btn svg {
  position: relative;
  z-index: 1;
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.bn-h5-header .bn-h5-cart-badge {
  position: absolute;
  top: 6px;
  right: 4px;
  z-index: 2;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: #666;
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  display: none;
}

/* 商店分类 — 右侧抽屉（H5）：一级 150px，二级向左双列展开 */
.bn-h5-shop-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  width: 150px;
  max-width: min(150px, 85vw);
  z-index: 1201;
  background: transparent;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.28s ease, visibility 0.28s;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow: visible;
}

.bn-h5-shop-panel .bn-h5-shop-primary {
  width: 150px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bn-bg-soft, #f7f7f7);
  box-shadow: var(--bn-shadow, -4px 0 24px rgba(0, 0, 0, 0.08));
}

.bn-h5-shop-panel .bn-h5-cat-flyout {
  position: fixed;
  top: 0;
  right: 150px;
  bottom: 0;
  width: min(176px, calc(100vw - 150px - 8px));
  z-index: 1200;
  background: var(--bn-bg-soft, #f7f7f7);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.06);
  border-right: 1px solid var(--bn-border-light, #ebebeb);
  transform: translateX(12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.24s ease, opacity 0.24s ease, visibility 0.24s;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bn-h5-shop-panel .bn-h5-cat-flyout.is-open {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.bn-h5-shop-panel .bn-h5-cat-flyout-inner {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 8px 18px;
}

.bn-h5-shop-panel .bn-h5-cat-flyout-title {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 2px;
  color: var(--bn-text-muted);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--bn-border-light);
}

.bn-h5-shop-panel .bn-h5-cat-sub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 6px;
}

.bn-h5-shop-panel .bn-h5-cat-sub-grid .bn-h5-cat-sub {
  display: block;
  padding: 8px 2px;
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: 0.3px;
  color: var(--bn-h5-chrome);
  text-decoration: none;
  text-align: center;
  word-break: break-word;
  border: none;
}

.bn-h5-shop-panel .bn-h5-cat-sub-grid .bn-h5-cat-sub:active {
  color: var(--bn-gold-hover);
  background: var(--bn-bg-soft, #f7f7f7);
}

.bn-h5-shop-panel.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

.bn-h5-shop-panel .bn-h5-shop-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--bn-h5-header-h);
  padding: env(safe-area-inset-top, 0px) 12px 0 20px;
  border-bottom: 1px solid var(--bn-border-light, #ebebeb);
}

.bn-h5-shop-panel .bn-h5-shop-title {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 2px;
  color: var(--bn-h5-chrome);
}

.bn-h5-shop-panel .bn-h5-shop-close {
  width: 44px;
  height: 44px;
  border: none;
  background: var(--bn-bg-soft, #f7f7f7);
  font-size: 22px;
  line-height: 44px;
  text-align: center;
  color: var(--bn-text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.bn-h5-shop-panel .bn-h5-shop-close:active {
  background: var(--bn-border-light, #ebebeb);
  opacity: 0.85;
}

.bn-h5-shop-panel .bn-h5-shop-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.bn-h5-shop-panel .bn-h5-shop-top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--bn-border-light);
}

.bn-h5-shop-panel .bn-h5-shop-chip {
  display: inline-block;
  padding: 8px 14px;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--bn-h5-chrome);
  text-decoration: none;
  border: 1px solid var(--bn-border);
  background: var(--bn-bg);
}

.bn-h5-shop-panel .bn-h5-cat-list {
  padding: 4px 0;
}

.bn-h5-shop-panel .bn-h5-cat-block {
  border-bottom: 1px solid var(--bn-border-light);
}

.bn-h5-shop-panel .bn-h5-cat-toggle,
.bn-h5-shop-panel .bn-h5-cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 0;
  padding: 8px 10px;
  border: none;
  background: none;
  font-size: 14px;
  line-height: 1.4;
  color: var(--bn-h5-chrome);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bn-h5-shop-panel .bn-h5-cat-name {
  flex: 1;
  text-align: left;
  letter-spacing: 0.3px;
}

.bn-h5-shop-panel .bn-h5-cat-row {
  justify-content: flex-start;
}

.bn-h5-shop-panel .bn-h5-cat-arrow {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--bn-text-muted);
  border-bottom: 1.5px solid var(--bn-text-muted);
  transform: rotate(135deg);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.bn-h5-shop-panel .bn-h5-cat-block.is-open .bn-h5-cat-arrow {
  transform: rotate(-45deg);
}

.bn-h5-shop-panel .bn-h5-shop-bottom {
  padding: 12px 10px 20px;
  border-top: 1px solid var(--bn-border-light);
  margin-top: 8px;
}

.bn-h5-shop-panel .bn-h5-shop-link {
  display: block;
  padding: 12px 0;
  font-size: 13px;
  color: var(--bn-text-muted);
  text-decoration: none;
}

.bn-h5-shop-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1198;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s;
}

.bn-h5-shop-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* SPA：隐藏 Vue 内置顶栏，使用统一 H5 顶栏 */
html.bn-h5-spa #app .main-header,
html.bn-h5-spa #app .shop-mega-menu,
html.bn-h5-spa #app .bird-mega-menu,
html.bn-h5-spa #app .mega-menu-shell {
  display: none !important;
}

/* CMS / 旧版页头 */
html.bn-h5-with-header header.main-header {
  display: none !important;
}
