/* 博雅世图图书 - 国际化简洁专业风格 */
:root {
  --primary: #2563EB;
  --primary-light: #EFF6FF;
  --text-dark: #111827;
  --text-mid: #6B7280;
  --text-light: #9CA3AF;
  --bg-white: #FFFFFF;
  --bg-gray: #F9FAFB;
  --border: #E5E7EB;
  --success: #059669;
  --warning: #D97706;
  --danger: #DC2626;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
  color: var(--text-dark);
  background: var(--bg-white);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text-dark); text-decoration: none; }
a:hover { color: var(--primary); }

/* 导航栏 */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  height: 64px;
}
.nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  height: 100%;
  display: flex; align-items: center; gap: 32px;
  position: relative;
}
.nav-logo { font-size: 18px; font-weight: 600; color: var(--text-dark); }
.nav-menu { display: flex; gap: 20px; flex: 1; min-width: 0; flex-wrap: wrap; }
.nav-menu a {
  font-size: 14px; font-weight: 500; color: var(--text-mid);
  padding: 6px 0; position: relative;
  transition: color 0.2s;
}
.nav-menu a:hover, .nav-menu a.active { color: var(--text-dark); }
.nav-menu a.active::after {
  content: ''; position: absolute; bottom: -20px; left: 0; right: 0;
  height: 2px; background: var(--primary);
}
.nav-search {
  display: flex; align-items: center;
  background: var(--bg-gray);
  border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 12px; gap: 6px;
  width: 320px;
}
.nav-search input {
  border: none; background: transparent; outline: none;
  flex: 1; font-size: 13px;
}

