* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Microsoft YaHei', sans-serif;
}

body {
  background-color: #f5f5f5;
  color: #333;
}

/* 标题栏样式 */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background-color: #2c3e50;
  color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: relative;
}

.logo {
  font-size: 24px;
  font-weight: bold;
}

.logo a {
  text-decoration: none;
  color: white;
}

/* 搜索栏样式 */
.search-container {
  position: absolute;
  left: 20%;
  width: 400px;
  z-index: 100;
}

.search-box {
  display: flex;
  width: 100%;
}

.search-input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 20px 0 0 20px;
  outline: none;
  font-size: 14px;
}

.search-btn {
  padding: 10px 20px;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 0 20px 20px 0;
  cursor: pointer;
  transition: background-color 0.3s;
}

.search-btn:hover {
  background-color: #2980b9;
}

.categories {
  display: flex;
  gap: 20px;
}

.category {
  padding: 8px 15px;
  background-color: #d4d4d4;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
  text-decoration: none;
}

.category:hover {
  background-color: #9e9e9e;
}

/* 主要内容区域 */
.main-content {
  display: flex;
  max-width: 1200px;
  margin: 20px auto;
  gap: 20px;
}

/* 左侧内容区 */
.left-content {
  flex: 2;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.content-item {
  background-color: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s;
  cursor: pointer;
  position: relative;
}

.content-item:hover {
  transform: translateY(-5px);
}

.item-image {
  height: 180px;
  background-color: #ecf0f1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.item-image img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.item-text {
  height: 120px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.item-title {
  font-weight: bold;
  margin-bottom: 8px;
}

.item-description {
  color: #7f8c8d;
  font-size: 14px;
  line-height: 1.4;
}

/* 右侧内容区 */
.right-content {
  flex: 1;
  background-color: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.daily-updates-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.update-list {
  list-style: none;
}

.update-item {
  padding: 12px 0;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.update-item:last-child {
  border-bottom: none;
}

.update-content {
  margin-bottom: 5px;
}

.update-time {
  font-size: 12px;
  color: #95a5a6;
}

.page-btn:hover {
  background-color: #2980b9;
}

.page-btn:hover:not(.active) {
  background-color: #03497b;
}

.page-dots {
  padding: 5px;
}

.loading {
  text-align: center;
  padding: 20px;
  display: none;
}

.page-btn.active {
  background-color: #007bff;
  color: white;
  border-color: #007bff;
}

/* 资源详情页样式补充 */
.resource-container {
  max-width: 1000px;
  margin: 30px auto;
  padding: 20px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 资源元信息样式 */
.resource-meta {
    margin: 10px 0;
    color: #666;
    font-size: 0.9em;
}

/* 资源描述样式 */
.resource-description {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
}

.resource-description h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.resource-description p {
    margin-bottom: 0;
    line-height: 1.6;
}

.image-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  /* 2列布局 */
  gap: 15px;
  margin: 20px 0;
}

.image-gallery img {
  width: 100%;
  height: auto;
  /* 图片自适应 */
  object-fit: contain;
  border-radius: 6px;
  background: #f5f5f5;
}

.back-button {
  display: block;
  width: 120px;
  margin: 20px auto;
  padding: 10px;
  background: #3498db;
  color: white;
  text-align: center;
  border-radius: 4px;
  text-decoration: none;
}


.locked-content {
  background: #f5f5f5;
  padding: 20px;
  text-align: center;
  border-radius: 5px;
}

.btn-purchase {
  padding: 10px 20px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background: white;
  margin: 15% auto;
  padding: 20px;
  width: 300px;
  border-radius: 5px;
}

.close {
  float: right;
  cursor: pointer;
}

.btn-confirm {
  padding: 8px 16px;
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.resource-content {
  padding: 20px;
  line-height: 1.6;
  font-size: 16px;
}

.resource-title {
  font-size: 24px;
  margin-bottom: 15px;
  color: #2c3e50;
}

/* 活跃分类样式 */
.category.active {
  background-color: #2c3e50;
}

/* 新增搜索相关样式 */
.search-results h2 {
  padding: 20px 0;
  border-bottom: 1px solid #eee;
  color: #2c3e50;
}

/* 搜索页专属样式 */
.search-header {
  grid-column: 1 / -1;
  padding: 20px 0;
  border-bottom: 1px solid #eee;
}

.search-header h2 {
  color: #2c3e50;
  margin-bottom: 5px;
}

.search-header p {
  color: #7f8c8d;
  font-size: 14px;
}

.item-category {
  display: inline-block;
  padding: 2px 8px;
  background: #ecf0f1;
  border-radius: 4px;
  font-size: 12px;
  color: #3498db;
}

.search-sidebar {
  background: #f9f9f9;
  padding: 15px;
  border-radius: 8px;
}

/* 排序按钮样式 */
.sort-options {
  text-align: center;
  margin: 20px 0;
  padding: 15px;
  background: #f5f5f5;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* 翻页样式 */
.pagination-container {
  display: flex;
  justify-content: space-between;
  margin: 20px 200px;
  align-items: center;
}

.pagination {
  display: flex;
  justify-content: center;
  margin: 30px 0;
  gap: 10px;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-block;
  padding: 8px 15px;
  background-color: #3498db;
  color: white;
  cursor: pointer;
  transition: background-color 0.3s;
  text-decoration: none;
  padding: 10px 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
}


.sort-btn {
  display: inline-block;
  padding: 10px 16px;
  margin: 0 5px;
  background: #ecf0f1;
  color: #333;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.3s;
  border: 1px solid #e1e1e1;
}

.sort-btn:hover {
  background-color: #f0f0f0;
}

.sort-btn.active {
  background-color: #007bff;
  color: white;
  border-color: #007bff;
}

.username {
  margin-right: 8px;
}

.user-icon {
  font-size: 16px;
}

/* 下拉菜单样式 */
.dropdown-menu {
  display: none;
  position: absolute;
  background: white;
  min-width: 120px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  z-index: 1000;
  border-radius: 4px;
  right: 20px;
  top: 60px;
}

.dropdown-menu a {
  display: block;
  padding: 10px 15px;
  color: #333;
  text-decoration: none;
}

.dropdown-menu a:hover {
  background: #f5f5f5;
}

#authDropdown:hover + #authMenu,
#authMenu:hover {
  display: block;
}

/* 目录样式 */
.directory-title {
    font-size: 20px;
    font-weight: bold;
    padding: 15px 20px;
    border-bottom: 1px solid #c7c6c6;
    background-color: #a9ffff;
    color: #333;
    margin-top: 15px;
}

.directory-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px;
}

.directory-btn {
    padding: 8px 16px;
    background: #f0f0f0;
    border-radius: 20px;
    color: #333;
    text-decoration: none;
    font-size: 18px;
    transition: all 0.2s;
}

.directory-btn:hover {
    background: #e0e0e0;
}



















@media (max-width: 768px) {
  /* 全局调整 */
  body {
    font-size: 14px;
  }

  /* 标题栏改造 */
  .header {
    flex-direction: column;
    padding: 10px 15px;
    align-items: stretch;
  }

  .logo {
    font-size: 20px;
    margin-bottom: 10px;
    text-align: center;
  }

  /* 搜索栏优化 */
  .search-container {
    position: static;
    width: 100%;
    margin: 10px 0;
    order: 3; /* 移动到最下方 */
  }

  .search-box {
    width: 100%;
  }

  /* 分类栏改造 */
  .categories {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 10px 0;
    order: 2; /* 移动到中间 */
  }

  .category {
    padding: 6px 12px;
    font-size: 12px;
  }

  /* 主内容区改造 */
  .main-content {
    flex-direction: column;
    margin: 10px;
  }

  /* 资源列表改为单列 */
  .left-content {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  /* 资源项调整 */
  .content-item {
    margin-bottom: 15px;
  }

  .item-image {
    height: 150px;
  }

  /* 详情页优化 */
  .resource-container {
    margin: 15px;
    padding: 15px;
  }

  .image-gallery {
    grid-template-columns: 1fr;
  }

  /* 分页控件优化 */
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin: 20px 0;
  }

  .page-btn {
    padding: 6px 10px;
    margin: 2px;
  }

  /* 排序按钮优化 */
  .sort-options {
    flex-direction: column;
    gap: 8px;
    padding: 10px;
  }

  .sort-btn {
    width: 100%;
    margin: 2px 0;
  }

  /* 下拉菜单调整 */
  .dropdown-menu {
    top: 50px;
    right: 10px;
  }

  /* 隐藏非必要元素 */
  .update-time {
    display: none;
  }
}


@media (max-width: 480px) {
  /* 进一步缩小文字 */
  body {
    font-size: 13px;
  }

  /* 资源图片高度减小 */
  .item-image {
    height: 120px;
  }

  /* 按钮尺寸优化 */
  .btn-purchase, .btn-confirm {
    padding: 8px 12px;
    font-size: 12px;
  }

  /* 模态框优化 */
  .modal-content {
    width: 90%;
    margin: 30% auto;
  }
}