/* =============================================
   common.css — 全局公共样式
   包含：CSS变量、reset、基础排版、通用组件
   ============================================= */

/* ---------- CSS 变量 ---------- */
:root {
  /* 品牌色 */
  --color-primary:       #e31e24;
  --color-primary-hover: #c51a1f;
  --color-primary-active:#a81519;

  /* 文字色 */
  --color-text-dark:   #1a1a1a;
  --color-text-body:   #333333;
  --color-text-muted:  #666666;
  --color-text-hint:   #999999;
  --color-text-placeholder: rgba(51, 51, 51, 0.5);
  --color-text-white:  #ffffff;

  /* 边框 / 背景 */
  --color-border:      #dddddd;
  --color-bg-white:    #ffffff;
  --color-bg-page:     #191919;

  /* 字体 */
  --font-family:       'Roboto', 'Noto Sans', sans-serif;

  /* 圆角 */
  --radius-sm: 4px;
  --radius-md: 8px;

  /* 阴影 */
  --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.06);

  /* 动画 */
  --transition-base: 0.2s ease;
}

/* ---------- CSS Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text-body);
  background-color: var(--color-bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  outline: none;
  border: none;
  background: transparent;
}

img,
svg {
  display: block;
  max-width: 100%;
}

ul,
ol {
  list-style: none;
}

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  padding: 0 24px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--transition-base),
              transform var(--transition-base),
              box-shadow var(--transition-base);
  border: none;
  width: 100%;
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-text-white);
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  box-shadow: 0 4px 12px rgba(227, 30, 36, 0.35);
}

.btn-primary:active {
  background-color: var(--color-primary-active);
  transform: translateY(1px);
  box-shadow: none;
}

/* ---------- 通用链接 ---------- */
.link {
  color: var(--color-primary);
  font-weight: 700;
  cursor: pointer;
  transition: opacity var(--transition-base);
}

.link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* ---------- 工具类 ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ---------- 全站顶部导航统一 ---------- */
.site-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 100 !important;
  width: 100% !important;
  min-height: 128px;
}

.header-top {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  height: 72px !important;
  background: var(--color-text-dark) !important;
  gap: 24px !important;
  padding: 0 !important;
}

.header-main{
  max-width: 1400px !important;
  margin: 0 auto !important;
}

.header-nav {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  height: 56px !important;
  padding:0 !important;
  background: var(--color-text-dark) !important;
  gap: 24px !important;
}

.header-nav__cats {
  display: flex !important;
  align-items: center !important;
  gap: 35px !important;
  flex: 1 !important;
  min-width: 0 !important;
  overflow: visible !important;
}

/* Nav category dropdown wrapper */
.nav-cat-wrap {
  position: relative !important;
  display: inline-flex !important;
  align-items: stretch !important;
}

/* Keep nav-cat highlighted while panel is open */
.nav-cat-wrap:hover .nav-cat {
  color: var(--color-primary) !important;
}

.nav-cat-wrap:hover .nav-chevron {
  background-color: var(--color-primary) !important;
  transform: rotate(180deg) !important;
}

.header-nav__right {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  flex-shrink: 0 !important;
}

/* Category nav links */
.nav-cat {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-size: 16px !important;
  font-weight: 400 !important;
  color: #fff !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  text-transform: capitalize !important;
  transition: color 0.15s !important;
  line-height: 27px !important;
  position: relative !important;
}

.nav-cat:hover {
  color: var(--color-primary) !important;
}

.nav-cat--filters {
  font-weight: 600 !important;
  color: var(--color-primary) !important;
}

.nav-cat--active {
  color: var(--color-primary) !important;
}

.nav-cat--dropdown .nav-chevron {
  width: 12px !important;
  height: 12px !important;
  display: inline-block !important;
  flex-shrink: 0 !important;
  background-color: #fff !important;
  -webkit-mask: url('/static/home/icon/shop-chevron-down.svg') center / contain no-repeat !important;
  mask: url('/static/home/icon/shop-chevron-down.svg') center / contain no-repeat !important;
  transition: transform 0.15s, background-color 0s !important;
  transform: rotate(-180deg) !important;
}

.nav-cat--dropdown:hover .nav-chevron {
  background-color: var(--color-primary) !important;
  transform: rotate(360deg) !important;
}


/* Shop circle icon button */
.btn-shop-circle {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  border: none !important;
  background: #fff !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  text-decoration: none !important;
  transition: background 0.15s !important;

}
.btn-shop-circle a img{
  filter: brightness(0) invert(1) !important;
}
.btn-shop-circle:hover {
  background: #e8e8e8 !important;
}

.btn-shop-circle img {
  width: 20px !important;
  height: 20px !important;
  filter: brightness(0) !important;
  display: block !important;
}

/* Vehicle Fitment button (red) */
.btn-vehicle-fitment {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  height: 40px !important;
  padding: 0 20px !important;
  background: var(--color-primary) !important;
  color: #fff !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  border: none !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  transition: background 0.15s !important;
}

.btn-vehicle-fitment:hover {
  background: #c0181d !important;
}

.btn-vehicle-fitment img {
  width: 18px !important;
  height: 18px !important;
  filter: brightness(0) invert(1) !important;
  display: block !important;
  flex-shrink: 0 !important;
}

/* Legacy nav-link kept for backward compat */
.nav-link {
  font-size: 16px !important;
  font-weight: 600 !important;
  color: #fff !important;
}

