/* 新版官网共用样式：购物车下拉 + 用户菜单 + 提示浮层 */
/* 卡片容器（挂在购物车图标上） */
.nw-cart {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.nw-cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: inherit;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.nw-cart-count {
  position: absolute;
  top: -8px;
  right: -10px;
  display: none;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #b52328;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 600;
}
.nw-cart-count.show {
  display: block;
}

/* 下拉购物车 */
.nw-cart-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 12px;
  width: 400px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  z-index: 70;
  display: none;
  overflow: hidden;
  color: #171a20;
  text-align: left;
}
.nw-cart-dropdown.show {
  display: block;
}
.nw-cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e8e8e8;
  font-weight: 600;
  font-size: 15px;
}
.nw-cart-clear {
  font-size: 13px;
  color: #666;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.nw-cart-clear:hover {
  background: #f5f5f5;
  color: #b52328;
}
.nw-cart-items {
  max-height: 380px;
  overflow-y: auto;
  padding: 4px 16px;
}
.nw-cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
  position: relative;
}
.nw-cart-item:last-child {
  border-bottom: none;
}
.nw-cart-item-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 4px;
  flex-shrink: 0;
  background: #fff;
}
.nw-cart-item-info {
  flex: 1;
  min-width: 0;
}
.nw-cart-item-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.nw-cart-item-oem {
  font-size: 12px;
  color: #888;
  margin-bottom: 6px;
}
.nw-cart-item-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nw-cart-item-price {
  font-size: 14px;
  font-weight: 600;
  color: #b52328;
}
.nw-cart-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
}
.nw-cart-stepper button {
  width: 26px;
  height: 26px;
  border: none;
  background: #f7f7f7;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  color: #171a20;
}
.nw-cart-stepper button:hover {
  background: #ededed;
}
.nw-cart-stepper input {
  width: 38px;
  height: 26px;
  border: none;
  border-left: 1px solid #e0e0e0;
  border-right: 1px solid #e0e0e0;
  text-align: center;
  font-size: 12px;
  outline: none;
}
.nw-cart-del {
  border: none;
  background: none;
  color: #bbb;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  flex-shrink: 0;
}
.nw-cart-del:hover {
  color: #b52328;
}
.nw-cart-empty {
  padding: 36px 0;
  text-align: center;
  color: #999;
  font-size: 14px;
}
.nw-cart-footer {
  padding: 12px 16px 14px;
  border-top: 1px solid #e8e8e8;
  font-size: 13px;
  background: #fafafa;
}
.nw-cart-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  color: #555;
}
.nw-cart-row span:last-child {
  font-weight: 600;
  color: #171a20;
}
.nw-cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 12px;
  font-size: 15px;
  font-weight: 600;
}
.nw-cart-total span:last-child {
  color: #b52328;
  font-size: 18px;
}
.nw-cart-checkout {
  display: block;
  width: 100%;
  border: none;
  border-radius: 9999px;
  background: #171a20;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 0;
  cursor: pointer;
  text-align: center;
}
.nw-cart-checkout:hover {
  background: #000;
}

/* 用户菜单 */
.nw-user {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.nw-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 0;
  max-width: 120px;
}
.nw-user-btn .nw-user-name {
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nw-user-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 10px;
  min-width: 140px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  z-index: 70;
  padding: 6px;
  color: #171a20;
  text-align: left;
}
.nw-user-menu a {
  display: block;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: #171a20;
  text-decoration: none;
}
.nw-user-menu a:hover {
  background: #f5f5f5;
}

/* 全局提示浮层 */
#nwToast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  background: #171a20;
  color: #fff;
  font-size: 14px;
  padding: 10px 22px;
  border-radius: 9999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  max-width: calc(100vw - 40px);
  text-align: center;
}
#nwToast.show {
  opacity: 1;
}

/* 加载中遮罩 */
#nwLoading {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(255, 255, 255, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
}
#nwLoading.show {
  display: flex;
}
#nwLoading .nw-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e5e5e5;
  border-top-color: #b52328;
  border-radius: 50%;
  animation: nw-spin 0.8s linear infinite;
}
@keyframes nw-spin {
  to {
    transform: rotate(360deg);
  }
}
