/* Homepage Ultimate UI Design - 明暗主题兼容 */

/* 全局重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* 亮色主题 */
  --primary: #6366f1;
  --secondary: #8b5cf6;
  --accent: #ec4899;
  --success: #10b981;
  
  --bg-light: #f8fafc;
  --bg-card-light: #ffffff;
  --bg-card-hover-light: #f1f5f9;
  --text-light: #1e293b;
  --text-secondary-light: #64748b;
  --border-light: #e2e8f0;
  
  /* 暗色主题 */
  --bg-dark: #0a0a0f;
  --bg-card-dark: #12121a;
  --bg-card-hover-dark: #1a1a25;
  --text-dark: #ffffff;
  --text-secondary-dark: #a0a0b0;
  --border-dark: rgba(255, 255, 255, 0.1);
  
  /* 默认暗色 */
  --bg: var(--bg-dark);
  --bg-card: var(--bg-card-dark);
  --bg-card-hover: var(--bg-card-hover-dark);
  --text: var(--text-dark);
  --text-secondary: var(--text-secondary-dark);
  --border: var(--border-dark);
  
  --glass: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-glow: rgba(99, 102, 241, 0.3);
  
  --gradient-hero: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --gradient-glow: linear-gradient(180deg, rgba(99, 102, 241, 0.3) 0%, transparent 100%);
}

/* 亮色主题类 */
[data-theme="light"], .theme-light {
  --bg: var(--bg-light);
  --bg-card: var(--bg-card-light);
  --bg-card-hover: var(--bg-card-hover-light);
  --text: var(--text-light);
  --text-secondary: var(--text-secondary-light);
  --border: var(--border-light);
  --glass: rgba(0, 0, 0, 0.03);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-glow: rgba(99, 102, 241, 0.4);
}

/* 动态背景 */
body {
  background: var(--bg);
  background-image: 
    radial-gradient(ellipse at 10% 10%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(ellipse at 90% 90%, rgba(139, 92, 246, 0.12) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 50%, rgba(236, 72, 153, 0.06) 0%, transparent 50%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text);
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* 亮色主题背景 */
[data-theme="light"] body, body.theme-light {
  background: #f8fafc;
  background-image: 
    radial-gradient(ellipse at 10% 10%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(ellipse at 90% 90%, rgba(139, 92, 246, 0.08) 0%, transparent 40%);
}

/* 背景网格 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

[data-theme="light"] body::before {
  background-image: 
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
}

/* 浮动光球 */
body::after {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.08) 0%, transparent 30%),
    radial-gradient(circle at 70% 70%, rgba(139, 92, 236, 0.08) 0%, transparent 30%);
  animation: float 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.3s ease;
}

[data-theme="light"] body::after {
  opacity: 0.7;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(30px, -30px) rotate(120deg); }
  66% { transform: translate(-20px, 20px) rotate(240deg); }
}

[data-theme="light"] body::after {
  background: 
    radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.05) 0%, transparent 30%),
    radial-gradient(circle at 70% 70%, rgba(139, 92, 236, 0.05) 0%, transparent 30%);
}

/* 主容器 */
#container, .container {
  position: relative;
  z-index: 1;
  max-width: 1600px;
  margin: 0 auto;
  padding: 30px 20px;
}

/* 标题 */
h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-title {
  text-align: center;
  margin-bottom: 40px;
}

.page-title h1 {
  font-size: clamp(32px, 5vw, 56px);
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  animation: shimmer 3s ease-in-out infinite;
  background-size: 200% 200%;
}

[data-theme="light"] .page-title h1, .theme-light .page-title h1 {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.page-title .subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* 搜索框 */
.search {
  max-width: 700px;
  margin: 0 auto 50px;
  position: relative;
}

.search form, .search-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 6px 6px 6px 24px;
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  transition: all 0.3s ease;
}

[data-theme="light"] .search form, .theme-light .search form {
  background: white;
  border-color: var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.search form:hover, .search-container:hover {
  border-color: var(--glass-glow);
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.15);
}

.search input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 18px;
  padding: 12px;
  outline: none;
  transition: color 0.3s ease;
}

[data-theme="light"] .search input {
  color: var(--text);
}

