/* ============================================
   ClashX 网站样式 - 现代简约风格
   支持深色模式
   ============================================ */

/* ========== CSS变量定义 ========== */
:root {
  /* 浅色主题 */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --border-color: #dee2e6;
  --accent-color: #007bff;
  --accent-hover: #0056b3;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --card-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] {
  /* 深色主题 */
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-tertiary: #3d3d3d;
  --text-primary: #f8f9fa;
  --text-secondary: #adb5bd;
  --text-muted: #6c757d;
  --border-color: #404040;
  --accent-color: #4dabf7;
  --accent-hover: #339af0;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --card-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ========== 基础样式重置 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========== 导航栏样式 ========== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  padding: 1rem 0;
  box-shadow: var(--card-shadow);
  transition: all 0.3s ease;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.3s ease;
  line-height: 1;
}

.nav-logo:hover {
  color: var(--accent-hover);
}

.nav-logo img {
  height: 35px;
  width: auto;
  display: block;
  object-fit: contain;
}

.nav-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.nav-logo-title {
  font-size: 1.5rem;
  font-weight: bold;
}

.nav-logo-subtitle {
  font-size: 0.7rem;
  font-weight: normal;
  color: var(--text-secondary);
  margin-top: 0.1rem;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
  align-items: center;
}

.nav-item {
  position: relative;
}

.nav-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
  padding: 0.5rem 0;
  display: block;
}

.nav-link:hover {
  color: var(--accent-color);
}

/* 下拉菜单 */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--card-shadow-hover);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  margin-top: 0.5rem;
  padding: 0.5rem 0;
}

.dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: block;
  padding: 0.75rem 1.5rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.dropdown-item:hover {
  background-color: var(--bg-secondary);
}

/* 控制按钮组 */
.nav-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.control-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.control-btn:hover {
  background-color: var(--bg-secondary);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

/* ========== 主内容区域 ========== */
.main-content {
  margin-top: 80px;
  min-height: calc(100vh - 80px);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* ========== 卡片样式 ========== */
.card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: var(--card-shadow-hover);
}

.card-title {
  font-size: 1.75rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* ========== 紧凑区域样式 ========== */
.compact-section {
  margin-bottom: 1rem !important;
}

.compact-section .card-subtitle {
  margin-top: 0.75rem !important;
  margin-bottom: 0.5rem !important;
}

.compact-section p.mb-3 {
  margin-bottom: 0.75rem !important;
}

.compact-section ul {
  margin-top: 0.5rem;
}

/* ========== 按钮样式 ========== */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: var(--accent-color);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.btn:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-tertiary);
}

/* ========== 下载按钮样式 ========== */
.btn-download-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  min-width: 280px;
}

.btn-download-primary:hover {
  background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
  color: white;
}

.btn-download-primary:active {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 123, 255, 0.3);
}

[data-theme="dark"] .btn-download-primary {
  background: linear-gradient(135deg, #4dabf7 0%, #339af0 100%);
  box-shadow: 0 4px 15px rgba(77, 171, 247, 0.3);
}

[data-theme="dark"] .btn-download-primary:hover {
  background: linear-gradient(135deg, #339af0 0%, #228be6 100%);
  box-shadow: 0 6px 20px rgba(77, 171, 247, 0.4);
}

/* ========== 返回顶部按钮 ========== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--card-shadow-hover);
  transition: all 0.3s ease;
  z-index: 999;
}

.back-to-top:hover {
  background-color: var(--accent-hover);
  transform: translateY(-3px);
}

.back-to-top.show {
  display: flex;
}

/* ========== 图片样式 ========== */
.content-image {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5rem auto;
  display: block;
  box-shadow: var(--card-shadow);
}

.image-placeholder {
  width: 100%;
  height: 300px;
  background-color: var(--bg-secondary);
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin: 1.5rem 0;
}

/* ========== 列表样式 ========== */
.content-list {
  list-style: none;
  padding-left: 0;
}

.content-list li {
  padding: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
}

.content-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent-color);
  font-weight: bold;
}

/* ========== PC端横向列表样式 ========== */
.content-list.inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  align-items: center;
}

.content-list.inline-list li {
  padding: 0;
  padding-left: 1.2rem;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  position: relative;
}

.content-list.inline-list li:not(:last-child)::after {
  content: "  ";
  margin-left: 0.5rem;
  color: var(--text-muted);
  font-weight: normal;
}

@media (max-width: 768px) {
  .content-list.inline-list {
    display: block;
  }
  
  .content-list.inline-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    display: block;
    white-space: normal;
  }
  
  .content-list.inline-list li:not(:last-child)::after {
    content: "";
    margin-left: 0;
  }
}

