/* ==================== 全局变量与基础样式 ==================== */
:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #3B82F6;
  --primary-50: #EFF6FF;
  --primary-100: #DBEAFE;
  --primary-200: #BFDBFE;
  --primary-600: #2563EB;
  --primary-700: #1D4ED8;
  --primary-900: #1E3A8A;

  --bg: #F7FAFF;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --text: #0F172A;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  --warning: #F59E0B;
  --warning-bg: #FFF7ED;
  --warning-border: #FED7AA;

  --danger: #EF4444;
  --danger-bg: #FEF2F2;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 4px 12px rgba(37, 99, 235, 0.12);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: transparent;
}

/* ==================== 通用布局 ==================== */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==================== 顶部导航栏 ==================== */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--primary);
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
}

.nav-links {
  display: flex;
  gap: 8px;
}

.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  transition: all .2s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background: var(--primary-50);
}

/* ==================== 扁平化按钮 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
  min-height: 40px;
  white-space: nowrap;
}

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

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--primary-50); color: var(--primary); }

/* ==================== 页面横幅 / 标题区 ==================== */
.hero {
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
  padding: 48px 0 36px;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--primary-900);
}
.hero p {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}

/* ==================== 分类筛选栏 ==================== */
.filter-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 64px;
  z-index: 40;
}
.filter-scroll {
  display: flex;
  gap: 8px;
  padding: 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-scroll::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 0 18px;
  height: 36px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #F1F5F9;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.chip:hover { background: var(--primary-50); color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; }

/* ==================== 小说卡片网格 ==================== */
.section {
  padding: 32px 0 48px;
}

.grid-novels {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 640px) {
  .grid-novels { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
  .grid-novels { grid-template-columns: repeat(4, 1fr); gap: 24px; }
}
@media (min-width: 1280px) {
  .grid-novels { grid-template-columns: repeat(5, 1fr); }
}

.novel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  display: flex;
  flex-direction: column;
  animation: fadeIn .3s ease;
}
.novel-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary-200);
}

.novel-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--primary-50);
}

.novel-info {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.novel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.novel-author {
  font-size: 13px;
  color: var(--text-muted);
}

.novel-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  flex-wrap: wrap;
}

/* ==================== 徽章 ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-blue { background: var(--primary-50); color: var(--primary); }
.badge-gray { background: #F1F5F9; color: var(--text-muted); }
.badge-green { background: #ECFDF5; color: #059669; }
.badge-amber { background: #FFFBEB; color: #B45309; }
.badge-red { background: #FEF2F2; color: var(--danger); }
.badge-purple { background: #F5F3FF; color: #7C3AED; }
.badge-pink { background: #FDF2F8; color: #DB2777; }
.badge-cyan { background: #ECFEFF; color: #0891B2; }

/* ==================== 空状态 ==================== */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: .6;
}
.empty-title {
  font-size: 16px;
  color: var(--text);
  margin-bottom: 4px;
}

/* ==================== 详情页 ==================== */
.detail-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 32px 0;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 768px) {
  .detail-grid {
    grid-template-columns: 220px 1fr;
    gap: 36px;
  }
}
@media (min-width: 1024px) {
  .detail-grid {
    grid-template-columns: 260px 1fr;
  }
}

.detail-cover {
  width: 100%;
  max-width: 220px;
  margin: 0 auto;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--primary-50);
}
@media (min-width: 768px) {
  .detail-cover { margin: 0; max-width: none; }
}

.detail-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text);
}

.detail-author {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 18px 0;
}
@media (min-width: 640px) {
  .detail-stats { grid-template-columns: repeat(4, 1fr); }
}
.stat-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid var(--border);
}
.stat-label {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 4px;
}
.stat-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
}

.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 18px;
}

.summary-box {
  background: var(--bg);
  border-left: 3px solid var(--primary);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  line-height: 1.8;
}

/* ==================== 售出权益模块 ==================== */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 24px;
}
.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.section-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-card-title::before {
  content: '';
  width: 4px;
  height: 18px;
  background: var(--primary);
  border-radius: 2px;
}