/* 通用 */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding: 48px 0; }
.section-title {
  font-size: 22px; font-weight: 600; margin-bottom: 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.section-title .more { font-size: 14px; color: var(--text-mid); font-weight: 400; }
.section-title .more:hover { color: var(--primary); }

/* 大轮播 */
.hero {
  background: var(--bg-gray);
  height: 420px;
  position: relative; overflow: hidden;
}
.hero-slides {
  position: absolute; inset: 0;
}
.hero-slide {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.8s ease-in-out;
  text-decoration: none; color: inherit;
  cursor: pointer;
}
.hero-slide.active { opacity: 1; }
.hero-slide:hover { color: inherit; text-decoration: none; }
.hero-content {
  text-align: center; max-width: 700px; padding: 0 24px; color: white;
  text-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.hero-content h1 { font-size: 42px; font-weight: 600; margin-bottom: 16px; color: white; }
.hero-content .meta { color: rgba(255,255,255,0.92); font-size: 16px; margin-bottom: 28px; }
.hero-content .btn { box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.hero-dots {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 2;
}
.hero-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer; transition: all 0.2s;
  border: 2px solid transparent;
}
.hero-dot.active {
  background: white;
  width: 28px; border-radius: 5px;
}
.hero-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.15);
  color: white; border: none;
  font-size: 24px; line-height: 1;
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 2; transition: background 0.2s;
  backdrop-filter: blur(4px);
}
.hero-arrow:hover { background: rgba(255,255,255,0.3); }
.hero-prev { left: 20px; }
.hero-next { right: 20px; }
.btn {
  display: inline-block; padding: 10px 20px;
  border-radius: 6px; font-size: 14px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #1d4ed8; color: white; }
.btn-secondary { background: white; color: var(--text-dark); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--text-dark); }
.btn-text { color: var(--primary); padding: 0; background: transparent; }
.btn-text:hover { text-decoration: underline; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* 中图法分类 */
.category-grid {
  display: grid; grid-template-columns: repeat(11, 1fr); gap: 12px;
}
.category-grid a {
  text-align: center; padding: 16px 8px;
  background: var(--bg-gray);
  border-radius: 6px;
  font-size: 13px;
  transition: all 0.2s;
}
.category-grid a:hover {
  background: var(--primary-light);
  color: var(--primary);
  transform: translateY(-2px);
}
.category-grid .code { font-size: 18px; font-weight: 600; display: block; margin-bottom: 2px; }
.category-grid .name { color: var(--text-mid); font-size: 11px; }

/* 未分类 - 特殊样式 */
.category-grid a.cat-uncategorized {
  background: #FEF3C7;
  border: 1px dashed #D97706;
  color: #92400E;
}
.category-grid a.cat-uncategorized:hover {
  background: #FDE68A;
  color: #78350F;
  transform: translateY(-2px);
}
.category-grid a.cat-uncategorized .code { color: #92400E; }

/* 图书网格 */
.book-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px;
}
.book-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
}
.book-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}
.book-cover {
  width: 100%; aspect-ratio: 3/4;
  background: var(--bg-gray);
  border-radius: 4px;
  margin-bottom: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-light); font-size: 12px;
  overflow: hidden;
  position: relative;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover .badge-stock {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,0.95);
  padding: 2px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 500;
}
.book-cover .badge-stock.out { color: var(--text-light); }
.book-cover .badge-stock.low { color: var(--warning); }
.book-cover .badge-stock.in { color: var(--success); }
.book-title {
  font-size: 13px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 4px;
}
.book-author { font-size: 11px; color: var(--text-mid); margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.book-price { font-size: 15px; font-weight: 600; color: var(--text-dark); }
.book-publisher { font-size: 10px; color: var(--text-light); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 出版社列表 */
.publisher-list {
  display: flex; flex-wrap: wrap; gap: 12px;
}
.publisher-list a {
  padding: 6px 14px; background: var(--bg-gray);
  border-radius: 4px; font-size: 13px; color: var(--text-mid);
}
.publisher-list a:hover { background: var(--primary-light); color: var(--primary); }

/* 筛选标签 */
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-tag {
  padding: 4px 12px; background: var(--bg-gray);
  border: 1px solid var(--border);
  border-radius: 4px; font-size: 12px;
  cursor: pointer; color: var(--text-mid);
}
.filter-tag:hover { border-color: var(--primary); color: var(--primary); }
.filter-tag.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* 主题书单卡片 */
.shelf-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.shelf-card {
  position: relative;
  display: flex; gap: 16px;
  padding: 20px;
  background: var(--bg-gray);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s;
  overflow: hidden;
}
.shelf-card.has-cover {
  padding: 0;
  background: transparent;
}
.shelf-card .shelf-cover {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  border-radius: 8px;
}
.shelf-card .shelf-cover-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to right, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0.3) 60%, rgba(255,255,255,0) 100%);
  border-radius: 8px;
}
.shelf-card.has-cover .shelf-info {
  position: relative;
  z-index: 1;
  padding: 20px;
}
.shelf-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.shelf-icon { font-size: 40px; line-height: 1; }
.shelf-info { flex: 1; min-width: 0; }
.shelf-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.shelf-desc { font-size: 13px; color: var(--text-mid); margin-bottom: 8px; }
.shelf-count { font-size: 12px; color: var(--text-light); }
.shelf-actions { display: flex; gap: 6px; margin-top: 12px; }
.shelf-actions .btn { padding: 4px 10px; font-size: 12px; }

