/* 全局样式 */
:root {
  --primary-color: #ff9000;
  --primary-color-light: #ffb142;
  --primary-color-dark: #e67e00;
  --secondary-color: #6c5ce7;
  --accent-color: #00b894;
  --bg-color: #0d0d0d;
  --bg-gradient-start: #0a0a0a;
  --bg-gradient-end: #1a1a1a;
  --card-bg-color: #1a1a1a;
  --card-bg-light: rgba(26, 26, 26, 0.7);
  --text-color: #fff;
  --text-secondary: #b2bec3;
  --hover-bg-color: #2a2a2a;
  --border-radius: 12px;
  --transition-speed: 0.3s;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
  --border-color-light: rgba(255, 255, 255, 0.1);
  --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--primary-color-light));
  --gradient-secondary: linear-gradient(135deg, var(--secondary-color), #a29bfe);
  --gradient-bg: linear-gradient(180deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
}

html {
  font-size: 16px;
  box-sizing: border-box;
  scroll-behavior: smooth;
}

*, *::before, *::after {
  box-sizing: inherit;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  background-image: var(--gradient-bg);
  background-attachment: fixed;
  color: var(--text-color);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* 背景装饰元素 */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(255, 144, 0, 0.05) 0%, transparent 20%),
    radial-gradient(circle at 90% 80%, rgba(108, 92, 231, 0.07) 0%, transparent 20%),
    radial-gradient(circle at 50% 50%, rgba(0, 184, 148, 0.05) 0%, transparent 30%);
  z-index: -1;
  pointer-events: none;
}

/* 亮色主题特定样式 */
[data-theme="light"] body::before {
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(255, 144, 0, 0.08) 0%, transparent 25%),
    radial-gradient(circle at 90% 80%, rgba(108, 92, 231, 0.06) 0%, transparent 25%),
    radial-gradient(circle at 50% 50%, rgba(0, 184, 148, 0.04) 0%, transparent 35%);
}

/* 头部样式 */
header {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  padding: 1.5rem 1rem;
  text-align: center;
  box-shadow: var(--shadow-md);
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* 亮色主题特定头部样式 */
[data-theme="light"] header {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border-color-light);
}

header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary-color);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 2px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 10px rgba(255, 144, 0, 0.3);
  position: relative;
  display: inline-block;
}

header h1::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 3px;
  transform: scaleX(0.8);
}

/* 导航栏样式 */
nav {
  background: rgba(26, 26, 26, 0.9);
  backdrop-filter: blur(10px);
  padding: 0.8rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* 亮色主题特定导航栏样式 */
[data-theme="light"] nav {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border-color-light);
}

nav ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

nav li {
  margin: 0;
}

nav a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: 2rem;
  transition: all var(--transition-speed) ease;
  display: inline-block;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

nav a::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-speed);
  z-index: -1;
}

nav a:hover::before,
nav a.active::before {
  opacity: 1;
}

nav a:hover,
nav a.active {
  color: #000;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: transparent;
}

/* 主要内容区域 */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  min-height: calc(100vh - 180px);
}

/* 分类标题样式 */
.category-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 2.5rem 0 1.5rem;
  color: var(--primary-color);
  border-left: 5px solid var(--primary-color);
  padding-left: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  display: flex;
  align-items: center;
}

.category-title::after {
  content: "";
  flex-grow: 1;
  height: 1px;
  background: linear-gradient(to right, var(--primary-color), transparent);
  margin-left: 1rem;
  opacity: 0.5;
}

.category-title i {
  margin-right: 0.8rem;
  font-size: 1.5rem;
  opacity: 0.8;
}

/* 链接网格布局 */
.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 1.2rem;
  margin-bottom: 2.5rem;
}

/* 链接卡片样式 */
.link-card {
  background-color: var(--card-bg-light);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius);
  padding: 1.5rem 1rem;
  text-align: center;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 110px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-sm);
  will-change: transform, opacity; /* 提示浏览器优化渲染性能 */
}

.link-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-speed);
  z-index: 1;
  border-radius: var(--border-radius);
}

.link-card a {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  text-decoration: none;
  z-index: 12;
  display: block;
}

.link-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(255, 255, 255, 0.2);
}

.link-card:hover::before {
  opacity: 0.1;
}

