/* ============================================================
   AI短剧导航 - 主样式表
   模仿 zhangaiping.com 布局风格的专业导航站点
   ============================================================ */

/* --- CSS 变量 --- */
:root {
  --primary: #2563eb;
  --primary-light: #dbeafe;
  --primary-dark: #1d4ed8;
  --accent: #f97316;
  --accent-light: #fff7ed;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #1e293b;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: 0.2s ease;
  --max-width: 1400px;
  --sidebar-width: 260px;
  --header-height: 64px;
}

/* --- 重置与基础 --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
  height: auto;
}

ul,
ol {
  list-style: none;
}

/* --- 布局 --- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* --- 侧边栏 --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: #ffffff;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-nav-title {
  padding: 8px 24px 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 600;
}

.sidebar-menu {
  padding: 8px 0;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.9rem;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-left-color: var(--primary);
}

.sidebar-menu li a .menu-icon {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.sidebar-menu li a .menu-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
}

/* --- 主内容区 --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- 顶部导航 --- */
.top-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 0 16px;
  flex: 1;
  max-width: 480px;
  transition: all var(--transition);
}

.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-bar input {
  border: none;
  background: transparent;
  padding: 10px 0;
  flex: 1;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

.search-bar .search-icon {
  color: var(--text-muted);
  font-size: 1rem;
  margin-right: 8px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-stats {
  display: flex;
  gap: 16px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 4px 10px;
  background: var(--bg);
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.stat-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.stat-item.hot {
  color: var(--danger);
  background: var(--danger-light);
}

.stat-item.free {
  color: var(--success);
  background: var(--success-light);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

/* --- 内容容器 --- */
.content-wrapper {
  flex: 1;
  padding: 32px;
  max-width: var(--max-width);
  width: 100%;
}

/* --- 面包屑 --- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-secondary);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb .separator {
  color: var(--text-muted);
}

.breadcrumb .current {
  color: var(--text);
  font-weight: 500;
}

/* --- 页面标题区 --- */
.page-hero {
  margin-bottom: 32px;
}

.page-hero h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-hero h1 .hero-icon {
  font-size: 2.2rem;
}

.page-hero .hero-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* --- 统计栏 --- */
.stats-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.stats-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 140px;
  transition: all var(--transition);
  cursor: pointer;
}

.stats-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stats-card .stat-icon {
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.stats-card .stat-icon.blue {
  background: var(--primary-light);
  color: var(--primary);
}
.stats-card .stat-icon.orange {
  background: var(--accent-light);
  color: var(--accent);
}
.stats-card .stat-icon.green {
  background: var(--success-light);
  color: var(--success);
}
.stats-card .stat-icon.purple {
  background: #f3e8ff;
  color: #7c3aed;
}

.stats-card .stat-info .stat-num {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.stats-card .stat-info .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- 分类筛选标签 --- */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.filter-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* --- 热门推荐区 --- */
.section {
  margin-bottom: 40px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title .section-icon {
  font-size: 1.4rem;
}

.section-more {
  font-size: 0.85rem;
  color: var(--primary);
}

/* --- 热门工具卡片网格 --- */
.hot-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.hot-tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.hot-tool-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--primary-light);
}

.hot-tool-card .tool-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
}

.hot-tool-card .tool-info {
  flex: 1;
  min-width: 0;
}

.hot-tool-card .tool-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.hot-tool-card .tool-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hot-tool-card .tool-tags {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.tool-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.tool-tag.hot {
  background: var(--danger-light);
  color: var(--danger);
}

.tool-tag.free {
  background: var(--success-light);
  color: var(--success);
}

.tool-tag.new {
  background: #f3e8ff;
  color: #7c3aed;
}

.hot-tool-card .tool-arrow {
  color: var(--text-muted);
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 14px;
  transition: all var(--transition);
}

.hot-tool-card:hover .tool-arrow {
  color: var(--primary);
  transform: translateX(3px);
}

.hot-tool-card .card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

/* --- 分类板块 --- */
.category-section {
  margin-bottom: 36px;
}

.category-section .cat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
}

.category-section .cat-number {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.category-section .cat-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.category-section .cat-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* --- 工具列表 --- */
.tool-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 10px;
}

.tool-item {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition);
  cursor: pointer;
}

.tool-item:hover {
  box-shadow: var(--shadow);
  border-color: var(--primary-light);
  background: #fafbff;
}

.tool-item .item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.tool-item .item-icon.blue {
  background: var(--primary-light);
}
.tool-item .item-icon.purple {
  background: #f3e8ff;
}
.tool-item .item-icon.orange {
  background: var(--accent-light);
}
.tool-item .item-icon.green {
  background: var(--success-light);
}
.tool-item .item-icon.pink {
  background: #fce7f3;
}
.tool-item .item-icon.cyan {
  background: #ecfeff;
}
.tool-item .item-icon.indigo {
  background: #e0e7ff;
}

.tool-item .item-info {
  flex: 1;
  min-width: 0;
}

.tool-item .item-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.tool-item .item-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-item .item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-fav {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
  padding: 4px;
}

.btn-fav:hover {
  color: var(--warning);
  transform: scale(1.2);
}

.btn-visit {
  font-size: 0.75rem;
  padding: 5px 12px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-visit:hover {
  background: var(--primary-dark);
  color: #fff;
}

/* --- 相关推荐 --- */
.related-tools {
  margin-top: 48px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.related-tools h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--text);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.related-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--bg);
  transition: all var(--transition);
  border: 1px solid transparent;
}

.related-item:hover {
  border-color: var(--primary-light);
  background: #fff;
}

.related-item .related-icon {
  font-size: 1.1rem;
}

.related-item .related-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

/* --- 详情页 --- */
.detail-container {
  max-width: 900px;
}

.detail-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
}

