/**
 * 工业设备产品卡片 v4 - PbootCMS 版本
 * 基于 industrial-product-card-v2，保持现有卡片尺寸
 * 新特性：图片轮播、彩色特征标签、规格标签、金色价格
 */

/* ========================================
   CSS 变量 - 继承暗色主题
   ======================================== */
:root {
  --card-bg: #ffffff;
  --card-border: #e5e7eb;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --accent-color: #1a56db;
  --accent-hover: #1e40af;
  --price-gold: #d97706;
  --price-gold-hover: #b45309;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 暗色主题变量覆盖 */
.product-dark {
  --card-bg: #1f2937;
  --card-border: #374151;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --accent-color: #3b82f6;
  --accent-hover: #60a5fa;
  --price-gold: #fbbf24;
  --price-gold-hover: #f59e0b;
}

/* ========================================
   产品列表容器 - 保持现有 3 列布局
   ======================================== */
.product-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  max-width: 1400px;
}

.product-list-header {
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--accent-color);
}

.product-list-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.product-list-header p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

/* ========================================
   产品卡片容器 - 保持现有尺寸
   ======================================== */
.product-card {
  position: relative;
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: visible;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  box-shadow: var(--shadow-xl);
  border-color: var(--accent-color);
  transform: translateY(-6px);
}

/* 全卡片隐形链接 */
.card-link-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: pointer;
}

/* ========================================
   图片区域 - 带轮播功能
   ======================================== */
.product-card-img-wrapper {
  position: relative;
  width: 100%;
  height: 220px; /* 保持现有高度 */
  overflow: hidden;
  border-radius: 12px 12px 0 0;
  background: #f9fafb;
  z-index: 0;
}

.product-dark .product-card-img-wrapper {
  background: #374151;
}

.product-card-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, opacity 0.3s ease;
}

.product-card:hover .product-card-img-wrapper img {
  transform: scale(1.08);
}

/* 图片遮罩层 */
.image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.25), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.product-card:hover .image-overlay {
  opacity: 1;
}

/* ========================================
   图片轮播导航
   ======================================== */
.image-nav {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 5;
}

.product-card:hover .image-nav {
  opacity: 1;
  pointer-events: auto;
}

.nav-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: none;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.nav-btn:hover {
  background: #ffffff;
  transform: scale(1.1);
}

.nav-btn svg {
  width: 18px;
  height: 18px;
  color: var(--text-primary);
}

/* 图片指示器 */
.image-indicators {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  z-index: 10;
}

.indicator {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.5);
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  padding: 0;
}

.indicator.active {
  width: 24px;
  background: rgba(255, 255, 255, 0.95);
}

.indicator:not(.active) {
  width: 6px;
}

.indicator:not(.active):hover {
  background: rgba(255, 255, 255, 0.8);
}

/* ========================================
   彩色特征标签（图片上）
   ======================================== */
.product-card-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  z-index: 3;
  pointer-events: none;
}

.product-card-badges .badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 5px;
  color: #ffffff;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-md);
  animation: fadeInDown 0.4s ease forwards;
  opacity: 0;
  transform: translateY(-10px);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.product-card-badges .badge:nth-child(1) { animation-delay: 0.1s; }
.product-card-badges .badge:nth-child(2) { animation-delay: 0.2s; }
.product-card-badges .badge:nth-child(3) { animation-delay: 0.3s; }

