/* ===== 全局变量 & 重置 ===== */
:root {
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-light: #34d399;
  --secondary: #6366f1;
  --accent: #f59e0b;
  --bg-dark: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #252542;
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border: #2d2d4a;
  --gradient-1: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --gradient-2: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-3: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 亮色主题 */
[data-theme="light"] {
  --bg-dark: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* ===== 背景粒子效果 ===== */
.bg-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-particles::before {
  content: '';
  position: absolute;
  width: 200%;
  height: 200%;
  top: -50%;
  left: -50%;
  background: 
    radial-gradient(circle at 20% 30%, rgba(16, 185, 129, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(245, 158, 11, 0.05) 0%, transparent 50%);
  animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, 2%) rotate(1deg); }
  66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

/* ===== 导航栏 ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(15, 15, 26, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  height: 52px;
  display: flex;
  align-items: center;
}

[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.98);
}

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

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.125rem;
  text-decoration: none;
}

.logo-icon {
  font-size: 1.5rem;
}

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

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
}

/* 搜索框 - 参考样式 */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  width: 100%;
}

.filter-row input {
  flex: 1;
  min-width: 200px;
  padding: 0.625rem 0.875rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.filter-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.filter-row input::placeholder {
  color: var(--text-muted);
}

.search-action-btn {
  padding: 0.375rem 0.875rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: var(--transition);
}

.search-action-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.refresh-btn {
  padding: 0.375rem 0.875rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: var(--transition);
}

.refresh-btn:hover {
  background: var(--primary-dark);
}

.refresh-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

/* 搜索弹窗 */
.search-popup-wrapper {
  position: relative;
}

.search-btn {
  cursor: pointer;
}

.search-popup {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: none;
  z-index: 100;
  box-shadow: var(--shadow);
  min-width: 280px;
}

.search-popup.active {
  display: block;
  animation: dropdownIn 0.2s ease;
}

@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-popup input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  margin-bottom: 0.5rem;
}

.search-popup input:focus {
  border-color: var(--primary);
}

.search-popup .search-actions {
  display: flex;
  gap: 0.5rem;
}

.search-popup .search-actions button {
  flex: 1;
  padding: 0.5rem;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.search-popup .search-actions .search-confirm {
  background: var(--primary);
  color: white;
}

.search-popup .search-actions .search-confirm:hover {
  background: var(--primary-dark);
}

.search-popup .search-actions .search-cancel {
  background: var(--bg-dark);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.search-popup .search-actions .search-cancel:hover {
  background: var(--bg-card-hover);
}

/* 详情页返回按钮 */
.back-btn-fixed {
  position: fixed;
  top: 66px;
  left: 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  z-index: 99;
  transition: all 0.3s;
  text-decoration: none;
}

.back-btn-fixed:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--primary);
}

/* ===== 英雄区 ===== */
.hero {
  position: relative;
  padding: 5rem 2rem 3rem;
  text-align: center;
  overflow: hidden;
}

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

.hero-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #10b981 0%, #34d399 50%, #6ee7b7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.3;
  white-space: nowrap;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  padding: 1.5rem 0;
}

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

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

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-decoration {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.deco-block {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
}

.block-1 {
  width: 400px;
  height: 400px;
  background: var(--primary);
  top: -100px;
  left: -100px;
  animation: float1 8s ease-in-out infinite;
}

.block-2 {
  width: 300px;
  height: 300px;
  background: var(--secondary);
  top: 50%;
  right: -50px;
  animation: float2 10s ease-in-out infinite;
}

.block-3 {
  width: 250px;
  height: 250px;
  background: var(--accent);
  bottom: -50px;
  left: 30%;
  animation: float3 12s ease-in-out infinite;
}

@keyframes float1 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, 30px); }
}

@keyframes float2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-20px, 20px); }
}

@keyframes float3 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(10px, -20px); }
}

