/* 全局样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

/* 顶部导航样式 */
.header {
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.top-bar {
  background: #f8f9fa;
  padding: 8px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #666;
}

.location {
  color: #e74c3c;
  font-weight: bold;
}

.user-actions a {
  color: #666;
  text-decoration: none;
  margin-left: 15px;
  transition: color 0.3s;
}

.user-actions a:hover {
  color: #e74c3c;
}

.login-btn,
.register-btn {
  padding: 6px 12px;
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.3s;
}

.login-btn {
  color: #666;
  border: 1px solid #ddd;
}

.login-btn:hover {
  color: #e74c3c;
  border-color: #e74c3c;
  background: rgba(231, 76, 60, 0.1);
}

.register-btn {
  color: white;
  background: #e74c3c;
  border: 1px solid #e74c3c;
}

.register-btn:hover {
  background: #c0392b;
  border-color: #c0392b;
  color: white;
}

.main-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
}

.logo {
  display: flex;
  align-items: center;
}

.logo img {
  height: 50px;
  width: auto;
  margin-right: 15px;
}

.logo h1 {
  margin: 0;
  font-size: 24px;
  color: #333;
  font-weight: bold;
}

.search-box {
  display: flex;
  flex: 1;
  max-width: 500px;
  margin: 0 20px;
}

.search-box input {
  flex: 1;
  padding: 10px 15px;
  border: 2px solid #e74c3c;
  border-radius: 25px 0 0 25px;
  outline: none;
  font-size: 14px;
}

.search-box button {
  padding: 10px 20px;
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: 0 25px 25px 0;
  cursor: pointer;
  transition: background 0.3s;
}

.search-box button:hover {
  background: #c0392b;
}

.cart {
  position: relative;
  cursor: pointer;
  padding: 10px;
  border-radius: 50%;
  transition: background 0.3s;
}

.cart:hover {
  background: #f8f9fa;
}

.cart-icon {
  font-size: 24px;
}

.cart-count {
  position: absolute;
  top: 5px;
  right: 5px;
  background: #e74c3c;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

/* 主导航菜单 */
.category-nav {
  background: #e74c3c;
  padding: 10px 0;
}

.category-list {
  display: flex;
  list-style: none;
  gap: 30px;
}

.category-list a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.3s;
}

.category-list a:hover {
  opacity: 0.8;
}

/* 主要内容区域 */
.main-content {
  padding: 20px 0;
}

.main-content .container {
  display: flex;
  gap: 20px;
}

/* 侧边栏样式 */
.sidebar {
  width: 250px;
  flex-shrink: 0;
}

.category-menu {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.category-menu h3 {
  background: #e74c3c;
  color: white;
  padding: 15px;
  margin: 0;
  font-size: 16px;
}

.category-menu ul {
  list-style: none;
}

.category-item {
  position: relative;
  border-bottom: 1px solid #f0f0f0;
}

.category-item span {
  display: block;
  padding: 12px 15px;
  cursor: pointer;
  transition: background 0.3s;
}

.category-item:hover span {
  background: #f8f9fa;
  color: #e74c3c;
}

.sub-category {
  background: #f8f9fa;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease-in-out, padding 0.5s ease-in-out;
}

.category-item:hover .sub-category {
  max-height: 300px;
  padding: 10px 0;
}

.sub-category li {
  padding: 8px 25px;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  transition: color 0.3s;
}

.sub-category li:hover {
  color: #e74c3c;
}

/* 内容区域 */
.content {
  flex: 1;
}

/* 轮播图样式 */
.banner-section {
  margin-bottom: 30px;
}

.banner-slider {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.banner {
  display: none;
  width: 100%;
}

.banner.active {
  display: block;
}

.banner img {
  width: 100%;
  height: 300px;
  object-fit: cover;
}

.banner-nav {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
}

.nav-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background 0.3s;
}

.nav-dot.active {
  background: white;
}

/* 商品卡片样式 */
.featured-products {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.featured-products h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 20px;
  position: relative;
  padding-left: 15px;
}

.featured-products h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  background: #e74c3c;
  border-radius: 2px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.product-card {
  text-align: center;
  padding: 15px;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  transition: transform 0.3s, box-shadow 0.3s;
  background: white;
  position: relative;
  overflow: hidden;
}

.product-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #e74c3c, #f39c12);
  transform: scaleX(0);
  transition: transform 0.3s;
}

