/* 产品列表样式 */
.product-list-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 10px;
  /* 固定布局：2排产品，每排2个 */
  justify-content: space-between;
  position: relative;
}

.product-list-header {
  text-align: center;
  margin-bottom: 20px;
}

.product-list-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 15px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.product-list-subtitle {
  font-size: 1.1rem;
  color: #7f8c8d;
  margin: 0;
  font-weight: 400;
}

.product-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px; /* 减少第一排和第二排之间的间距 */
  height: 100%;
  min-height: 0; /* 允许flex收缩 */
  /* 固定2排布局 */
  justify-content: space-between;
}

.product-row {
  flex: 1;
  min-height: 0; /* 允许flex收缩 */
  display: flex;
  gap: 15px;
}

.product-row .col-6 {
  flex: 1 !important; /* 平分行宽度 */
  height: 100% !important; /* 占满行高度 */
}

.product-card {
  background: #ffffff;
  border-radius: 12px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  margin: 0;
}

.product-card:hover {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

.product-image-container {
  position: relative;
  overflow: hidden;
  flex: 5;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: #e8e8e8;
  transition: transform 0.3s ease;
}

.product-card:hover .product-image {
  transform: scale(1.05);
}

.product-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
}

.product-badge.new {
  background: linear-gradient(135deg, #00d2d3, #54a0ff);
}

.product-badge.recommended {
  background: linear-gradient(135deg, #5f27cd, #341f97);
}

.product-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  flex-shrink: 0; /* 不压缩 */
  padding: 8px;
  /* 移除 min-height: 0，让容器能够充分扩展 */
}

/* 产品内容区域 - 包含标题、价格、属性 */
.product-content {
  flex: 1;
  min-height: 0;
}

/* 简化模式下的产品信息区域 */
.product-card.simple-mode .product-info {
  padding: 6px 10px; /* 简化模式较小的内边距 */
}

.product-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #2c3e50;
  margin: 5px 0px;
  line-height: 1.2;
  /* 文本省略功能 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 产品名称容器 - 左右布局 */
.product-name-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 5px 0px;
}

/* 产品详情链接样式 */
.product-details-link {
  color: #667eea;
  font-size: 1rem;
  text-decoration: none;
  font-weight: 600;
  padding: 5px 20px;
  border-radius: 15px;
  background: rgba(102, 126, 234, 0.1);
  transition: all 0.3s ease;
  flex-shrink: 0; /* 防止压缩 */
}

.product-details-link:hover {
  color: white;
  background: #667eea;
  text-decoration: none;
  transform: scale(1.05);
}

/* 确保产品名称不会被挤压 */
.product-name-text {
  flex: 1;
  margin-right: 8px;
  /* 文本省略功能 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0; /* 允许flex项目收缩到内容以下 */
  max-width: 170px;
}

.product-attributes {
  display: flex;
  flex-direction: column;
  gap: 4px; /* 减少属性间距 */
}

.attribute-item {
  display: flex;
  align-items: center;
  font-size: 0.8rem; /* 减小字体以节省空间 */
  line-height: 1.2; /* 紧凑行高 */
}

/* 完整模式下的属性样式 */
.product-card.full-mode .attribute-item {
  font-size: 0.85rem;
  gap: 6px;
}

/* 简化模式下隐藏属性 */
.product-card.simple-mode .product-attributes {
  display: none;
}

.attribute-label {
  font-weight: 600;
  color: #7f8c8d;
  min-width: 40px;
}

.attribute-value {
  color: #2c3e50;
  background: #f8f9fa;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 500;
  margin: 5px 0px;
}

/* 颜色选择器样式 */
.color-selector {
  display: flex;
  gap: 6px;
  margin-left: 8px;
}

.color-attribute {
  align-items: center !important;
}

.color-option {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  position: relative;
  flex-shrink: 0;
}

.color-option:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.color-option.active {
  border-color: #2c3e50;
  box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.3);
}

.color-option.active::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
}

/* 防止颜色选择器触发翻页 */
.color-selector,
.color-option {
  pointer-events: auto !important;
  position: relative;
  z-index: 10;
}

.product-price {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #ecf0f1;
  flex-shrink: 0; /* 不允许收缩 */
}

/* 完整模式下的价格样式 */
.price-label {
  font-size: 0.9rem;
  color: #7f8c8d;
  font-weight: 500;
}

.price-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #e74c3c;
}