@keyframes fadeInDown {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 彩色标签颜色 */
.product-card-badges .badge.badge-tech { background: rgba(59, 130, 246, 0.9); }
.product-card-badges .badge.badge-cert { background: rgba(16, 185, 129, 0.9); }
.product-card-badges .badge.badge-industry { background: rgba(245, 158, 11, 0.9); }
.product-card-badges .badge.badge-supply { background: rgba(139, 92, 246, 0.9); }
.product-card-badges .badge.badge-hot { background: rgba(239, 68, 68, 0.9); }
/* 保持向后兼容的颜色 */
.product-card-badges .badge.badge-blue { background: rgba(26, 86, 219, 0.9); }
.product-card-badges .badge.badge-green { background: rgba(22, 163, 74, 0.9); }
.product-card-badges .badge.badge-orange { background: rgba(234, 88, 12, 0.9); }
.product-card-badges .badge.badge-purple { background: rgba(124, 58, 237, 0.9); }
.product-card-badges .badge.badge-red { background: rgba(220, 38, 38, 0.9); }
.product-card-badges .badge.badge-teal { background: rgba(13, 148, 136, 0.9); }
.product-card-badges .badge.badge-pink { background: rgba(219, 39, 119, 0.9); }
.product-card-badges .badge.badge-yellow { background: rgba(202, 138, 4, 0.9); }
.product-card-badges .badge.badge-indigo { background: rgba(79, 70, 229, 0.9); }
.product-card-badges .badge.badge-gray { background: rgba(75, 85, 99, 0.9); }

/* ========================================
   内容区域 - 紧凑布局
   ======================================== */
.product-card-body {
  padding: 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--card-bg);
  border-radius: 0 0 12px 12px;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.product-card-body > * {
  pointer-events: auto;
}

/* ========================================
   标题区域 - 仅标题悬停放大
   ======================================== */
.title-container {
  position: relative;
  height: 50px;
  margin-bottom: 8px;
  z-index: 20;
}

.product-card-title {
  margin: 0;
}

.product-card-title a {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.5;
  text-decoration: none;

  /* 默认：两行省略 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;

  /* 绝对定位 */
  position: absolute;
  top: 0;
  left: -12px;
  width: calc(100% + 24px);
  padding: 0 12px;

  transition: var(--transition-spring);
  border-radius: 8px;
  background: transparent;
  transform-origin: center center;
}

/* 只有鼠标移到标题上才放大 */
.product-card-title a:hover {
  -webkit-line-clamp: unset;
  display: block;
  z-index: 100;
  background: var(--card-bg);

  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04),
    0 0 0 1px rgba(0, 0, 0, 0.05);

  transform: scale(1.08);
  padding-top: 10px;
  padding-bottom: 10px;
  color: var(--accent-color);
}

/* ========================================
   规格标签（3个）- 替代简介
   ======================================== */
.product-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.spec-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 5px;
  border: 1px solid var(--card-border);
}

.product-dark .spec-item {
  background: rgba(255, 255, 255, 0.05);
}

.spec-item svg {
  width: 14px;
  height: 14px;
  color: var(--accent-color);
  flex-shrink: 0;
}

/* ========================================
   价格区间 - 金色 + 悬停放大
   ======================================== */
.product-card-price {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--card-border);
}

.price-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-color);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.price-range,
.price-inquiry {
  font-size: 18px;
  font-weight: 700;
  color: var(--price-gold);
  display: flex;
  align-items: baseline;
  gap: 6px;
  transition: transform 0.2s ease, color 0.2s ease;
}

/* 悬停放大效果 */
.price-range:hover,
.price-inquiry:hover {
  transform: scale(1.08);
  color: var(--price-gold-hover);
}

.price-from,
.price-to {
  font-size: 18px;
}

.price-separator {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
}

