/* =============================================
   nav-popups.css — 顶部导航弹窗模块样式
   包含：共享遮罩、消息/优惠券/购物车/个人中心 4 个下拉弹窗
   依赖：common.css（CSS 变量）
   ============================================= */

/* =============================================
   共享：遮罩层
   ============================================= */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.40);
  z-index: 899;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.nav-overlay.active {
  display: block;
  opacity: 1;
}

body.nav-scroll-lock {
  overflow: hidden;
  padding-right: var(--nav-scrollbar, 0px);
}

/* =============================================
   共享：弹窗基础
   ============================================= */
.nav-popup {
  position: fixed;
  z-index: 900;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.10),
    0  4px  6px -4px rgba(0, 0, 0, 0.10);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  overflow: hidden;
}

.nav-popup.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* 弹窗头部 */
.nav-popup__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
}

.nav-popup__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-dark);
}

.nav-popup__view-all {
  font-size: 12px;
  color: var(--color-primary);
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.nav-popup__view-all:hover { opacity: 0.75; }

/* 弹窗脚部 */
.nav-popup__foot {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
}

/* =============================================
   消息通知弹窗
   ============================================= */
.nav-popup--notify {
  width: 359px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.10),
    0  4px  6px -4px rgba(0, 0, 0, 0.10);
}

.nav-popup--notify .nav-popup__head {
  height: 57px;
  padding: 0 16px;
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
}

.nav-popup--notify .nav-popup__title {
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  color: #1a1a1a;
}

.notify-popup__close {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #666;
  cursor: pointer;
  padding: 0;
}

.notify-popup__close:hover {
  color: #333;
}

.notify-popup__close svg,
.notify-popup__close img {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.nav-popup--notify .nav-popup__body {
  max-height: 246px;
  overflow-y: auto;
}

.notify-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 82px;
  padding: 16px;
  border-bottom: 1px solid #ddd;
  text-decoration: none;
  transition: background 0.15s ease, opacity 0.15s ease;
  cursor: pointer;
}

.notify-item:last-child { border-bottom: none; }

.notify-item:hover { opacity: 0.95; }

.notify-item--unread {
  background: #fff5f5;
}

.notify-item__icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.notify-item__icon img.notify-item__icon img,
.notify-item__icon img.notify-item__icon svg {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.notify-item__content {
  flex: 1;
  min-width: 0;
}

.notify-item__text {
  font-size: 14px;
  line-height: 21px;
  font-weight: 500;
  color: #1a1a1a;
  margin: 0;
}

.notify-item__time {
  display: block;
  margin-top: 7px;
  font-size: 12px;
  line-height: 18px;
  color: #999;
}

.notify-item__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e31e24;
  margin-top: 4px;
}

.notify-item:not(.notify-item--unread) .notify-item__dot {
  display: none;
}

.nav-popup--notify .nav-popup__foot {
  height: 57px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid #ddd;
}

.notify-popup__view-all-btn {
  font-size: 14px;
  line-height: 21px;
  font-weight: 500;
  color: #e31e24;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.notify-popup__view-all-btn:hover {
  opacity: 0.85;
}

/* =============================================
   优惠券弹窗
   ============================================= */
.nav-popup--coupon {
  width: 340px;
}

.coupon-list {
  max-height: 340px;
  overflow-y: auto;
}

.coupon-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.15s ease;
  cursor: pointer;
}

.coupon-item:last-child { border-bottom: none; }

