/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  color: #333;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 60px 0;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(30px, 30px) rotate(180deg); }
}

.header .container {
  position: relative;
  z-index: 1;
}

.header-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: 1px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.header-desc {
  font-size: 1.1rem;
  opacity: 0.95;
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.8;
}

/* Category Navigation */
.category-nav {
  background: white;
  padding: 20px 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.category-nav .container {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.category-tab {
  padding: 12px 28px;
  border: 2px solid #667eea;
  background: white;
  color: #667eea;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.category-tab:hover {
  background: #667eea;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.category-tab.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Main Content */
.main-content {
  padding: 50px 0;
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 30px;
}

/* Product Card */
.product-card {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

.product-image {
  position: relative;
  width: 100%;
  height: 280px;
  overflow: hidden;
  background: #f8f9fa;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.product-card:hover .product-image img {
  transform: scale(1.05);
}

.image-count {
  position: absolute;
  bottom: 15px;
  right: 15px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

/* 火爆标识 */
.hot-badge {
  position: absolute;
  top: 15px;
  left: 15px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  color: white;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 15px rgba(238, 90, 111, 0.4);
  animation: pulse 2s ease-in-out infinite;
  z-index: 2;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.hot-icon {
  font-size: 1rem;
  line-height: 1;
}

.hot-text {
  white-space: nowrap;
}

.product-info {
  padding: 25px;
}

.product-series {
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 15px;
}

.product-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 15px;
  line-height: 1.4;
}

.product-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
}

.detail-item.features .value {
  line-height: 1.5;
}

.label {
  font-weight: 600;
  color: #718096;
  min-width: 50px;
  flex-shrink: 0;
}

.value {
  color: #2d3748;
  flex: 1;
}

.color-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-tag {
  background: #edf2f7;
  color: #4a5568;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
}

.detail-item.note {
  background: #fff5f5;
  padding: 10px;
  border-radius: 10px;
  margin-top: 5px;
}

.detail-item.note .label {
  color: #e53e3e;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-content img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transition: opacity 0.3s ease;
}

/* 图片加载动画 */
.image-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  z-index: 10;
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loader-text {
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
}

.modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  font-size: 40px;
  color: white;
  cursor: pointer;
  transition: transform 0.3s ease;
  z-index: 1001;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  transform: rotate(90deg);
}

.modal-images-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 20px;
  background: rgba(255, 255, 255, 0.1);
  padding: 12px 25px;
  border-radius: 30px;
  backdrop-filter: blur(10px);
}

.nav-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 10px 25px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.3);
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-info {
  color: white;
  font-size: 1rem;
  font-weight: 600;
  min-width: 60px;
  text-align: center;
}

/* 加载动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.product-card {
  animation: fadeIn 0.5s ease;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #667eea;
}

/* ==================== 移动端优化 ==================== */

/* 平板设备 */
@media (max-width: 768px) {
  .header {
    padding: 40px 0;
  }
  
  .header-title {
    font-size: 1.8rem;
  }
  
  .header-desc {
    font-size: 1rem;
    padding: 0 20px;
  }
  
  .category-nav {
    padding: 15px 0;
  }
  
  .category-tab {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
  
  .products-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .product-image {
    height: 250px;
  }
  
  .product-info {
    padding: 20px;
  }
  
  .product-name {
    font-size: 1.1rem;
  }
  
  .detail-item {
    font-size: 0.85rem;
  }
  
  .modal-content img {
    max-height: 70vh;
  }
  
  .nav-btn {
    padding: 8px 18px;
    font-size: 0.85rem;
  }
}

/* 手机设备 - 主要优化 */
@media (max-width: 480px) {
  /* 容器优化 */
  .container {
    padding: 0 12px;
  }
  
  /* Header 优化 */
  .header {
    padding: 35px 15px;
    min-height: auto;
  }
  
  .header-title {
    font-size: 1.4rem;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
    line-height: 1.3;
  }
  
  .header-desc {
    font-size: 0.9rem;
    line-height: 1.6;
    padding: 0 5px;
  }
  
  /* 分类导航优化 - 横向滚动 */
  .category-nav {
    padding: 12px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }
  
  .category-nav .container {
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 10px;
    padding-left: 12px;
    padding-right: 12px;
    justify-content: flex-start;
    flex-wrap: nowrap;
  }
  
  .category-nav .container::-webkit-scrollbar {
    display: none;
  }
  
  .category-tab {
    padding: 10px 18px;
    font-size: 0.85rem;
    border-radius: 25px;
    flex-shrink: 0;
    min-width: auto;
  }
  
  .category-tab:active {
    transform: scale(0.95);
  }
  
  /* 主内容区域 */
  .main-content {
    padding: 20px 0 40px;
    background: transparent;
  }
  
  /* 产品网格优化 */
  .products-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 0 12px;
  }
  
  /* 产品卡片优化 */
  .product-card {
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 0;
  }
  
  .product-card:active {
    transform: scale(0.98);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  }
  
  .product-image {
    height: 200px;
    position: relative;
  }
  
  .product-image img {
    border-radius: 16px 16px 0 0;
  }
  
  .image-count {
    bottom: 10px;
    right: 10px;
    padding: 6px 12px;
    font-size: 0.75rem;
    border-radius: 15px;
  }
  
  .hot-badge {
    top: 10px;
    left: 10px;
    padding: 6px 10px;
    font-size: 0.7rem;
    border-radius: 15px;
  }
  
  .hot-icon {
    font-size: 0.85rem;
  }
  
  .product-info {
    padding: 16px;
  }
  
  .product-series {
    font-size: 0.75rem;
    padding: 5px 12px;
    margin-bottom: 10px;
    border-radius: 15px;
  }
  
  .product-name {
    font-size: 1rem;
    margin-bottom: 12px;
    line-height: 1.4;
  }
  
  .product-detail {
    gap: 8px;
  }
  
  .detail-item {
    font-size: 0.8rem;
    gap: 8px;
    align-items: flex-start;
  }
  
  .label {
    min-width: 45px;
    font-size: 0.75rem;
  }
  
  .value {
    font-size: 0.8rem;
    line-height: 1.5;
  }
  
  .color-tags {
    gap: 6px;
  }
  
  .color-tag {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 10px;
  }
  
  .detail-item.note {
    padding: 8px;
    margin-top: 3px;
    border-radius: 8px;
  }
  
  .detail-item.note .label,
  .detail-item.note .value {
    font-size: 0.75rem;
  }
  
  /* Modal 优化 */
  .modal {
    padding: 0;
    background: rgba(0, 0, 0, 0.98);
  }
  
  .modal-content {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    padding: 50px 10px 100px;
    justify-content: center;
  }
  
  .modal-content img {
    max-height: 65vh;
    max-width: 100%;
    border-radius: 8px;
  }
  
  .modal-close {
    position: fixed;
    top: 15px;
    right: 15px;
    font-size: 32px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .modal-images-nav {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0;
    padding: 10px 20px;
    border-radius: 25px;
    gap: 15px;
  }
  
  .nav-btn {
    padding: 10px 20px;
    font-size: 0.8rem;
    border-radius: 18px;
    min-width: 70px;
  }
  
  .page-info {
    font-size: 0.9rem;
    min-width: 50px;
  }
  
  /* 移动端加载动画 */
  .image-loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  .loader-spinner {
    width: 45px;
    height: 45px;
    border-width: 3px;
  }
  
  .loader-text {
    font-size: 0.85rem;
  }
  
  /* 触摸手势提示 */
  .swipe-hint {
    display: block;
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    text-align: center;
    animation: fadeInOut 2s infinite;
  }
  
  @keyframes fadeInOut {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
  }
}

/* 超小屏幕优化 */
@media (max-width: 360px) {
  .header {
    padding: 30px 12px;
  }
  
  .header-title {
    font-size: 1.2rem;
  }
  
  .header-desc {
    font-size: 0.85rem;
  }
  
  .category-tab {
    padding: 8px 14px;
    font-size: 0.8rem;
  }
  
  .product-image {
    height: 180px;
  }
  
  .product-name {
    font-size: 0.95rem;
  }
  
  .detail-item {
    font-size: 0.75rem;
  }
  
  .color-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
  }
  
  .footer {
    padding: 25px 0;
    margin-top: 30px;
  }
  
  .copyright {
    font-size: 0.85rem;
  }
}

/* 横屏模式优化 */
@media (max-width: 896px) and (orientation: landscape) {
  .modal-content img {
    max-height: 80vh;
  }
  
  .modal-images-nav {
    bottom: 15px;
  }
}

/* 高分辨率手机 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .product-card {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
  }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e2e8f0;
  }
  
  .category-nav {
    background: #1e293b;
  }
  
  .category-tab {
    background: #1e293b;
    border-color: #667eea;
    color: #667eea;
  }
  
  .category-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
  }
  
  .product-card {
    background: #1e293b;
  }
  
  .product-name {
    color: #e2e8f0;
  }
  
  .label {
    color: #94a3b8;
  }
  
  .value {
    color: #cbd5e1;
  }
  
  .color-tag {
    background: #334155;
    color: #cbd5e1;
  }
}

/* 安全区域适配 (iPhone X及以上) */
@supports (padding-top: env(safe-area-inset-top)) {
  .header {
    padding-top: calc(60px + env(safe-area-inset-top));
  }
  
  .category-nav {
    top: env(safe-area-inset-top);
  }
  
  .modal-images-nav {
    bottom: calc(30px + env(safe-area-inset-bottom));
  }
  
  .modal-close {
    top: calc(15px + env(safe-area-inset-top));
  }
}

/* 触摸反馈动画 */
@media (hover: none) and (pointer: coarse) {
  .product-card:active {
    transform: scale(0.98);
  }
  
  .category-tab:active {
    transform: scale(0.95);
  }
  
  .nav-btn:active {
    transform: scale(0.95);
  }
}

/* Footer */
.footer {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-align: center;
  padding: 30px 0;
  margin-top: 50px;
}

.copyright {
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* 打印样式 */
@media print {
  .category-nav,
  .modal,
  .footer {
    display: none !important;
  }
  
  .product-card {
    break-inside: avoid;
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