/* PC 端表格 */
.licenses-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.licenses-table thead th {
  background: var(--primary-50);
  color: var(--primary-900);
  font-weight: 600;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--primary-100);
  font-size: 13px;
}
.licenses-table tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.licenses-table tbody tr:hover {
  background: var(--primary-50);
}
.licenses-table tbody tr.license-row-clickable {
  cursor: pointer;
  transition: background-color .2s ease;
}
.licenses-table tbody tr.license-row-clickable:hover {
  background: var(--primary-100);
}
.licenses-table tbody tr.license-row-clickable td:last-child::after {
  content: '→';
  margin-left: 6px;
  color: var(--primary);
  font-size: 14px;
}
.licenses-table tbody tr.row-warning {
  background: var(--warning-bg);
}
.licenses-table tbody tr.row-warning:hover {
  background: #FFEDD5;
}
.expire-warning {
  color: var(--warning);
  font-size: 12px;
  font-weight: 500;
  margin-left: 6px;
}

/* 移动端卡片 */
.licenses-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.license-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--surface);
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.license-card.license-card-clickable:hover {
  border-color: var(--primary-200);
  box-shadow: var(--shadow-hover);
}
.license-card.is-warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
}
.license-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 6px;
}
.license-rights {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.license-row {
  display: flex;
  font-size: 13px;
  padding: 4px 0;
  color: var(--text);
}
.license-label {
  width: 80px;
  color: var(--text-light);
  flex-shrink: 0;
}

/* 桌面端显示表格、移动端隐藏；移动端显示卡片、桌面端隐藏 */
.show-pc { display: block; }
.show-mobile { display: none; }
@media (max-width: 767px) {
  .show-pc { display: none; }
  .show-mobile { display: block; }
}

/* ==================== 提示框 ==================== */
.notice {
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-align: center;
  color: var(--primary-900);
  font-size: 14px;
}

/* ==================== 页脚 ==================== */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 48px;
}
.footer p { margin: 0; }

/* ==================== 动画 ==================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn .3s ease both; }

/* ==================== 备案号样式 ==================== */
.filing-number-cell {
  font-size: 13px;
  color: var(--text-muted);
  word-break: break-all;
}
.filing-number-text {
  font-size: 13px;
  color: var(--text-muted);
  word-break: break-all;
}
.cert-filing-number {
  word-break: break-all;
}

/* ==================== 移动端导航微调 ==================== */
@media (max-width: 640px) {
  .navbar-inner { height: 56px; }
  .filter-bar { top: 56px; }
  .hero { padding: 32px 0 24px; }
  .hero h1 { font-size: 22px; }
  .nav-links {
    gap: 4px;
  }
  .nav-link {
    padding: 6px 8px;
    font-size: 12px;
  }
  .brand {
    font-size: 14px;
    gap: 6px;
  }
  .brand-logo {
    width: 28px;
    height: 28px;
    font-size: 14px;
    border-radius: 6px;
  }
  .detail-title { font-size: 22px; }
  .section-card { padding: 18px 16px; }
}

/* 起点书籍页链接样式 */
.detail-title-link {
  color: inherit;
  text-decoration: none;
  transition: color .2s ease;
}
.detail-title-link:hover {
  color: var(--primary);
}
.detail-title-link svg {
  transition: opacity .2s ease;
}
.detail-title-link:hover svg {
  opacity: 1 !important;
}

/* ==================== 小说搜索栏 ==================== */
.novel-search-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.novel-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 480px;
}

.novel-search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-light);
  pointer-events: none;
}

.novel-search-input {
  width: 100%;
  height: 42px;
  padding: 0 38px 0 40px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  transition: border-color .2s ease, box-shadow .2s ease;
  outline: none;
  font-family: inherit;
}

.novel-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-50);
  background: var(--surface);
}

.novel-search-input::placeholder {
  color: var(--text-light);
}

.novel-search-clear {
  position: absolute;
  right: 10px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  transition: all .2s ease;
}

.novel-search-clear:hover {
  background: #F1F5F9;
  color: var(--text-muted);
}