.search input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.search button, .search button[type="submit"] {
  background: var(--gradient-hero);
  border: none;
  border-radius: 16px;
  padding: 14px 28px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search button:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

/* 小组件 */
.widgets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px;
  margin-bottom: 40px;
}

.widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

[data-theme="light"] .widget, .theme-light .widget {
  background: white;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.widget::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-hero);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
}

.widget:hover {
  transform: translateY(-8px);
  border-color: var(--glass-glow);
  box-shadow: 0 20px 60px rgba(99, 102, 241, 0.2);
  z-index: 10;
}

.widget:hover::before {
  opacity: 1;
}

/* 资源监控 */
.resources {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
}

.resource {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 20px 28px;
  min-width: 140px;
  text-align: center;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  z-index: 1;
}

[data-theme="light"] .resource, .theme-light .resource {
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.resource:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  z-index: 10;
}

.resource .label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.resource .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.resource.cpu .value { color: #6366f1; }
.resource.memory .value { color: #8b5cf6; }
.resource.disk .value { color: #ec4899; }

/* 服务网格 */
.services {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.section-title {
  font-size: 14px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 16px;
  padding-left: 4px;
}

/* 服务卡片 - 修复z-index */
.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 20px;
  text-decoration: none;
  color: var(--text);
  text-align: center;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

[data-theme="light"] .service-card, .theme-light .service-card {
  background: white;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255, 0.15), transparent);
  transition: left 0.5s ease;
  z-index: 2;
  pointer-events: none;
}

[data-theme="light"] .service-card::before {
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
}

.service-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: var(--primary);
  box-shadow: 
    0 20px 60px rgba(99, 102, 241, 0.25),
    0 0 40px rgba(99, 102, 241, 0.15);
  z-index: 10;
}

.service-card:hover::before {
  left: 100%;
}

/* 图标文字 - 直接显示 */
.service-card .icon {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
  line-height: 1;
}

.service-card .title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
  transition: color 0.3s ease;
}

[data-theme="light"] .service-card .title {
  color: var(--text);
}

.service-card .description {
  font-size: 12px;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

/* 状态指示 */
.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 6px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.9); }
}

/* 书签 */
.bookmarks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.bookmarks a {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  text-align: center;
  transition: all 0.3s ease;
  z-index: 1;
}

[data-theme="light"] .bookmarks a {
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.bookmarks a:hover {
  background: var(--bg-card-hover);
  color: var(--text);
  border-color: var(--primary);
  transform: translateY(-4px);
  z-index: 10;
}

/* 响应式 */
@media (max-width: 1200px) {
  .services { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
  .services { grid-template-columns: repeat(3, 1fr); }
  .widgets { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  #container, .container { padding: 20px 12px; }
  
  .services {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .service-card {
    padding: 20px 16px;
    border-radius: 14px;
  }
  
  .service-card .icon { font-size: 28px; }
  .service-card .title { font-size: 14px; }
  
  .search form {
    padding: 4px 4px 4px 16px;
    border-radius: 18px;
  }
  
  .search input { font-size: 15px; padding: 10px; }
  .search button { padding: 12px 20px; border-radius: 14px; }
  
  .widgets { grid-template-columns: 1fr; }
  .resources { gap: 12px; }
  .resource { padding: 16px 20px; min-width: 100px; }
  .resource .value { font-size: 22px; }
  
  .page-title { margin-bottom: 30px; }
  .page-title h1 { font-size: 28px; }
}

@media (max-width: 400px) {
  .services { grid-template-columns: 1fr 1fr; }
  .bookmarks { grid-template-columns: 1fr 1fr; }
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--gradient-hero);
  border-radius: 4px;
}

/* 动画 */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.services .service-card {
  opacity: 0;
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* 链接样式 */
.services a, .bookmarks a {
  text-decoration: none !important;
}

.services a:hover .title,
.bookmarks a:hover {
  color: var(--text);
}

[data-theme="light"] .services a:hover .title,
[data-theme="light"] .bookmarks a:hover {
  color: var(--text);
}

/* 图标容器 */
.icon-container {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
  border-radius: 14px;
  font-size: 24px;
}

[data-theme="light"] .icon-container {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 236, 0.1));
}

/* 分组容器 */
.group-container {
  margin-bottom: 40px;
}