/* 公共基础样式文件 - 所有页面共用 */
/* 注意：不使用外部字体（Google Fonts 国内不可达），采用系统字体栈 */

/* 自定义CSS变量 */
:root {
  --primary-color: #8B4513;
  --secondary-color: #D2691E;
  --accent-color: #CD853F;
  --text-dark: #2D1810;
  --text-light: #6B4423;
  --bg-light: #FFF8DC;
  --border-color: #DEB887;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background-color: #ffffff;
}

/* 响应式图片 */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 链接样式 */
a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s ease;
}

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

/* 容器样式 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 导航栏样式 */
.navbar {
  background: linear-gradient(135deg, #8B4513 0%, #D2691E 100%);
  padding: 1rem 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.logo a {
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
}

.logo img {
  height: 40px;
  width: auto;
  margin-right: 0.5rem;
}

.nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2rem;
}

.nav-link {
  color: white;
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.3s ease;
  position: relative;
}

.nav-link:hover {
  background: rgba(255,255,255,0.1);
  transform: translateY(-2px);
}

.nav-link.active {
  background: rgba(255,255,255,0.2);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

/* 简化版导航栏（用于条款和隐私页面） */
.navbar.simple-nav .nav-menu {
  gap: 1.5rem;
}

.navbar.simple-nav .nav-link {
  font-size: 0.95rem;
}

/* 通用Hero区域样式 - 可被各页面继承 */
.hero-section {
  background: linear-gradient(rgba(139,69,19,0.8), rgba(210,105,30,0.8));
  padding: 4rem 0;
  text-align: center;
  color: white;
}

.hero-section h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hero-section p {
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0 auto;
  opacity: 0.9;
}

/* 动画效果 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 1s ease-out;
}

/* 通用内容区域样式 */
.content-section {
  padding: 4rem 0;
}

.section-title {
  font-size: 2.5rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 3rem;
  color: var(--primary-color);
}

.main-content {
  min-height: calc(100vh - 200px);
  padding: 2rem 0;
}

/* Footer样式 */
.footer {
  background: var(--primary-color);
  color: white;
  padding: 3rem 0 1rem;
  margin-top: 4rem;
}

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

.footer-section h4 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.footer-section p,
.footer-section a {
  color: rgba(255,255,255,0.8);
  line-height: 1.6;
}

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

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.2);
  padding-top: 1rem;
  text-align: center;
  color: rgba(255,255,255,0.7);
}

/* 懒加载图片样式 */
/* 默认可见：即使 JS 加载失败（如资源异常），图片仍正常显示 */
.lazy-image {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* JS 接管懒加载后，初始透明并在加载完成时淡入 */
.lazy-image.lazy-initial {
  opacity: 0;
}

.lazy-image.loaded {
  opacity: 1;
}

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

/* 产品网格样式 */
.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  margin-top: 2rem;
}

.product-item {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  height: 100%;
}

.product-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.product-link {
  display: block;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.product-item img {
  width: 100%;
  height: 280px;
  object-fit: cover;
}

.product-content {
  padding: 1rem;
}

.product-content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--primary-color);
}

.product-content p {
  color: var(--text-light);
  line-height: 1.4;
  font-size: 0.85rem;
}

/* 书籍网格样式 */
.books-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  margin-top: 2rem;
}

.book-item {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  height: 100%;
}

.book-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.book-link {
  display: block;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.book-item img {
  width: 100%;
  height: 250px;
  object-fit: cover;
}

.book-content {
  padding: 1.5rem;
}

.book-content h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.book-content p {
  color: var(--text-light);
  line-height: 1.6;
  font-size: 0.9rem;
}

/* 公众号二维码样式 */
.qr-code {
  text-align: center;
  margin: 1rem 0;
}

.qr-code img {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  margin: 0 auto;
  display: block;
}

/* 书籍弹窗样式 */
.book-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.book-modal.modal-show {
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #eee;
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: white;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.modal-body {
    padding: 2rem;
}

.modal-body p {
    line-height: 1.8;
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.modal-contact {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 4px solid #8B4513;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-top: 1.5rem;
}

.modal-contact p {
    margin: 0;
    color: #8B4513;
    font-weight: 600;
    text-align: center;
}

/* 书籍项目悬停效果增强 */
.book-item {
    cursor: pointer;
    transition: all 0.3s ease;
}

.book-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.book-item:active {
    transform: translateY(-4px);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .products-grid,
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .product-content,
  .book-content {
    padding: 1rem;
  }
  
  .product-item img,
  .book-item img {
    height: 150px;
  }
  
  .mobile-menu-btn {
    display: block;
  }
  
  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--primary-color);
    flex-direction: column;
    padding: 1rem 0;
    gap: 0;
    z-index: 1001;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  }
  
  .nav-menu.active {
    display: flex;
  }
  
  .nav-link {
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  
  .hero-content h1 {
    font-size: 2rem;
  }
  
  .hero-content p {
    font-size: 1rem;
  }
  
  .intro-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .section-title {
    font-size: 2rem;
  }
  
  /* 弹窗移动端适配 */
  .modal-content {
    width: 95%;
    max-height: 90vh;
    margin: 1rem;
  }
  
  .modal-header {
    padding: 1rem 1.5rem;
  }
  
  .modal-header h3 {
    font-size: 1.2rem;
  }
  
  .modal-body {
    padding: 1.5rem;
  }
  
  .modal-body p {
    font-size: 0.95rem;
  }
  
  .modal-contact {
    padding: 0.8rem 1rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 15px;
  }
  
  .hero-banner {
    min-height: 80vh;
    padding: 1rem;
    background-attachment: scroll;
    background-size: contain;
  }
  
  .hero-content {
    padding: 2rem 1rem;
  }
  
  .hero-content h1 {
    font-size: clamp(2rem, 8vw, 3.5rem);
    margin-bottom: 1.5rem;
    padding: 0.8rem 1.5rem;
    border: 2px solid #ffffff;
  }
  
  .hero-content p {
    font-size: clamp(1rem, 4vw, 1.3rem);
    margin-bottom: 1rem;
    padding: 0.4rem 0.8rem;
  }
  
  .content-section {
    padding: 2rem 0;
  }
  
  .products-grid,
  .books-grid {
    grid-template-columns: 1fr;
  }
}