/* ====== 基础变量与重置 ====== */
:root {
  --bg-primary: #0f1115;
  --bg-secondary: #171923;
  --bg-card: #1e2130;
  --bg-hover: #262a3d;
  --border-color: #2a2f45;
  --text-primary: #ffffff;
  --text-secondary: #a0a6b8;
  --text-muted: #6b7280;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --accent-dark: #5a4bd1;
  --success: #00b894;
  --warning: #fdcb6e;
  --danger: #ff6b6b;
  --gradient: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

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

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

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

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ====== 导航栏 ====== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(15, 17, 21, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.navbar.scrolled {
  box-shadow: var(--shadow-md);
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

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

.logo i {
  font-size: 24px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.nav-links a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  transition: var(--transition);
  position: relative;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient);
  transition: var(--transition);
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-search {
  position: relative;
  width: 240px;
}

.nav-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.nav-search input {
  width: 100%;
  height: 38px;
  padding: 0 16px 0 40px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.nav-search input::placeholder {
  color: var(--text-muted);
}

.nav-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
  width: 300px;
}

.mobile-toggle {
  display: none;
  color: var(--text-primary);
  font-size: 20px;
  padding: 8px;
}

/* ====== Hero 区域 ====== */
.hero {
  position: relative;
  padding: 160px 0 100px;
  overflow: hidden;
  text-align: center;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(108, 92, 231, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(162, 155, 254, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(0, 184, 148, 0.08) 0%, transparent 50%);
  z-index: 0;
}

.hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 50px 50px;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

.hero h1 {
  font-size: 56px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #ffffff 0%, #a29bfe 50%, #ffffff 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shine 4s linear infinite;
}

@keyframes shine {
  to { background-position: 200% center; }
}

.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 48px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 64px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-number {
  font-size: 36px;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 14px;
  color: var(--text-muted);
}

/* ====== 通用 Section Header ====== */
.section-header {
  text-align: center;
  margin-bottom: 40px;
}

.section-header h2 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 15px;
}

/* ====== 主布局（侧边栏 + 内容） ====== */
.main-layout {
  display: flex;
  gap: 0;
  padding-top: 0;
}

/* 侧边栏 */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 20px 12px;
  border-right: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
}
.sidebar-title i { color: var(--accent-light); }

.sidebar-cats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-cats .category-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  position: relative;
  width: 100%;
}
.sidebar-cats .category-tab::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  border-radius: 2px;
  background: var(--gradient);
  transition: height 0.2s;
}
.sidebar-cats .category-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.sidebar-cats .category-tab.active {
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent-light);
  font-weight: 600;
}
.sidebar-cats .category-tab.active::before {
  height: 20px;
}
.sidebar-cats .category-tab .tab-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
}
.sidebar-cats .category-tab .tab-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 10px;
}
.sidebar-cats .category-tab.active .tab-count {
  color: var(--accent-light);
  background: rgba(108, 92, 231, 0.25);
}

.sidebar-count {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.sidebar-count span {
  color: var(--accent-light);
  font-weight: 700;
  font-size: 16px;
}

/* 软件主内容区 */
.software-main {
  flex: 1;
  min-width: 0;
}

/* 移动端分类抽屉按钮 */
.cat-drawer-btn {
  display: none;
  position: fixed;
  left: 12px;
  bottom: 20px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.5);
  cursor: pointer;
}

/* ====== 软件列表 ====== */
.software-section {
  padding: 96px 0 60px;
}

.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.result-info {
  color: var(--text-secondary);
  font-size: 14px;
}

.result-info span {
  color: var(--accent-light);
  font-weight: 600;
}

.sort-options select {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.sort-options select:focus {
  border-color: var(--accent);
}

.software-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* 软件卡片 */
.software-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.software-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.software-card:hover {
  transform: translateY(-4px);
  border-color: transparent;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--accent);
}

.software-card:hover::before {
  transform: scaleX(1);
}

.card-header {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.card-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
  color: white;
  overflow: hidden;
}
.card-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-version {
  font-size: 12px;
  color: var(--text-muted);
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
}

.card-desc {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-footer {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-download {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--gradient);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.btn-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.5);
}

.btn-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: var(--transition);
}

.btn-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}

.empty-state i {
  font-size: 64px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 20px;
}

.btn-reset {
  padding: 10px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
}

.btn-reset:hover {
  background: var(--accent);
  border-color: var(--accent);
}

/* ====== 关于区域 ====== */
.about-section {
  padding: 80px 0;
  background: var(--bg-secondary);
}

.about-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.about-card {
  text-align: center;
  padding: 40px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.about-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.about-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  background: var(--gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
}

.about-card h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

.about-card p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
}

/* ====== 页脚 ====== */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding-top: 60px;
}

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

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.footer-logo i {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-desc {
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 320px;
}

.footer-col h4 {
  font-size: 15px;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.footer-col ul {
  list-style: none;
}

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

.footer-col a {
  color: var(--text-secondary);
  font-size: 14px;
  transition: var(--transition);
}

.footer-col a:hover {
  color: var(--accent-light);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding: 24px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.footer-simple {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border-color);
  margin-top: 40px;
  background: var(--bg-secondary);
}

/* ====== 返回顶部 ====== */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 48px;
  height: 48px;
  background: var(--gradient);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: var(--transition);
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(108, 92, 231, 0.5);
}

/* ====== 动画 ====== */
.fade-in {
  animation: fadeInUp 0.5s ease forwards;
  opacity: 0;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ====== 响应式 ====== */
@media (max-width: 1024px) {
  .hero h1 { font-size: 42px; }
  .hero-stats { gap: 40px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .sidebar { width: 180px; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-container { gap: 10px; padding: 0 12px; height: 56px; }
  .logo span { display: none; }
  .nav-search { flex: 1; min-width: 0; }
  .mobile-toggle { display: block; }

  .hero { padding: 120px 0 60px; }
  .hero h1 { font-size: 32px; }
  .hero p { font-size: 15px; }
  .hero-stats { flex-direction: column; gap: 24px; }

  /* 移动端：侧边栏隐藏为抽屉 */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 260px;
    height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 40px rgba(0,0,0,0.6);
    flex-shrink: 0;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
    display: none;
  }
  .sidebar-backdrop.show { display: block; }

  .cat-drawer-btn { display: flex; align-items: center; gap: 6px; }

  .main-layout { padding-left: 0; }

  /* 防止手机端溢出 */
  body { overflow-x: hidden; }
  .container { max-width: 100%; }

  .section-header h2 { font-size: 26px; }
  .software-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; padding-bottom: 32px; }
  .filter-bar { flex-direction: column; gap: 12px; align-items: flex-start; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .software-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 28px; }
}

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

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

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

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