/* ========== 代码块样式 ========== */
.code-block {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  margin: 1rem 0;
  font-family: "Courier New", monospace;
  overflow-x: auto;
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
  .nav-menu {
    position: fixed;
    top: 70px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 70px);
    background-color: var(--bg-primary);
    flex-direction: column;
    align-items: flex-start;
    padding: 2rem;
    transition: left 0.3s ease;
    box-shadow: var(--card-shadow);
  }

  .nav-menu.active {
    left: 0;
  }

  .nav-item {
    width: 100%;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
  }

  .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    margin-top: 0.5rem;
    padding-left: 1rem;
  }

  .mobile-menu-btn {
    display: block;
  }

  .nav-controls {
    gap: 0.5rem;
  }

  .control-btn {
    padding: 0.5rem;
    font-size: 0.8rem;
  }

  .container {
    padding: 1rem;
  }

  .card {
    padding: 1.5rem;
  }

  .back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
  }

  .nav-logo img {
    height: 30px;
  }

  .nav-logo {
    gap: 0.5rem;
  }

  .nav-logo-title {
    font-size: 1.25rem;
  }

  .nav-logo-subtitle {
    font-size: 0.65rem;
  }
}

/* ========== 工具类 ========== */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.ml-1 { margin-left: 0.5rem; }
.ml-2 { margin-left: 1rem; }
.ml-3 { margin-left: 1.5rem; }

.mr-1 { margin-right: 0.5rem; }
.mr-2 { margin-right: 1rem; }
.mr-3 { margin-right: 1.5rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* ========== 链接样式优化 ========== */
a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--accent-hover);
}

/* ========== GitHub 链接样式 ========== */
.github-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.3s ease;
}

.github-link:hover {
  color: var(--accent-color);
}

.github-link.link-unavailable {
  opacity: 0.7;
  color: var(--text-secondary);
}

.github-link.link-unavailable:hover {
  opacity: 1;
  color: var(--accent-color);
}

.github-link.link-unavailable .link-text {
  text-decoration: line-through;
}

.github-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  vertical-align: middle;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .github-link {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    max-width: 100%;
    word-break: break-all;
    overflow-wrap: anywhere;
  }
  
  .github-link svg,
  .github-link .github-icon {
    flex-shrink: 0;
  }
  
  .github-link .link-text {
    word-break: break-all;
    overflow-wrap: anywhere;
  }
  
  .compact-section p {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-all;
  }
}

.small-text {
  font-size: calc(1em - 3px);
  vertical-align: baseline;
}

.badge-btn {
  display: inline-block;
  background-color: #000000;
  color: #ffffff;
  padding: 0.12em 0.4em;
  border-radius: 3px;
  font-size: calc(0.75em - 1px);
  font-weight: 500;
  line-height: 1.5;
  margin-left: 0;
  vertical-align: baseline;
  white-space: nowrap;
}

/* ========== 替代方案卡片网格布局 ========== */
.alternatives-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (max-width: 768px) {
  .alternatives-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.alternative-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.alternative-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

.alternative-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alternative-card-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 6px;
  background-color: var(--bg-primary);
  padding: 2px;
}

.alternative-card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.alternative-card-protocols {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.6;
  flex-grow: 1;
}

.alternative-card-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.alternative-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background-color: var(--accent-color);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.alternative-btn:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.alternative-btn.secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.alternative-btn.secondary:hover {
  background-color: var(--border-color);
}

.alternative-btn.unavailable {
  opacity: 0.6;
  cursor: not-allowed;
}

.alternative-btn.unavailable:hover {
  transform: none;
  opacity: 0.6;
}

.alternative-btn.link-unavailable .link-text {
  text-decoration: line-through;
}

@media (max-width: 768px) {
  .alternative-card {
    padding: 1rem;
  }
  
  .alternative-card-title {
    font-size: 1.1rem;
    gap: 0.5rem;
  }
  
  .alternative-card-logo {
    width: 28px;
    height: 28px;
  }
  
  .alternative-card-desc {
    font-size: 0.85rem;
  }
  
  .alternative-card-protocols {
    font-size: 0.8rem;
  }
  
  .alternative-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }
}

/* ========== 代码样式优化 ========== */
code {
  background-color: var(--bg-secondary);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-size: 0.9em;
  color: var(--text-primary);
}

/* ========== 表格样式优化 ========== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

table th,
table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

table th {
  background-color: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

table tr:hover {
  background-color: var(--bg-secondary);
}

/* ========== 滚动条样式（Webkit浏览器） ========== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

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

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

/* ========== 选择文本样式 ========== */
::selection {
  background-color: var(--accent-color);
  color: white;
}

::-moz-selection {
  background-color: var(--accent-color);
  color: white;
}