.detail-header .detail-top {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}

.detail-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  flex-shrink: 0;
}

.detail-icon.blue {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}
.detail-icon.purple {
  background: linear-gradient(135deg, #f3e8ff, #e9d5ff);
}
.detail-icon.orange {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
}

.detail-info h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.detail-info .detail-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.detail-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.detail-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.detail-body {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.detail-body h2 {
  font-size: 1.2rem;
  margin-bottom: 12px;
  margin-top: 24px;
  color: var(--text);
}

.detail-body h2:first-child {
  margin-top: 0;
}

.detail-body p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.detail-features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text);
}

.feature-item .feature-icon {
  color: var(--success);
  font-weight: 700;
}

/* --- 关于页面 --- */
.about-container {
  max-width: 800px;
  margin: 0 auto;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  margin-bottom: 24px;
}

.about-card h2 {
  font-size: 1.2rem;
  margin-bottom: 12px;
  color: var(--text);
}

.about-card p {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 0.95rem;
  margin-bottom: 10px;
}

/* --- 页脚 --- */
.site-footer {
  background: var(--bg-sidebar);
  color: rgba(255, 255, 255, 0.7);
  padding: 32px;
  margin-top: auto;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
  transition: color var(--transition);
}

.footer-links a:hover {
  color: #fff;
}

.footer-copy {
  font-size: 0.8rem;
}

/* --- 回到顶部 --- */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  border: none;
  z-index: 90;
  opacity: 0;
  transform: translateY(20px);
  transition: all var(--transition);
  pointer-events: none;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
}

/* --- 移动端遮罩 --- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block;
}

/* ============================================================
   响应式设计
   ============================================================ */

/* 平板及以下 */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: block;
  }

  .content-wrapper {
    padding: 20px 16px;
  }

  .hot-tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .tool-list {
    grid-template-columns: 1fr;
  }

  .stats-bar {
    gap: 8px;
  }

  .stats-card {
    padding: 12px 16px;
    min-width: 120px;
  }

  .header-stats {
    display: none;
  }

  .page-hero h1 {
    font-size: 1.5rem;
  }
}

/* 手机端 */
@media (max-width: 640px) {
  .top-header {
    padding: 0 12px;
    height: 56px;
  }

  .search-bar {
    max-width: 100%;
  }

  .content-wrapper {
    padding: 16px 12px;
  }

  .hot-tools-grid {
    grid-template-columns: 1fr;
  }

  .hot-tool-card {
    padding: 16px;
  }

  .detail-header {
    padding: 20px;
  }

  .detail-header .detail-top {
    flex-direction: column;
  }

  .detail-body {
    padding: 20px;
  }

  .stats-bar {
    flex-wrap: wrap;
    gap: 6px;
  }

  .stats-card {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
  }

  .filter-tabs {
    gap: 4px;
  }

  .filter-tab {
    font-size: 0.75rem;
    padding: 5px 10px;
  }

  .section-title {
    font-size: 1rem;
  }

  .category-section .cat-title {
    font-size: 1rem;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .detail-features {
    grid-template-columns: 1fr;
  }
}
