/* 全局样式重置与基础配置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root {
  --primary: #3b82f6;
  --primary-light: #60a5fa;
  --primary-dark: #2563eb;
  --bg-main: #f9fafb;
  --bg-card: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --border: #e2e8f0;
  --shadow: 0 4px 12px rgba(0,0,0,0.05);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.1);
  --radius: 12px;
}

/* 深色模式 */
body.dark-mode {
  --bg-main: #1e293b;
  --bg-card: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --border: #475569;
  --shadow: 0 4px 12px rgba(0,0,0,0.2);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.3);
}

/* 护眼模式 */
body.eye-mode {
  --bg-main: #f5f5dc;
  --bg-card: #fffff0;
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-tertiary: #999999;
  --border: #e6e6c8;
  --shadow: 0 4px 12px rgba(0,0,0,0.05);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.1);
}
body {
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.7;
  padding: 0;
  transition: all 0.3s ease;
}

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

/* 顶部导航 */
.header {
  background: var(--bg-card);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s ease;
}
.nav-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}
.logo:hover {
  transform: scale(1.05);
}
.nav-menu {
  display: flex;
  gap: 24px;
  align-items: center;
}
.nav-item {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s ease;
  position: relative;
}
.nav-item:hover {
  color: var(--primary);
}
.nav-item.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}
.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  width: 240px;
  gap: 6px;
  transition: all 0.2s ease;
}
.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.search-box input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
  background: transparent;
}
.search-box i {
  color: var(--text-tertiary);
}
.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-menu a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s ease;
}
.user-menu a:hover {
  color: var(--primary);
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.user-avatar:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

/* 主内容区 */
.main-content {
  padding: 40px 0;
}

/* 页面标题 */
.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 32px;
  position: relative;
  padding-bottom: 12px;
}
.page-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 4px;
  background: var(--primary);
  border-radius: 2px;
}

/* 小说列表样式 */
.novel-list {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* 小说卡片样式（番茄/起点风格） */
.novel-card {
  display: flex;
  gap: 24px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  cursor: pointer;
}
.novel-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

/* 封面图容器 */
.cover-container {
  width: 140px;
  height: 200px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  position: relative;
  transition: all 0.3s ease;
}
.cover-container:hover {
  transform: scale(1.02);
}
.cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.novel-card:hover .cover-img {
  transform: scale(1.05);
}
.cover-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--primary);
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
  z-index: 1;
}

/* 小说信息容器 */
.novel-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* 小说头部信息 */
.novel-header {
  margin-bottom: 12px;
}
.novel-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
  transition: color 0.2s ease;
}
.novel-card:hover .novel-title {
  color: var(--primary);
}
.novel-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}
.novel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.tag {
  display: inline-block;
  padding: 4px 12px;
  background: #eff6ff;
  color: var(--primary);
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
}
.tag:hover {
  background: #dbeafe;
  transform: translateY(-1px);
}

/* 小说简介 */
.novel-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}
.novel-desc.expanded {
  -webkit-line-clamp: unset;
}
.read-more {
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  margin-top: -16px;
  margin-bottom: 16px;
  display: inline-block;
  transition: all 0.2s ease;
}
.read-more:hover {
  text-decoration: underline;
  transform: translateX(2px);
}

/* 操作按钮组 */
.novel-actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
  flex-wrap: wrap;
}
.read-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}
.read-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.collect-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}
.collect-btn:hover {
  background: #f8fafc;
  color: var(--primary);
  border-color: var(--primary-light);
  transform: translateY(-2px);
}
.write-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}
.write-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* 底部统计信息 */
.novel-stats {
  display: flex;
  gap: 24px;
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 16px;
  flex-wrap: wrap;
}
.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s ease;
}
.stat-item:hover {
  color: var(--primary);
}

/* 写作管理样式 */
.write-section {
  display: none;
}
.write-section.active {
  display: block;
}
.write-tabs {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.write-tab {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.write-tab:hover {
  color: var(--primary);
}
.write-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}
.tab-content.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.form-group {
  margin-bottom: 24px;
}
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: all 0.2s ease;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.form-group textarea {
  resize: vertical;
  min-height: 120px;
}
.btn-group {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover {
  transform: translateY(-2px);
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: #f8fafc;
  color: var(--primary);
  border-color: var(--primary-light);
}
.character-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.2s ease;
}
.character-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.character-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.character-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}
.chapter-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.2s ease;
}
.chapter-item:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.chapter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.chapter-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-main);
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}
.prompt-generator {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 24px;
  transition: all 0.2s ease;
}
.prompt-generator:hover {
  box-shadow: var(--shadow);
}
.prompt-output {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  font-family: monospace;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  min-height: 120px;
}
.copy-btn {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.copy-btn:hover {
  background: #f8fafc;
  color: var(--primary);
  border-color: var(--primary-light);
  transform: translateY(-1px);
}

/* 标签选择样式 */
.tag-label {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.tag-label:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}
.tag-label.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* 分析历史项 */
.history-item {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  background: var(--bg-card);
  transition: all 0.2s ease;
}
.history-item:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

/* 响应式适配 */
@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    height: auto;
    padding: 16px 20px;
    gap: 16px;
  }
  .nav-menu {
    flex-wrap: wrap;
    justify-content: center;
  }
  .search-box {
    width: 100%;
  }
  .novel-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .cover-container {
    width: 160px;
    height: 220px;
  }
  .novel-tags {
    justify-content: center;
  }
  .novel-actions {
    justify-content: center;
    flex-wrap: wrap;
  }
  .novel-stats {
    justify-content: center;
  }
  .write-tabs {
    flex-wrap: wrap;
  }
  .btn-group {
    flex-direction: column;
  }
  .main-content {
    padding: 20px 0;
  }
  .page-title {
    font-size: 24px;
    text-align: center;
  }
  .page-title::after {
    left: 50%;
    transform: translateX(-50%);
  }
}

/* 页脚样式 */
.footer {
  margin-top: 60px;
  text-align: center;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: 13px;
  background: var(--bg-card);
  transition: all 0.3s ease;
}

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

.novel-card {
  animation: fadeInUp 0.5s ease;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* 加载动画 */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(59, 130, 246, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s ease-in-out infinite;
}

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

/* 消息提示 */
.message {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.message.success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.message.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.message.info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* 主题切换按钮 */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--primary);
}

.theme-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.theme-option.active {
  background: var(--primary);
  color: white;
}

/* 移动端菜单 */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-primary);
  cursor: pointer;
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
  }
  
  .nav-menu {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    flex-direction: column;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
  }
  
  .nav-menu.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }
}