.product-card:hover::before {
  transform: scaleX(1);
}

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

.product-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 10px;
  transition: transform 0.3s;
}

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

.product-card h3 {
  font-size: 16px;
  margin-bottom: 5px;
  color: #333;
  font-weight: 600;
}

.product-card .brand {
  font-size: 12px;
  color: #666;
  margin-bottom: 8px;
  font-weight: 500;
}

.price-info {
  margin-bottom: 10px;
}

.product-card .price {
  color: #e74c3c;
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 2px;
}

.product-card .original-price {
  color: #999;
  font-size: 12px;
  text-decoration: line-through;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 12px;
}

.product-meta .rating {
  color: #f39c12;
  font-weight: 500;
}

.product-meta .sales {
  color: #666;
}

.add-to-cart {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 14px;
  width: 100%;
  font-weight: 500;
}

.add-to-cart:hover {
  background: #c0392b;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* 分类展示样式 */
.category-showcase {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.category-showcase h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 20px;
  position: relative;
  padding-left: 15px;
}

.category-showcase h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  background: #e74c3c;
  border-radius: 2px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.category-card {
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  padding: 15px;
  transition: box-shadow 0.3s;
}

.category-card:hover {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.category-card h3 {
  color: #e74c3c;
  margin-bottom: 15px;
  font-size: 16px;
  font-weight: 600;
}

.category-products {
  display: flex;
  gap: 15px;
}

.mini-product {
  text-align: center;
  flex: 1;
  transition: transform 0.3s;
}

.mini-product:hover {
  transform: translateY(-3px);
}

.mini-product img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 5px;
  border: 2px solid transparent;
  transition: border-color 0.3s;
}

.mini-product:hover img {
  border-color: #e74c3c;
}

.mini-product span {
  font-size: 12px;
  color: #666;
  display: block;
  line-height: 1.3;
}

/* 页脚样式 */
.footer {
  background: #2c3e50;
  color: white;
  padding: 40px 0 20px;
  margin-top: 50px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.footer-section h4 {
  color: #e74c3c;
  margin-bottom: 15px;
  font-size: 16px;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 8px;
}

.footer-section ul li a {
  color: #bdc3c7;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.3s;
}

.footer-section ul li a:hover {
  color: white;
}

.footer-bottom {
  border-top: 1px solid #34495e;
  padding-top: 20px;
  text-align: center;
  font-size: 12px;
  color: #bdc3c7;
}

.footer-bottom p {
  margin-bottom: 5px;
}

/* 购物车弹窗样式 */
.cart-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
}

.cart-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  width: 90%;
  max-width: 500px;
  border-radius: 8px;
  box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #f0f0f0;
}

.cart-header h3 {
  margin: 0;
  color: #333;
}

.close-cart {
  font-size: 24px;
  cursor: pointer;
  color: #666;
  transition: color 0.3s;
}

.close-cart:hover {
  color: #e74c3c;
}

.cart-items {
  max-height: 300px;
  overflow-y: auto;
  padding: 20px;
}

.cart-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.cart-item img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  margin-right: 15px;
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-weight: bold;
  margin-bottom: 5px;
}

.cart-item-price {
  color: #e74c3c;
  font-weight: bold;
}

.cart-item-quantity {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 15px;
}

.quantity-btn {
  background: #f0f0f0;
  border: none;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.3s;
}

.quantity-btn:hover {
  background: #e74c3c;
  color: white;
}

.cart-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-top: 1px solid #f0f0f0;
}

.cart-total {
  font-size: 18px;
  font-weight: bold;
  color: #e74c3c;
}

.checkout-btn {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  cursor: pointer;
  transition: background 0.3s;
}

.checkout-btn:hover {
  background: #c0392b;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .main-nav {
    flex-direction: column;
    gap: 15px;
  }

  .search-box {
    margin: 0;
    max-width: 100%;
  }

  .category-list {
    flex-wrap: wrap;
    gap: 15px;
  }

  .main-content .container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .product-card {
    padding: 10px;
  }

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

  .product-card .price {
    font-size: 16px;
  }
}