/* Legacy btn-vehicle kept for backward compat */
.btn-vehicle {
  display: none !important;
}

/* ---------- Header 图标显示统一 ---------- */
.site-header .header-actions .action-icon-btn > img {
  width: 24px !important;
  height: 24px !important;
  object-fit: contain !important;
  filter: brightness(0) invert(1) !important;
}

.site-header .header-actions .header-user > .user-avatar {
  width: 24px !important;
  height: 24px !important;
  border-radius: 50% !important;
  overflow: hidden !important;
  object-fit: cover !important;
  filter: none !important;
}

.site-header .header-actions .header-user > .user-avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #c62828;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1;
  flex-shrink: 0;
}

.site-header .header-actions .header-user > .chevron-down-svg {
  width: 16px !important;
  height: 16px !important;
  object-fit: contain !important;
  filter: brightness(0) invert(1) !important;
  transform: rotate(180deg) !important;
}
.nav-scroll-lock .site-header .header-actions .header-user > .chevron-down-svg {
  transform: rotate(0deg) !important;
}
.new_header{
  position: fixed;
  inset: 0 0 auto;
  background-color: var(--color-text-dark);
}
@media (max-width: 1800px) {
  .header-nav {
    /* padding: 0 80px !important; */
  }

  .header-nav__cats {
    gap: 24px !important;
  }

  .nav-cat {
    font-size: 15px !important;
  }
}

@media (max-width: 1400px) {
  .header-nav {
    padding: 0 40px !important;
  }

  .header-nav__cats {
    gap: 14px !important;
  }

  .nav-cat {
    font-size: 14px !important;
  }
}

@media (max-width: 1200px) {
  .header-top,
  .header-nav {
    padding: 0 24px !important;
  }

  .header-nav__cats {
    gap: 16px !important;

  }
 .header-nav__cats .nav-cat-wrap:nth-child(9){
    display: none !important;
  }
  .nav-cat {
    font-size: 14px !important;
  }
}
@media (max-width: 900px) {
  .header-nav__cats .nav-cat-wrap:nth-child(7){
    display: none !important;
  }
}
@media (max-width: 1000px) {
    .header-nav__cats .nav-cat-wrap:nth-child(8){
      display: none !important;
    }
}
@media (max-width: 768px) {
  .header-top,
  .header-nav {
    padding: 0 16px !important;
  }

  /* Hide category nav on mobile (including Home) */
  .header-nav__cats {
    display: none !important;
  }

  /* Homepage nav: shop button left, then search, then vehicle fitment */
  .header-nav {
    justify-content: flex-start !important;
    gap: 8px !important;
  }

  .header-nav__right {
    display: contents !important;
  }

  .header-nav .btn-shop-circle {
    order: 0 !important;
    flex-shrink: 0 !important;
  }

  .header-nav .nav-search {
    order: 1 !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  .header-nav .btn-vehicle-fitment {
    order: 2 !important;
    flex-shrink: 0 !important;
  }
 
}

/* ---------- 个人中心侧栏状态统一 ---------- */
.personal-sidebar__item:not(.personal-sidebar__item--active) .personal-sidebar__item-icon,
.per-sidebar__item:not(.per-sidebar__item--active) .per-sidebar__item-icon {
  color: #666 !important;
  filter: brightness(0) saturate(100%) invert(42%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(65%) contrast(98%);
}

.personal-sidebar__item:not(.personal-sidebar__item--active) .personal-sidebar__item-label,
.per-sidebar__item:not(.per-sidebar__item--active) .per-sidebar__item-label,
.per-sidebar__item:not(.per-sidebar__item--active) .per-sidebar__item-arrow {
  color: #666 !important;
}

.personal-sidebar__item:not(.personal-sidebar__item--active) .personal-sidebar__item-arrow {
  filter: brightness(0) saturate(100%) invert(76%) sepia(0%) saturate(0%) hue-rotate(180deg) brightness(88%) contrast(88%) !important;
}

.personal-sidebar__item--active .personal-sidebar__item-icon,
.personal-sidebar__item--active .personal-sidebar__item-label,
.per-sidebar__item--active .per-sidebar__item-icon,
.per-sidebar__item--active .per-sidebar__item-label,
.per-sidebar__item--active .per-sidebar__item-arrow {
  color: var(--color-primary) !important;
}

.personal-sidebar__item--active .personal-sidebar__item-arrow {
  filter: brightness(0) saturate(100%) invert(18%) sepia(97%) saturate(2918%) hue-rotate(345deg) brightness(96%) contrast(92%) !important;
}

.personal-sidebar__item--active img.personal-sidebar__item-icon,
.per-sidebar__item--active img.per-sidebar__item-icon {
  filter: brightness(0) saturate(100%) invert(16%) sepia(93%) saturate(3911%) hue-rotate(349deg) brightness(92%) contrast(96%) !important;
}

/* ---------- 全局 Toast：手机端避免文案被裁切 ---------- */
.toast #toast-msg {
  flex: 1;
  min-width: 0;
  white-space: normal;
  word-break: break-word;
}

@media (max-width: 640px) {
  .toast {
    left: 16px !important;
    right: 16px !important;
    bottom: max(16px, env(safe-area-inset-bottom, 0px)) !important;
    width: auto !important;
    max-width: none !important;
    transform: translateY(24px) !important;
  }

  .toast.show,
  .toast.is-visible {
    transform: translateY(0) !important;
  }

}
@media (max-width: 480px) {
  .site-header{
    min-height: 110px;
  }
}