/* 详情页 */
.detail-wrap { display: grid; grid-template-columns: 320px 1fr; gap: 48px; padding: 32px 0; }
.detail-cover {
  aspect-ratio: 3/4; background: var(--bg-gray);
  border-radius: 8px; overflow: hidden;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-info h1 { font-size: 28px; font-weight: 600; margin-bottom: 12px; }
.detail-meta { color: var(--text-mid); font-size: 14px; margin-bottom: 16px; line-height: 1.8; }
.detail-price { font-size: 32px; font-weight: 600; margin: 24px 0; }
.detail-stock { font-size: 14px; margin-bottom: 24px; }
.detail-stock .label { color: var(--text-mid); }
.detail-stock .badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.badge-in { background: #ECFDF5; color: var(--success); }
.badge-low { background: #FEF3C7; color: var(--warning); }
.badge-out { background: var(--bg-gray); color: var(--text-light); }
.detail-actions { display: flex; gap: 12px; }
.detail-actions .btn { padding: 12px 24px; font-size: 15px; }
.detail-section { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }
.detail-section h3 { font-size: 18px; font-weight: 600; margin-bottom: 12px; }
.detail-section p { color: var(--text-mid); line-height: 1.8; }
.detail-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.detail-table td { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.detail-table td:first-child { color: var(--text-mid); width: 120px; }

/* 列表页布局 */
.list-wrap { display: grid; grid-template-columns: 240px 1fr; gap: 32px; padding: 32px 0; }
.list-sidebar { }
.sidebar-block { margin-bottom: 24px; }
.sidebar-block h4 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.sidebar-item {
  display: block; padding: 6px 0; font-size: 13px; color: var(--text-mid);
  cursor: pointer;
}
.sidebar-item:hover, .sidebar-item.active { color: var(--primary); }
.list-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.list-toolbar select {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 13px;
  background: white;
}
.list-toolbar .result-count { font-size: 14px; color: var(--text-mid); }
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 32px; }
.pagination a, .pagination span {
  padding: 6px 12px; border: 1px solid var(--border);
  border-radius: 4px; font-size: 13px; cursor: pointer;
  min-width: 32px; text-align: center;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination .disabled { color: var(--text-light); cursor: not-allowed; }

/* 表格 */
.tbl { width: 100%; border-collapse: collapse; background: white; }
.tbl th, .tbl td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.tbl th { background: var(--bg-gray); font-weight: 600; font-size: 13px; }
.tbl tr:hover td { background: var(--bg-gray); }

/* 浮窗/通知 */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--text-dark); color: white;
  padding: 12px 20px; border-radius: 6px;
  font-size: 14px; opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* 页脚 */
.footer {
  margin-top: 80px;
  background: var(--bg-gray);
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
}
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.footer-row {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px; margin-bottom: 16px;
}
.footer-info { display: flex; gap: 24px; flex-wrap: wrap; font-size: 13px; color: var(--text-mid); }
.footer-contact { display: flex; gap: 12px; }
.footer-contact a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; background: white;
  border: 1px solid var(--border); border-radius: 20px;
  font-size: 13px; color: var(--text-dark);
  transition: all 0.2s;
}
.footer-contact a:hover { border-color: var(--primary); color: var(--primary); }
.footer-contact .qq-icon { color: #12B7F5; }
.footer-contact .email-icon { color: var(--warning); }
.footer-copy { text-align: center; color: var(--text-light); font-size: 12px; padding-top: 16px; border-top: 1px solid var(--border); }

/* 弹窗 */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 300; display: none; align-items: center; justify-content: center;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: white; border-radius: 8px;
  width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto;
  padding: 24px;
}
.modal h3 { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.modal-close { float: right; cursor: pointer; color: var(--text-mid); font-size: 20px; line-height: 1; }

.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 13px; color: var(--text-mid); margin-bottom: 4px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 4px;
  font-size: 14px; font-family: inherit;
  outline: none;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

.empty-state {
  text-align: center; padding: 80px 24px; color: var(--text-light);
}
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text-mid); }

/* 响应式 - 当当/京东的套路：列数随容器宽递减 */
@media (max-width: 1439px) {
  /* 1200~1439: 4列 */
  .book-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .shelf-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1199px) {
  /* 1024~1199: 4列 */
  .book-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .shelf-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shelf-grid { grid-template-columns: repeat(2, 1fr); }
  .list-wrap { grid-template-columns: 200px 1fr; }
  .detail-wrap { grid-template-columns: 240px 1fr; gap: 24px; }
}
@media (max-width: 768px) {
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shelf-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: repeat(6, 1fr); }
  .list-wrap { grid-template-columns: 1fr; }
  .list-sidebar { display: none; }
  .detail-wrap { grid-template-columns: 1fr; }
  .nav-search { width: 140px; }
  .nav-menu { gap: 12px; }
  .nav-menu a { font-size: 13px; white-space: nowrap; }
  .hero { height: 320px; }
  .hero-content h1 { font-size: 28px; }
  .hero-content .meta { font-size: 13px; }
  .hero-arrow { width: 36px; height: 36px; font-size: 20px; }
  .section { padding: 32px 0; }
  .publisher-list a { font-size: 12px; padding: 4px 10px; }
  .container { padding-left: 12px; padding-right: 12px; }
}