/* 产品名称容器中的价格样式 */
.product-name-container .price-value {
  font-size: 1.125rem; /* 18px */
  font-weight: bold;
  white-space: nowrap;
  margin-left: 10px;
}

/* 智能显示模式样式 */
/* 完整模式 - 显示所有产品信息 */
.product-card.full-mode .product-attributes,
.product-card.full-mode .product-description-container,
.product-card.full-mode .product-price {
  display: block;
}

/* 简化模式 - 只显示基本信息 */
.product-card.simple-mode .product-attributes,
.product-card.simple-mode .product-description-container,
.product-card.simple-mode .product-price {
  display: none;
}

/* 简化模式下的产品信息区域调整 */
.product-card.simple-mode .product-info {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* 确保简化模式也保持2行×2列布局 */
.product-card.simple-mode {
  /* 保持固定的2×2网格布局 */
  min-height: 240px; /* 增加简化模式卡片最小高度 */
  display: flex;
  flex-direction: column;
}

/* 简化模式下的产品名称调整 */
.product-card.simple-mode .product-name {
  font-size: 1rem;
  margin: 8px 0;
  flex-shrink: 0;
}

/* 移除了紧凑高度模式样式，因为响应式设计已经能够很好地处理不同设备的显示 */

/* 产品操作区域 - 详情按钮和图标的容器 */
.product-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0px;
  border-top: 1px solid #e0e0e0;
  padding: 10px;
  flex-shrink: 0;
}

.product-actions .product-details-link:hover {
  color: #0056b3;
  text-decoration: none;
}