.coupon-item:hover { background: #f7f7f7; }

/* 红色面值标签 */
.coupon-item__badge {
  flex-shrink: 0;
  width: 60px;
  height: 44px;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.coupon-item__amount {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.coupon-item__unit {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.85;
  margin-top: 2px;
}

.coupon-item__info {
  flex: 1;
  min-width: 0;
}

.coupon-item__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coupon-item__exp {
  font-size: 11px;
  color: var(--color-text-hint);
  margin-top: 3px;
}

.coupon-item__use {
  flex-shrink: 0;
  padding: 5px 10px;
  background: var(--color-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}

.coupon-item__use:hover { background: var(--color-primary-hover); }

/* 过期灰色 */
.coupon-item.expired .coupon-item__badge {
  background: #bbb;
}

.coupon-item.expired .coupon-item__use {
  background: #bbb;
  pointer-events: none;
}

/* =============================================
   优惠券弹窗（Figma v2，仅在 .nav-popup--coupon-v2 生效）
   ============================================= */
.nav-popup--coupon.nav-popup--coupon-v2 {
  width: 282px;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.10),
    0 8px 10px -6px rgba(0, 0, 0, 0.10);
}

.nav-popup--coupon-v2 .nav-popup__head {
  display: block;
  padding: 16px;
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
}

.nav-popup--coupon-v2 .coupon-popup__head-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-popup--coupon-v2 .nav-popup__title {
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  color: #333;
}

.nav-popup--coupon-v2 .coupon-popup__sub {
  font-size: 12px;
  line-height: 18px;
  font-weight: 400;
  color: rgba(51, 51, 51, 0.8);
}

.nav-popup--coupon-v2 .coupon-list {
  max-height: 360px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.nav-popup--coupon-v2 .coupon-item--card {
  position: relative;
  height: 83px;
  border: 1px solid #ffd4d4;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff5f5 0%, #ffe8e8 100%);
  padding: 12px;
  cursor: default;
  overflow: hidden;
}

.nav-popup--coupon-v2 .coupon-item--card:hover {
  background: linear-gradient(180deg, #fff5f5 0%, #ffe8e8 100%);
}

.nav-popup--coupon-v2 .coupon-item--card:last-child {
  border-bottom: 1px solid #ffd4d4;
}

.nav-popup--coupon-v2 .coupon-item__deco {
  position: absolute;
  top: -30px;
  right: -6px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(227, 30, 36, 0.05);
}

.nav-popup--coupon-v2 .coupon-item__body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-popup--coupon-v2 .coupon-item__amount-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  line-height: 1;
}

.nav-popup--coupon-v2 .coupon-item__amount {
  font-size: 24px;
  line-height: 36px;
  font-weight: 700;
  color: #e31e24;
}

.nav-popup--coupon-v2 .coupon-item__unit {
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  color: #e31e24;
}

.nav-popup--coupon-v2 .coupon-item__validity {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-popup--coupon-v2 .coupon-item__calendar {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  object-fit: contain;
}

.nav-popup--coupon-v2 .coupon-item__exp {
  margin-top: 0;
  font-size: 11px;
  line-height: 16px;
  color: #999;
}

.nav-popup--coupon-v2 .nav-popup__foot {
  padding: 12px;
  background: #fafafa;
  border-top: 1px solid #eee;
}

.nav-popup--coupon-v2 .coupon-popup__view-all-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  width: 100%;
  border-radius: 6px;
  background: #e31e24;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  line-height: 21px;
  font-weight: 600;
  transition: background 0.15s ease;
}

.nav-popup--coupon-v2 .coupon-popup__view-all-btn:hover {
  background: #c3181d;
}

.nav-popup--coupon-v2 .coupon-popup__view-all-btn img {
  width: 14px;
  height: 14px;
}

/* =============================================
   购物车弹窗
   ============================================= */
.nav-popup--cart {
  width: 360px;
}

.cart-popup-list {
  max-height: 300px;
  overflow-y: auto;
}

.cart-popup-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}

.cart-popup-item:last-child { border-bottom: none; }

.cart-popup-item__img {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 4px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cart-popup-item__img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}.cart-popup-item__img svg, .cart-popup-item__img img{
  width: 28px;
  height: 28px;
  stroke: #ccc;
}

.cart-popup-item__info {
  flex: 1;
  min-width: 0;
}

.cart-popup-item__name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-dark);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-popup-item__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.cart-popup-item__qty {
  font-size: 12px;
  color: var(--color-text-muted);
}

.cart-popup-item__price {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
}

/* 购物车底部汇总 */
.cart-popup-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 0;
}

.cart-popup-summary__label {
  font-size: 13px;
  color: var(--color-text-muted);
}

.cart-popup-summary__total {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-dark);
}

.cart-popup-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
}

.cart-popup-btn {
  flex: 1;
  height: 40px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-align: center;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cart-popup-btn--outline {
  background: #fff;
  border: 1.5px solid var(--color-border);
  color: var(--color-text-body);
}

.cart-popup-btn--outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.cart-popup-btn--primary {
  background: var(--color-primary);
  color: #fff;
}

.cart-popup-btn--primary:hover {
  background: var(--color-primary-hover);
}

/* =============================================
   个人中心弹窗
   ============================================= */
.nav-popup--personal {
  width: 215px;
}

.personal-menu-item {
  display: flex;
  align-items: center;
  height: 46px;
  padding: 0 15px;
  font-size: 14px;
  font-weight: 400;
  color: var(--color-text-body);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.personal-menu-item:last-child {
  border-bottom: none;
}

.personal-menu-item:hover {
  background: #f7f7f7;
}

.personal-menu-item--logout {
  height: 45px;
  color: var(--color-primary);
  font-weight: 500;
  border-bottom: none;
}

.personal-menu-item--logout:hover {
  background: #fff5f5;
  color: var(--color-primary-hover);
}/* 覆盖 home.css 遗留的 .header-user.open svg 旋转规则，用户图标不旋转 */
.header-user.open svg, /* 覆盖 home.css 遗留的 .header-user.open img 旋转规则，用户图标不旋转 */
.header-user.open img, .header-user.open .chevron-down-svg{
  transform: none;
}

/* =============================================
   响应式
   ============================================= */
@media (max-width: 768px) {
  .nav-popup--notify,
  .nav-popup--coupon,
  .nav-popup--cart,
  .nav-popup--personal {
    width: calc(100vw - 32px);
    max-width: 360px;
  }
}

@media (max-width: 480px) {
  .nav-popup {
    width: 100% !important;
    max-width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    border-radius: 12px 12px 0 0;
    transform: translateY(60px);
  }

  .nav-popup.active {
    transform: translateY(0);
  }
}