/* ===== 筛选栏 ===== */
.filter-section {
  background: rgba(15, 15, 26, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
}

[data-theme="light"] .filter-section {
  background: rgba(248, 250, 252, 0.98);
}

.filter-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.filter-group label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.filter-buttons {
  display: flex;
  gap: 0.5rem;
}

.filter-btn {
  padding: 0.375rem 0.875rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--gradient-1);
  border-color: transparent;
  color: white;
}

/* ===== 服务器列表 ===== */
.server-list-section {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 2rem;
}

.section-header {
  text-align: center;
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.title-icon {
  font-size: 1.25rem;
}

.section-desc {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

/* ===== 服务器卡片 ===== */
.server-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

.server-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 12px 40px rgba(16, 185, 129, 0.12);
}

.server-card-header {
  position: relative;
  height: 140px;
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d4a 100%);
  overflow: hidden;
}

.server-card-header img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.6;
  transition: var(--transition);
}

.server-card:hover .server-card-header img {
  opacity: 0.8;
  transform: scale(1.05);
}

.server-card-header .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg-card) 0%, transparent 100%);
}

.server-card-badges {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: flex;
  gap: 0.375rem;
}

.server-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-size: 0.6875rem;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

.badge-type {
  background: rgba(99, 102, 241, 0.9);
  color: white;
}

.badge-tag {
  background: rgba(245, 158, 11, 0.9);
  color: white;
}

.server-card-status {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 12px;
  font-size: 0.6875rem;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse 2s ease-in-out infinite;
}

.status-dot.offline {
  background: #ef4444;
  animation: none;
}

.online-info {
  color: #22c55e;
  font-weight: 500;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.server-card-body {
  padding: 1rem;
}

.server-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.375rem;
}

.server-ip {
  font-size: 0.8125rem;
  color: var(--primary);
  font-family: monospace;
  margin-bottom: 0.75rem;
}

.server-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.tag {
  padding: 0.2rem 0.5rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 4px;
  font-size: 0.6875rem;
  color: var(--primary-light);
}

.server-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.server-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.server-owner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.owner-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card-hover);
}

.owner-name {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.server-action {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  background: var(--gradient-1);
  border: none;
  border-radius: 16px;
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.server-action:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* ===== 联系弹窗 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 380px;
  width: 90%;
  text-align: center;
  transform: scale(0.9);
  transition: var(--transition);
  position: relative;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-dark);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--primary);
  color: white;
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.modal-info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.modal-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-dark);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.modal-item:hover {
  background: var(--bg-card-hover);
  transform: translateX(4px);
}

.modal-item-icon {
  font-size: 1.25rem;
}

.modal-item-content {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.modal-item-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.modal-item-value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
}

.modal-tip {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* ===== 页脚 ===== */
.footer {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 2rem;
  margin-top: 3rem;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  text-align: center;
}

.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.footer-logo {
  font-size: 1.25rem;
}

.footer-copy {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer-protocol {
  font-size: 0.6875rem;
}

.footer-protocol a {
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.footer-protocol a:hover {
  opacity: 1;
  text-decoration: underline;
}

.footer-disclaimer {
  font-size: 0.6875rem;
  color: var(--text-muted);
  opacity: 0.35;
  margin-top: 0.5rem;
  line-height: 1.5;
  text-align: center;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.empty-text {
  font-size: 1rem;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .nav-links {
    gap: 0.75rem;
  }
  
  .nav-link {
    font-size: 0.8125rem;
  }
  
  .theme-label {
    display: none;
  }
  
  .hero {
    padding: 3.5rem 1rem 0.75rem;
  }
  
  .hero-stats {
    gap: 0.75rem;
  }
  
  .stat-number {
    font-size: 1rem;
  }
  
  .stat-label {
    font-size: 0.5625rem;
  }
  
  .filter-container {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .filter-buttons {
    flex-wrap: wrap;
  }
  
  .server-grid {
    grid-template-columns: 1fr;
  }
  
  .modal-content {
    padding: 1.5rem;
  }
  
  .back-btn-fixed {
    top: 62px;
    left: 1rem;
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
  }
}
