/* ==================== 西部书画网站 - 公共样式 ==================== */

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

:root {
  /* 主色调 - 中国传统色 */
  --primary: #8b2500;          /* 赭石红 */
  --primary-light: #c4513a;
  --primary-dark: #6b1d00;
  --secondary: #2c3e50;        /* 墨色 */
  --accent: #d4a017;           /* 金色 */
  --bg: #f8f5f0;               /* 宣纸色 */
  --bg-white: #ffffff;
  --bg-gray: #f5f5f5;
  --text: #333333;
  --text-light: #666666;
  --text-muted: #999999;
  --border: #e8e0d5;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 16px;
  --max-width: 1200px;
  --header-height: 70px;
  --transition: all 0.3s ease;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "WenQuanYi Micro Hei", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

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

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}

/* ==================== 导航栏 ==================== */
.site-header {
  background: var(--bg-white);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  display: flex;
  align-items: center;
}

.header-container {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.logo a {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-text {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 2px;
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
}

.main-nav ul {
  display: flex;
  gap: 30px;
}

.main-nav li a {
  font-size: 1rem;
  font-weight: 500;
  padding: 8px 0;
  position: relative;
}

.main-nav li.active a,
.main-nav li a:hover {
  color: var(--primary);
}

.main-nav li.active a::after,
.main-nav li a:hover::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}

.header-search form {
  display: flex;
  gap: 0;
}

.search-input {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-size: 0.9rem;
  width: 200px;
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--primary);
}

.search-btn {
  padding: 8px 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.search-btn:hover {
  background: var(--primary-dark);
}

.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.mobile-menu-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text);
  transition: var(--transition);
  border-radius: 1px;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}
.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ==================== 页脚 ==================== */
.site-footer {
  background: var(--secondary);
  color: #ccc;
  margin-top: auto;
  padding: 40px 0 0;
}

.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 30px;
}

.footer-col h4 {
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 16px;
  font-weight: 600;
}

.footer-col p {
  font-size: 0.9rem;
  line-height: 1.8;
  color: #aaa;
}

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

.footer-col ul li a {
  font-size: 0.9rem;
  color: #aaa;
}

.footer-col ul li a:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 20px 0;
  text-align: center;
  font-size: 0.85rem;
  color: #888;
}

/* ==================== 通用容器 - 统一 1200px ==================== */
.page-container {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px;
  flex: 1;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.breadcrumb {
  display: flex;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

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

.breadcrumb .separator {
  color: var(--border);
}

/* ==================== 卡片网格 - 统一 4 列 ==================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.card {
  background: var(--bg-white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.card-image {
  width: 100%;
  aspect-ratio: 3/4;
  background: var(--bg-gray);
  overflow: hidden;
  position: relative;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.card-body {
  padding: 12px 16px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card-price {
  color: var(--primary);
  font-weight: 600;
  font-size: 1rem;
}

/* ==================== 作者卡片 ==================== */
.author-card {
  text-align: center;
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 24px 16px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.author-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.author-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin: 0 auto 12px;
  overflow: hidden;
  border: 3px solid var(--border);
}

.author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.author-info {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==================== Tab 切换 ==================== */
.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.tab-item {
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: var(--transition);
  border: none;
  background: none;
}

.tab-item:hover {
  color: var(--primary);
}

.tab-item.active {
  color: var(--primary);
  font-weight: 600;
}

.tab-item.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ==================== 分页 ==================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
  padding-bottom: 20px;
}

.pagination button {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  transition: var(--transition);
}

.pagination button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

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

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==================== 加载/空状态 ==================== */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state,
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.empty-icon,
.error-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

/* ==================== 按钮 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  gap: 6px;
}

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

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

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

/* ==================== 响应式 ==================== */
@media (max-width: 1200px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 968px) {
  .header-search {
    display: none;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .header-container {
    padding: 0 12px;
  }

  .logo-text {
    font-size: 1.3rem;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .main-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-white);
    box-shadow: var(--shadow);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .main-nav.open {
    max-height: 400px;
  }

  .main-nav ul {
    flex-direction: column;
    padding: 12px;
    gap: 0;
  }

  .main-nav li {
    border-bottom: 1px solid var(--border);
  }

  .main-nav li:last-child {
    border-bottom: none;
  }

  .main-nav li a {
    display: block;
    padding: 14px 12px;
  }

  .main-nav li.active a::after {
    display: none;
  }

  .page-container {
    padding: 16px 12px;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .page-title {
    font-size: 1.3rem;
  }

  .tab-item {
    padding: 10px 16px;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .card-body {
    padding: 10px 12px;
  }

  .card-title {
    font-size: 0.9rem;
  }
}