.link-card i {
  font-size: 2rem;
  margin-bottom: 0.8rem;
  color: var(--primary-color);
  transition: transform 0.2s ease, color 0.2s ease, filter 0.2s ease;
  position: relative;
  z-index: 11;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  will-change: transform, filter; /* 提示浏览器优化渲染性能 */
}

.link-card:hover i {
  transform: translateY(-3px) scale(1.15);
  color: var(--primary-color-light);
  filter: drop-shadow(0 4px 8px rgba(255, 144, 0, 0.3));
}

.link-card h3 {
  font-size: 0.95rem;
  margin: 0;
  color: var(--text-color);
  line-height: 1.4;
  font-weight: 600;
  max-width: 100%;
  height: 2.6em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  white-space: normal;
  padding: 0 0.3rem;
  position: relative;
  z-index: 11;
  transition: color 0.2s ease;
  will-change: transform; /* 提示浏览器优化渲染性能 */
}

.link-card:hover h3 {
  color: var(--primary-color-light);
}

/* 页脚样式 */
footer {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  color: var(--text-secondary);
  text-align: center;
  padding: 1.5rem;
  font-size: 0.85rem;
  margin-top: 3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* 亮色主题特定页脚样式 */
[data-theme="light"] footer {
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid var(--border-color-light);
}

footer p {
  margin: 0 0 0.8rem;
  opacity: 0.9;
}

footer nav {
  margin-top: 1rem;
  background-color: transparent;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

footer nav a {
  color: var(--text-secondary);
  margin: 0;
  font-size: 0.85rem;
  text-decoration: none;
  transition: all var(--transition-speed);
  position: relative;
  padding-bottom: 3px;
}

footer nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: width var(--transition-speed);
}

footer nav a:hover {
  color: var(--primary-color);
  background-color: transparent;
}

footer nav a:hover::after {
  width: 100%;
}

/* 搜索框样式 */
.search-container {
  max-width: 700px;
  margin: 2rem auto;
  position: relative;
}

.search-box {
  width: 100%;
  padding: 1rem 1.5rem;
  padding-right: 3.5rem;
  border-radius: 50px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(26, 26, 26, 0.7);
  backdrop-filter: blur(10px);
  color: var(--text-color);
  font-size: 1rem;
  font-weight: 500;
  outline: none;
  transition: all var(--transition-speed) ease;
  box-shadow: var(--shadow-sm);
}

/* 亮色主题特定搜索框样式 */
[data-theme="light"] .search-box {
  background-color: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--border-color-light);
}

.search-box:focus {
  border-color: var(--primary-color);
  background-color: rgba(26, 26, 26, 0.9);
  box-shadow: 0 0 0 3px rgba(255, 144, 0, 0.2);
}

.search-box::placeholder {
  color: var(--text-secondary);
  font-weight: 400;
}

.search-button {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--gradient-primary);
  border: none;
  color: #000;
  cursor: pointer;
  padding: 0.7rem;
  font-size: 1.2rem;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed) ease;
  box-shadow: var(--shadow-sm);
}

.search-button:hover {
  transform: translateY(-50%) scale(1.1);
  box-shadow: var(--shadow-md);
}

.search-button:active {
  transform: translateY(-50%) scale(0.95);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(26, 26, 26, 0.95);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius);
  margin-top: 0.8rem;
  max-height: 350px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 亮色主题特定搜索结果样式 */
[data-theme="light"] .search-results {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border-color-light);
}