/* 产品购物车图标样式 - 新布局 */
.product-cart-icon {
  width: 32px;
  height: 32px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-left: auto; /* 推到右边 */
  z-index: 9999 !important; /* 使用最高z-index和!important */
  pointer-events: auto !important; /* 确保可以接收点击事件 */
  user-select: none; /* 防止文本选择 */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.product-cart-icon:hover {
  transform: scale(1.1);
}

.cart-icon-overlay {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  transition: all 0.3s ease;
  pointer-events: none !important; /* 防止图片本身接收事件 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.product-cart-icon:hover .cart-icon-overlay {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5)) brightness(1.2);
  transform: scale(1.05);
}

.product-cart-icon.cart-shake {
  animation: cartShake 0.6s ease-in-out;
}

.product-cart-icon.cart-remove-animation {
  animation: cartRemove 0.6s ease-in-out;
}

/* 移除动画 */
@keyframes cartRemove {
  0% {
    transform: scale(1) rotate(0deg);
  }
  25% {
    transform: scale(1.1) rotate(-5deg);
  }
  50% {
    transform: scale(0.9) rotate(5deg);
  }
  75% {
    transform: scale(1.05) rotate(-2deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

/* 查看询价图标样式 - 新布局 */
.product-inquiry-icon {
  width: 32px;
  height: 32px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-left: 15px;
  display: none;
}

.product-inquiry-icon:hover {
  transform: scale(1.1);
}

.product-inquiry-icon.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.product-inquiry-icon.disabled:hover {
  transform: none;
}

.inquiry-icon-overlay {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  transition: all 0.3s ease;
}

.product-inquiry-icon:hover .inquiry-icon-overlay {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5)) brightness(1.2);
  transform: scale(1.05);
}

.product-inquiry-icon.disabled .inquiry-icon-overlay {
  filter: grayscale(100%) opacity(0.5);
}

.product-inquiry-icon.disabled:hover .inquiry-icon-overlay {
  filter: grayscale(100%) opacity(0.5);
  transform: none;
}

/* 成功提示覆盖层样式 */
.cart-success-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 99999;
}

.cart-success-overlay.show {
  opacity: 1;
}

.cart-success-message {
  background: #10b981;
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  transform: scale(0);
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.cart-success-overlay.show .cart-success-message {
  transform: scale(1);
}

/* 移除成功提示样式 - 使用红色主题 */
.remove-success .cart-success-message {
  background: #dc2626 !important;
  color: white !important;
}

.remove-success .fas.fa-times-circle {
  color: white !important;
}

.remove-success.show .cart-success-message {
  transform: scale(1);
}

/* 动画效果 */
@keyframes cartBounce {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes cartShake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-3px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(3px);
  }
}

.shopping-cart-fixed.cart-shake {
  animation: cartShake 0.6s ease-in-out;
}

/* 默认隐藏产品标题区域的颜色选择器（只在横向平板端显示） */
.product-name-container .color-selector-area {
  display: none;
}

/* PC端和其他设备的默认产品名称容器布局 */
.product-name-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
}

.product-name-container .product-name {
  flex: 1;
  margin-right: 10px;
  text-align: left; /* PC端左对齐 */
}

/* 响应式设计 - 只针对平板横屏、笔记本、PC端和超大屏幕 */

/* 平板横屏 768px - 1366px */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
  .product-grid {
    gap: 15px;
  }

  .product-row {
    gap: 12px;
  }

  .product-card {
    border-radius: 10px;
  }

  .product-name {
    font-size: 1rem;
  }
  .product-attributes {
    display: none;
  }
  .product-image-container {
    flex: auto;
  }
  .price-value {
    font-size: 1.2rem;
  }

  .attribute-item {
    font-size: 0.75rem;
  }

  .product-actions {
    padding: 8px;
  }

  .product-cart-icon,
  .product-inquiry-icon {
    width: 28px;
    height: 28px;
  }
}
@media (min-width: 768px) and (max-width: 1366px) and (orientation: landscape) {
  /* 当显示8个产品时的特殊样式 */

  .product-grid.eight-products .product-row {
    gap: 0px;
  }

  .product-grid.eight-products .product-row .col-6 {
    flex: 0 0 25% !important; /* 每个产品占25%宽度，实现每行4个 */
    max-width: 25% !important;
  }

  .product-grid.eight-products .product-card {
    min-height: 200px;
  }

  .product-grid.eight-products .product-name {
    font-size: 0.9rem;
    line-height: 1.2;
    /* 更严格的文本省略控制 */
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .product-grid.eight-products .price-value {
    font-size: 1.1rem;
  }

  .product-grid.eight-products .product-info {
    flex: none;
    padding: 6px 8px;
  }

  .product-grid.eight-products .product-actions {
    padding: 6px;
  }

  .product-grid.eight-products .product-cart-icon,
  .product-grid.eight-products .product-inquiry-icon {
    width: 24px;
    height: 24px;
  }
}

/* 笔记本 1025px - 1280px */
@media (min-width: 1025px) and (max-width: 1280px) {
  .product-grid {
    gap: 18px;
  }
  .attribute-item {
    display: none;
  }
  .product-image-container {
    flex: auto;
  }
  .product-row {
    gap: 15px;
  }
  .product-attributes {
    display: none;
  }
  .product-card {
    border-radius: 12px;
  }

  .product-name {
    font-size: 1.1rem;
  }

  .price-value {
    font-size: 1.3rem;
  }

  .attribute-item {
    font-size: 0.8rem;
  }

  .product-actions {
    padding: 10px;
  }

  .product-cart-icon,
  .product-inquiry-icon {
    width: 32px;
    height: 32px;
  }
  .product-info {
    flex: none;
  }
}

/* 响应式设计 - 平板端优化 */
@media (min-width: 1180px) and (max-width: 1280px) and (orientation: landscape) {
  .attribute-item {
    display: none;
  }
  .product-image-container {
    flex: auto;
  }
  .product-info {
    flex: none;
  }
}

/* PC端 1281px 以上 */
@media (min-width: 1281px) and (max-width: 1365px) and (orientation: landscape) {
  .attribute-item {
    display: none;
  }
  .product-image-container {
    flex: auto;
  }
  .product-info {
    flex: none;
  }
}
@media (min-width: 1366px) and (max-width: 1499px) and (orientation: landscape) {
  .attribute-item {
    display: none;
  }
  .product-image-container {
    flex: auto;
  }
  .product-info {
    flex: none;
  }
}
@media (min-width: 1500px) and (max-width: 1699px) and (orientation: landscape) {
  .product-attributes {
    display: none;
  }
  .product-image-container {
    flex: auto;
  }
  .product-info {
    flex: none;
  }
}
/* 超大屏幕 1920px 以上 */
@media (min-width: 1920px) {
  .product-grid {
    gap: 25px;
  }

  .product-row {
    gap: 20px;
  }

  .product-card {
    border-radius: 16px;
  }

  .product-name {
    font-size: 1.3rem;
    max-width: 100%;
  }

  .price-value {
    font-size: 1.5rem;
  }

  .attribute-item {
    font-size: 0.9rem;
  }

  .product-actions {
    padding: 14px;
  }

  .product-cart-icon,
  .product-inquiry-icon {
    width: 40px;
    height: 40px;
  }
}
