/* 全局样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Microsoft Yahei", sans-serif;
}

a {
  text-decoration: none;
  color: #333;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  vertical-align: middle;
}

.container {
  width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 按钮样式 */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

.btn-primary {
  background-color: #4299e1;
  color: #fff;
}

.btn-primary:hover {
  background-color: #3182ce;
}

.btn-secondary {
  background-color: #f7fafc;
  color: #4a5568;
  border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
  background-color: #edf2f7;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

/* 头部样式 */
.header {
  background-color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 999;
}

.header__wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: bold;
  color: #4299e1;
}

.header__logo img {
  width: 40px;
  height: 40px;
}

.nav__list {
  display: flex;
  gap: 30px;
}

.nav__link {
  font-size: 16px;
  color: #333;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
}

.nav__link.active,
.nav__link:hover {
  color: #4299e1;
  border-bottom: 2px solid #4299e1;
}

.header__user {
  display: flex;
  gap: 10px;
}

/* 汉堡菜单基础样式（桌面端隐藏） */
.header__menu {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 24px;
  cursor: pointer;
  gap: 4px;
}

.header__menu span {
  display: block;
  width: 100%;
  height: 3px;
  background-color: #333;
  border-radius: 3px;
  transition: all 0.3s ease;
}

/* 轮播图样式 */
.banner {
  position: relative;
  height: 400px;
  overflow: hidden;
}

.banner__wrap {
  position: relative;
  height: 100%;
}

.banner__list {
  display: flex;
  height: 100%;
  transition: transform 0.5s ease;
}

.banner__item {
  flex: 0 0 100%;
  height: 100%;
  display: none;
}

.banner__item.active {
  display: block;
}

.banner__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner__prev,
.banner__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 20px;
  z-index: 10;
}

.banner__prev {
  left: 20px;
}

.banner__next {
  right: 20px;
}

.banner__dots {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
}

.banner__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
}

.banner__dot.active {
  background-color: #fff;
}

/* 书籍分类样式 */
.book-category {
  padding: 50px 0;
  background-color: #f8f9fa;
}

.section__title {
  font-size: 24px;
  text-align: center;
  margin-bottom: 30px;
  color: #333;
  position: relative;
}

.section__title::after {
  content: "";
  display: block;
  width: 80px;
  height: 3px;
  background-color: #4299e1;
  margin: 10px auto 0;
}

.category__tabs {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
}

.category__tab {
  padding: 8px 20px;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  background-color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
}

.category__tab.active,
.category__tab:hover {
  background-color: #4299e1;
  color: #fff;
  border-color: #4299e1;
}

.category__books {
  width: 100%;
}

.books__list {
  display: none;
  flex-wrap: wrap;
  gap: 30px;
  justify-content: center;
}

.books__list.active {
  display: flex;
}

.book__card {
  width: 200px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 15px;
  text-align: center;
  transition: transform 0.3s ease;
}

.book__card:hover {
  transform: translateY(-5px);
}

.book__img {
  width: 150px;
  height: 200px;
  object-fit: cover;
  margin-bottom: 10px;
  border-radius: 4px;
}

.book__name {
  font-size: 16px;
  margin-bottom: 5px;
  color: #333;
}

.book__author {
  font-size: 14px;
  color: #666;
  margin-bottom: 15px;
}

.book__actions {
  display: flex;
  gap: 5px;
  justify-content: center;
}

/* 书单分享样式 */
.book-list {
  padding: 50px 0;
}

.booklist__wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  justify-content: center;
}

.booklist__card {
  width: 300px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 20px;
  text-align: center;
}

.booklist__name {
  font-size: 18px;
  margin-bottom: 10px;
  color: #333;
}

.booklist__creator,
.booklist__count {
  font-size: 14px;
  color: #666;
  margin-bottom: 15px;
}

/* 页脚样式 */
.footer {
  background-color: #333;
  color: #fff;
  padding: 30px 0;
  text-align: center;
}

.footer__text {
  font-size: 18px;
  margin-bottom: 15px;
}

.footer__links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 15px;
}

.footer__links a {
  color: #ccc;
  transition: color 0.3s ease;
}

.footer__links a:hover {
  color: #4299e1;
}

.footer__copyright {
  font-size: 14px;
  color: #999;
}

/* 关于页样式（移出响应式，单独定义） */
.about-container {
  width: 80%;
  margin: 40px auto;
}

.about-section {
  background: #fff;
  padding: 20px 25px;
  margin-bottom: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.about-section h2 {
  font-size: 20px;
  margin-bottom: 15px;
  border-left: 4px solid #409EFF;
  padding-left: 10px;
}

.about-section p,
.about-section li {
  color: #555;
  line-height: 1.8;
}

.about-section ul {
  padding-left: 20px;
}

/* 响应式适配 */
@media (max-width: 1200px) {
  .container {
    width: 960px;
  }
}

@media (max-width: 992px) {
  .container {
    width: 720px;
  }
  
  .header__menu {
    display: flex;
  }
  
  .nav,
  .header__user {
    display: none;
  }
  
  .banner {
    height: 300px;
  }
}

@media (max-width: 768px) {
  .container {
    width: 100%;
  }
  
  .banner {
    height: 200px;
  }
  
  .book__card {
    width: 150px;
  }
  
  .book__img {
    width: 120px;
    height: 160px;
  }
  
  .booklist__card {
    width: 100%;
    max-width: 300px;
  }

  /* 移动端导航菜单 */
  .nav {
    position: fixed;
    top: 0;
    right: 0;
    width: 0;
    height: 100vh;
    background-color: #fff;
    z-index: 999;
    overflow: hidden;
    transition: all 0.3s ease;
  }

  .nav__list {
    flex-direction: column;
    padding: 80px 20px;
    width: 200px;
  }

  .nav__item {
    margin: 15px 0;
  }

  /* 导航展开的样式 */
  .nav.show {
    width: 200px;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  }

  /* 汉堡菜单激活态 */
  .header__menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
  }

  .header__menu.active span:nth-child(2) {
    opacity: 0;
  }

  .header__menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
  }
}

@media (min-width: 769px) {
  .nav__list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .nav__item {
    margin: 0 15px;
  }
}