.search-result-item {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* 亮色主题特定搜索结果项样式 */
[data-theme="light"] .search-result-item {
  border-bottom: 1px solid var(--border-color-light);
}

.search-result-item:hover {
  background-color: rgba(255, 144, 0, 0.1);
}

/* 亮色主题特定搜索结果项悬停样式 */
[data-theme="light"] .search-result-item:hover {
  background-color: rgba(255, 144, 0, 0.08);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item h4 {
  margin: 0;
  color: var(--primary-color);
  font-size: 1rem;
  font-weight: 600;
}

.search-result-item p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.search-result-item i {
  color: var(--primary-color);
  font-size: 1.2rem;
  opacity: 0.8;
}

.no-results {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.no-results i {
  font-size: 2rem;
  color: var(--text-secondary);
  opacity: 0.5;
}

/* 返回顶部按钮 */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--gradient-primary);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-speed) cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 999;
  box-shadow: var(--shadow-md);
  font-weight: bold;
  font-size: 1.2rem;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.back-to-top:active {
  transform: translateY(-2px);
}

/* 暗色模式切换开关 */
.theme-toggle {
  position: absolute;
  top: 1.2rem;
  right: 1.5rem;
  width: 50px;
  height: 26px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  border: none;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  display: flex;
  align-items: center;
  padding: 0 5px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.theme-toggle i {
  color: var(--text-color);
  font-size: 1rem;
  transition: all var(--transition-speed) ease;
  margin-left: auto;
  transform: translateX(0);
}

.theme-toggle.light-theme {
  background: var(--gradient-primary);
}

.theme-toggle.light-theme i {
  color: #000;
  transform: translateX(-24px);
}

.theme-toggle.dark-theme {
  background: rgba(255, 255, 255, 0.1);
}

.theme-toggle.dark-theme i {
  color: var(--text-color);
  transform: translateX(0);
}

/* 添加主题切换动画 */
@keyframes themeChange {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.theme-toggle i.animating {
  animation: themeChange 0.6s ease-in-out;
}

/* 加载动画 */
.loading {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 页面加载动画 - 优化性能 */
.page-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  will-change: opacity, visibility; /* 提示浏览器优化渲染性能 */
}

.page-loading.hide {
  opacity: 0;
  visibility: hidden;
}

.page-loading-logo {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: pulse 1.5s ease-in-out infinite;
}

.page-loading-text {
  color: var(--text-secondary);
  font-size: 1.2rem;
  letter-spacing: 1px;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

/* 卡片悬浮动画 - 优化性能 */
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

.float-animation {
  animation: float 4s ease-in-out infinite;
  will-change: transform; /* 提示浏览器优化渲染性能 */
}

/* 波纹效果 */
.ripple {
  position: absolute;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.3);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* 响应式设计 */
@media (max-width: 1200px) {
  main {
    padding: 1.2rem;
    max-width: 95%;
  }

  .link-grid {
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
    gap: 1.1rem;
  }
}

@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  main {
    padding: 1rem;
  }

  .link-grid {
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
    gap: 1rem;
  }

  nav {
    padding: 0.6rem;
  }

  nav a {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .category-title {
    font-size: 1.6rem;
    margin: 2rem 0 1.2rem;
  }

  .link-card {
    padding: 1.2rem 0.8rem;
    min-height: 100px;
  }

  .link-card i {
    font-size: 1.8rem;
    margin-bottom: 0.6rem;
  }

  .link-card h3 {
    font-size: 0.9rem;
    height: 2.5em;
  }

  .search-container {
    margin: 1.5rem auto;
  }

  .search-box {
    padding: 0.9rem 1.2rem;
    padding-right: 3rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  main {
    padding: 0.8rem;
  }

  .link-grid {
    grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
    gap: 0.9rem;
  }

  header h1 {
    font-size: 1.8rem;
  }

  nav li {
    margin: 0.2rem;
  }

  nav a {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }

  .category-title {
    font-size: 1.5rem;
    margin: 1.8rem 0 1rem;
  }

  .link-card {
    padding: 1rem 0.7rem;
    min-height: 90px;
  }

  .link-card i {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
  }

  .link-card h3 {
    font-size: 0.85rem;
    padding: 0 0.2rem;
    height: 2.4em;
  }

  footer {
    padding: 1.2rem;
  }

  footer nav {
    flex-wrap: wrap;
    gap: 1rem;
  }

  footer nav a {
    font-size: 0.8rem;
  }

  .search-container {
    margin: 1.2rem auto;
  }

  .search-box {
    padding: 0.8rem 1rem;
    padding-right: 2.8rem;
  }

  .back-to-top {
    width: 45px;
    height: 45px;
    bottom: 20px;
    right: 20px;
  }
}

@media (max-width: 360px) {
  html {
    font-size: 13px;
  }

  .link-grid {
    grid-template-columns: repeat(auto-fill, minmax(5.8rem, 1fr));
    gap: 0.8rem;
  }

  header h1 {
    font-size: 1.6rem;
  }

  .link-card {
    padding: 0.9rem 0.6rem;
    min-height: 85px;
  }

  .link-card i {
    font-size: 1.5rem;
    margin-bottom: 0.4rem;
  }

  .link-card h3 {
    font-size: 0.8rem;
    padding: 0 0.15rem;
    height: 2.2em;
  }

  .search-box {
    padding: 0.7rem 0.9rem;
    padding-right: 2.6rem;
  }
}