@media (max-width: 480px) {
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .category-grid { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .category-grid a { font-size: 10px; padding: 6px 4px; }
  .nav { padding: 8px 12px; flex-wrap: wrap; }
  .nav-menu { width: 100%; order: 3; justify-content: center; gap: 8px; margin-top: 8px; }
  .nav-menu a { font-size: 12px; }
  .nav-search { width: 100%; order: 2; margin: 6px 0; }
  .hero { height: 200px; }
  .hero-content h1 { font-size: 20px; }
  .hero-content .meta { font-size: 12px; }
  .section-title { font-size: 16px; }
  .section { padding: 24px 0; }
  .book-card { padding: 8px; }
  .book-title { font-size: 12px; }
  .book-author { font-size: 10px; }
  .book-price { font-size: 13px; }
  .book-publisher { font-size: 10px; }
  .shelf-card { flex-direction: column; padding: 12px; }
  .shelf-icon { font-size: 28px; }
  .shelf-name { font-size: 14px; }
  .shelf-actions { flex-wrap: wrap; }
  .shelf-actions .btn { font-size: 11px; padding: 3px 8px; }
  .publisher-list a { font-size: 11px; padding: 3px 8px; }
  .container { padding-left: 8px; padding-right: 8px; }
  .detail-actions .btn { padding: 8px 16px; font-size: 13px; }
  .auth-wrap { padding: 24px 12px; }
  .auth-card { padding: 20px; }
  .table-wrap { overflow-x: auto; }
  table.tbl { font-size: 12px; }
  table.tbl th, table.tbl td { padding: 6px 4px; }
}

/* 紧凑型分页 */
.pagination-sm { display: flex; gap: 3px; align-items: center; }
.pagination-sm a, .pagination-sm span {
  padding: 3px 8px; font-size: 12px; border: 1px solid var(--border);
  border-radius: 3px; cursor: pointer; min-width: 24px; text-align: center;
}
.pagination-sm a:hover { border-color: var(--primary); color: var(--primary); }
.pagination-sm .active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination-sm .disabled { color: var(--text-light); cursor: not-allowed; }
.pagination-sm input { width: 40px !important; padding: 2px 4px !important; font-size: 12px !important; }

/* 工具栏优化 */
.list-toolbar { gap: 12px; }
.list-toolbar > * { margin: 0; }
.list-toolbar .result-count {
  font-size: 13px; color: var(--text-mid);
  white-space: nowrap; display: flex; align-items: center;
}
.list-toolbar .pagination {
  margin: 0; flex: 1; justify-content: center;
}
.list-toolbar .pagination a, .list-toolbar .pagination span {
  padding: 4px 10px; font-size: 12px; min-width: 28px;
}
.list-toolbar .pagination input {
  width: 32px !important; padding: 2px 4px !important; font-size: 11px !important;
  margin: 0 2px !important;
}
.list-toolbar select {
  font-size: 12px; padding: 4px 8px;
}

/* 底部翻页也统一 */
.pagination { margin-top: 20px; }
.pagination a, .pagination span {
  padding: 4px 10px; font-size: 12px; min-width: 28px;
}
.pagination input {
  width: 32px !important; padding: 2px 4px !important; font-size: 11px !important;
}
