/* 全局样式 */
:root {
  --primary-color: #0066cc;
  --secondary-color: #ff6600;
  --bg-color: #f5f5f5;
  --text-color: #333;
  --border-color: #e0e0e0;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Microsoft YaHei", "SimHei", "Source Han Sans CN", sans-serif;
  font-size: 14px;
  color: var(--text-color);
  background-color: #fff;
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
}

a:hover {
  color: var(--primary-color);
}

img {
  max-width: 100%;
  height: auto;
}

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

.header-top {
  background-color: var(--primary-color);
  color: #fff;
  padding: 12px 0;
  font-size: 18px;
}

.header-top .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-top .user-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-top .user-actions .btn {
  padding: 8px 20px;
  font-size: 16px;
  background-color: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
}

.header-top .user-actions .btn:hover {
  background-color: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.header-top .user-actions .btn-primary {
  background-color: rgba(255, 255, 255, 0.25);
}

.header-top .user-actions .btn-secondary {
  background-color: var(--secondary-color);
}

.header-main {
  padding: 22.5px 0;
}

.header-main .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  font-size: 36px;
  font-weight: bold;
  color: var(--primary-color);
}

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

.user-actions {
  display: flex;
  align-items: center;
  gap: 22.5px;
}

.user-actions .btn {
  padding: 12px 30px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 21px;
  transition: all 0.3s;
}

.btn-primary {
  background-color: var(--primary-color);
  color: #fff;
}

.btn-primary:hover {
  background-color: #0052a3;
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: #fff;
}

.btn-secondary:hover {
  background-color: #e55a00;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 21px;
}

.user-avatar {
  width: 52.5px;
  height: 52.5px;
  border-radius: 50%;
  background-color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  font-size: 21px;
}

/* 导航样式 */
.navbar {
  background-color: #fff;
  border-top: 1px solid var(--border-color);
}

.navbar .container {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.navbar-nav {
  display: flex !important;
  flex-direction: row !important;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: nowrap !important;
  align-items: center;
  width: 100%;
}

.navbar-nav li {
  position: relative;
  white-space: nowrap;
  flex-shrink: 0 !important;
  display: inline-block;
  float: none;
}

.navbar-nav a {
  display: block;
  padding: 12px 20px;
  color: var(--text-color);
  font-size: 16px;
  transition: all 0.3s;
}

.navbar-nav a:hover {
  color: var(--primary-color);
  background-color: #f0f7ff;
}

.navbar-nav .active a {
  color: var(--primary-color);
  font-weight: bold;
}

/* 下拉菜单 */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  min-width: 180px;
  display: none;
  z-index: 100;
}

.dropdown:hover .dropdown-menu {
  display: block;
}

.dropdown-menu li {
  border-bottom: 1px solid var(--border-color);
}

.dropdown-menu li:last-child {
  border-bottom: none;
}

.dropdown-menu a {
  padding: 12px 20px;
  font-size: 14px;
}

/* 购物车图标 */
.cart-icon {
  position: relative;
  font-size: 20px;
  color: var(--text-color);
  cursor: pointer;
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: var(--secondary-color);
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
}

/* 主要内容区域 */
.main-content {
  min-height: calc(100vh - 300px);
  padding: 30px 0;
}

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

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

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

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

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

.footer-section a {
  color: #bdc3c7;
  transition: color 0.3s;
}

.footer-section a:hover {
  color: #fff;
}

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

.footer-bottom .icp-info {
  margin-bottom: 10px;
  font-size: 13px;
  color: #ecf0f1;
}

/* 卡片样式 */
.card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: all 0.3s;
}

.card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background-color: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
}

.card-body {
  padding: 15px;
}

.card-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 10px;
  color: var(--text-color);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-price {
  font-size: 20px;
  font-weight: bold;
  color: var(--secondary-color);
  margin-bottom: 10px;
}

.card-price .original-price {
  font-size: 14px;
  color: #999;
  text-decoration: line-through;
  margin-left: 10px;
}

.card-meta {
  font-size: 12px;
  color: #999;
  margin-bottom: 10px;
}

.card-actions {
  display: flex;
  gap: 10px;
}

.btn-buy {
  flex: 1;
  background-color: #dc3545;
  color: #fff;
  border: none;
  padding: 8px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
}

.btn-buy:hover {
  background-color: #c82333;
}

.btn-cart {
  flex: 1;
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  padding: 8px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
}

.btn-cart:hover {
  background-color: #0052a3;
}

/* 文章卡片 */
.article-card {
  margin-bottom: 20px;
}

.article-card .card-body {
  display: flex;
  flex-direction: column;
}

.article-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
  color: var(--primary-color);
}

.article-abstract {
  font-size: 14px;
  color: #666;
  margin-bottom: 15px;
  line-height: 1.8;
  flex: 1;
}

.article-price {
  font-size: 24px;
  font-weight: bold;
  color: var(--secondary-color);
  margin-bottom: 10px;
}

.article-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #999;
  margin-top: auto;
}

/* 筛选和排序 */
.filter-section {
  background-color: #fff;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.filter-label {
  font-weight: bold;
  color: var(--text-color);
}

.filter-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 15px;
  border: 1px solid var(--border-color);
  background-color: #fff;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 14px;
}

.filter-btn:hover,
.filter-btn.active {
  background-color: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

/* 商品网格 */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 30px;
}

.pagination a,
.pagination span {
  padding: 8px 15px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-color);
  transition: all 0.3s;
}

.pagination a:hover,
.pagination .active {
  background-color: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

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

  .navbar .container {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .navbar-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: auto;
    min-width: 100%;
  }

  .navbar-nav li {
    width: auto;
    flex-shrink: 0;
    display: inline-block;
  }

  .navbar-nav a {
    padding: 10px 15px;
    font-size: 14px;
  }

  .dropdown-menu {
    position: absolute;
    display: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .dropdown:hover .dropdown-menu {
    display: block;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
  }

  .filter-group {
    flex-direction: column;
    align-items: flex-start;
  }

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

/* 加载动画 */
.loading {
  text-align: center;
  padding: 40px;
  color: #999;
}

.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 提示消息 */
.alert {
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.alert-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-info {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* 表单样式 */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: var(--text-color);
}

.form-control {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  transition: all 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.form-control.error {
  border-color: #dc3545;
}

.error-message {
  color: #dc3545;
  font-size: 12px;
  margin-top: 5px;
}

/* 模态框 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background-color: #fff;
  border-radius: 8px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 20px;
  font-weight: bold;
  color: var(--text-color);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  transition: color 0.3s;
}

.modal-close:hover {
  color: var(--text-color);
}

/* 工具类 */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-20 {
  margin-top: 20px;
}

.mb-20 {
  margin-bottom: 20px;
}

.mt-30 {
  margin-top: 30px;
}

.mb-30 {
  margin-bottom: 30px;
}