.price-inquiry {
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.price-inquiry svg {
  width: 16px;
  height: 16px;
}

/* ========================================
   底部标签（可选）
   ======================================== */
.product-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.product-card-tags:empty {
  display: none;
}

.product-card-tags .tag {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  border: 1px solid transparent;
  cursor: default;
}

.product-card-tags .tag:hover {
  transform: translateY(-1px);
}

/* 多彩标签颜色 */
.product-card-tags .tag.tag-blue { background: #eff6ff; color: #1d4ed8; }
.product-card-tags .tag.tag-green { background: #f0fdf4; color: #16a34a; }
.product-card-tags .tag.tag-orange { background: #fff7ed; color: #ea580c; }
.product-card-tags .tag.tag-purple { background: #faf5ff; color: #9333ea; }
.product-card-tags .tag.tag-teal { background: #f0fdfa; color: #0d9488; }
.product-card-tags .tag.tag-red { background: #fef2f2; color: #dc2626; }
.product-card-tags .tag.tag-pink { background: #fdf2f8; color: #db2777; }
.product-card-tags .tag.tag-yellow { background: #fefce8; color: #ca8a04; }
.product-card-tags .tag.tag-indigo { background: #eef2ff; color: #4f46e5; }
.product-card-tags .tag.tag-gray { background: #f3f4f6; color: #374151; }

/* 暗色主题标签适配 */
.product-dark .product-card-tags .tag.tag-blue { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.product-dark .product-card-tags .tag.tag-green { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.product-dark .product-card-tags .tag.tag-orange { background: rgba(251, 146, 60, 0.15); color: #fdba74; }
.product-dark .product-card-tags .tag.tag-purple { background: rgba(168, 85, 247, 0.15); color: #d8b4fe; }
.product-dark .product-card-tags .tag.tag-teal { background: rgba(45, 212, 191, 0.15); color: #5eead4; }
.product-dark .product-card-tags .tag.tag-red { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.product-dark .product-card-tags .tag.tag-pink { background: rgba(236, 72, 153, 0.15); color: #f9a8d4; }
.product-dark .product-card-tags .tag.tag-yellow { background: rgba(234, 179, 8, 0.15); color: #fde047; }
.product-dark .product-card-tags .tag.tag-indigo { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; }
.product-dark .product-card-tags .tag.tag-gray { background: rgba(156, 163, 175, 0.15); color: #d1d5db; }

/* ========================================
   View Details 按钮
   ======================================== */
.product-card-footer {
  padding: 0 18px 18px;
}

.btn-view-details {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-color);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  z-index: 10;
}

.btn-view-details::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-view-details:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  color: #ffffff;
}

.btn-view-details:hover::before {
  opacity: 1;
}

.btn-view-details svg {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.btn-view-details:hover svg {
  transform: translateX(4px);
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 1200px) {
  .product-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
}

@media (max-width: 768px) {
  .product-list {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .product-card-img-wrapper {
    height: 200px;
  }

  .product-card-body {
    padding: 16px;
  }

  .title-container {
    height: 46px;
  }

  .product-card-title a {
    font-size: 15px;
  }

  .price-range,
  .price-inquiry {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .product-card-body {
    padding: 14px;
    gap: 8px;
  }

  .product-card-title a {
    font-size: 14px;
  }

  .btn-view-details {
    height: 40px;
    font-size: 13px;
  }
}

/* ========================================
   保留现有左侧菜单样式（不修改）
   ======================================== */
/* 菜单容器 */
.product-nav {
  background: transparent;
  padding: 0;
  border: none;
  margin: 0;
  list-style: none;
}

.product-nav-item {
  margin: 8px 0;
  list-style: none;
}

.product-nav-link {
  display: block;
  padding: 12px 16px;
  color: #cbd5e1;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  font-weight: 500;
}

.product-nav-item .product-nav-link {
  background: transparent;
}

.product-nav-item:hover .product-nav-link {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.1));
  padding-left: 18px;
  border-radius: 8px;
}

.product-nav-item.current .product-nav-link {
  color: #ffffff;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(139, 92, 246, 0.2) 100%);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.nav-arrow {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.3s ease;
  opacity: 0.5;
  margin-left: 8px;
}

.product-nav-item.current .nav-arrow {
  opacity: 1;
  transform: rotate(45deg);
}

/* 二级菜单 */
.product-subnav {
  max-height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  transition: all 0.3s ease !important;
  background: transparent;
  margin: 0;
  padding: 0;
  list-style: none;
}

.product-nav-item.expanded .product-subnav {
  max-height: 500px !important;
  opacity: 1 !important;
  padding: 8px 0 !important;
}

.product-subnav-item {
  list-style: none;
}

.product-subnav-link {
  display: block;
  padding: 8px 16px 8px 32px;
  color: #a0aec0;
  text-decoration: none;
  font-size: 13px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.product-subnav-link:hover {
  color: #ffffff;
  padding-left: 36px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 4px;
}

.product-subnav-item.active .product-subnav-link {
  color: #3b82f6;
  font-weight: 600;
  padding-left: 36px;
  background: rgba(59, 130, 246, 0.15);
  border-radius: 4px;
}

/* ========================================
   加载状态
   ======================================== */
.product-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(17, 24, 39, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  z-index: 100;
  border-radius: 12px;
}

.product-loading-overlay.active {
  display: flex;
}

.product-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(59, 130, 246, 0.3);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
