:root {
  /* 品牌色系 */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --secondary: #64748b;
  --accent: #0ea5e9;
  
  /* 中性色 */
  --bg: #f8fafc;
  --bg-alt: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  
  /* 功能色 */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
  
  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1);
  
  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;
  
  /* 间距 */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
}

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

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-lg);
}

/* 头部样式 */
.site-header {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  padding: var(--space-xl) 0;
  position: relative;
  overflow: hidden;
}

.site-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.1;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  position: relative;
  z-index: 2;
}

.header-contact {
  font-size: 0.95rem;
  background: rgba(15, 23, 42, 0.18);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.logo-section h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
  font-weight: 400;
}

/* 导航菜单 */
.main-nav {
  display: flex;
  align-items: center;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--space-sm);
}

.nav-list {
  display: flex;
  list-style: none;
  gap: var(--space-lg);
  margin: 0;
  padding: 0;
}

.nav-link {
  color: white;
  text-decoration: none;
  font-weight: 500;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
}

/* 搜索区域 */
/* 头部统计与安全提示 */
.hero-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-xl);
  margin-top: var(--space-lg);
  position: relative;
  z-index: 2;
}

.hero-left {
  max-width: 480px;
}

.hero-tagline {
  font-size: 1rem;
  margin-bottom: var(--space-sm);
  opacity: 0.95;
}

.hero-security {
  font-size: 0.95rem;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.4);
  display: inline-flex;
  align-items: center;
}

.hero-right {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-md);
}

.stat {
  text-align: center;
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.22);
  color: white;
  min-width: 140px;
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* 分类标签 */
.category-tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.category-tab {
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.category-tab:hover,
.category-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* 结果区域 */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.results-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
}

.results-count {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* 模板网格 */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-xl);
  margin-bottom: var(--space-2xl);
}

.template-card {
  background: var(--bg-alt);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  position: relative;
}

.template-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.template-preview {
  height: 260px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  transform-origin: center;
}

.template-preview:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.template-preview-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
}

.template-preview::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.template-preview:hover::before {
  opacity: 1;
}

.preview-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: var(--space-md);
  background: linear-gradient(to top, rgba(15, 23, 42, 0.75), transparent);
  display: flex;
  align-items: flex-end;
  pointer-events: none;
}

.preview-label {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 0.8rem;
  font-weight: 500;
}

/* 模板预览弹窗 */
.preview-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.preview-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
}

.preview-modal-content {
  position: relative;
  width: 90%;
  max-width: 1200px;
  height: 80vh;
  background: var(--bg-alt);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.preview-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  border: none;
  background: rgba(15, 23, 42, 0.6);
  color: #fff;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-modal-body {
  flex: 1;
  margin-top: 0;
  height: 100%;
}

.preview-modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.preview-modal-footer {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  background: var(--bg-alt);
  max-width: 300px;
  margin: auto;
}

.template-content {
  padding: var(--space-lg);
}

.template-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text);
}

.template-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--space-md);
  line-height: 1.5;
}

.template-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}

.tag {
  padding: var(--space-xs) var(--space-sm);
  background: var(--primary-light);
  color: white;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
}

.template-actions {
  display: flex;
  gap: var(--space-sm);
}

.btn {
  flex: 1;
  height: 40px;
  padding: 0 var(--space-md);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: var(--primary);
  color: white;
}

/* 无结果状态 */
.no-results {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.no-results-content h3 {
  font-size: 1.5rem;
  margin-bottom: var(--space-md);
  color: var(--text-light);
}

/* 页脚 */
.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: var(--space-2xl) 0;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-2xl);
  margin-bottom: var(--space-xl);
}

.footer-section h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--text);
}

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

.footer-section li {
  margin-bottom: var(--space-xs);
}

.footer-section a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-section a:hover {
  color: var(--primary);
}

.footer-bottom {
  text-align: center;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: var(--space-lg);
    text-align: center;
  }
  
  .logo-section h1 {
    font-size: 2rem;
  }
  
  .nav-toggle {
    display: block;
  }
  
  .nav-list {
    display: none;
    flex-direction: column;
    gap: var(--space-sm);
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--primary-dark);
    padding: var(--space-md);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }
  
  .nav-list.show {
    display: flex;
  }
  
  .search-box {
    flex-direction: column;
  }
  
  .filter-controls {
    flex-direction: column;
  }
  
  .stats-bar {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  .template-grid {
    grid-template-columns: 1fr;
  }
  
  .results-header {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: var(--space-md);
  }
  
  .template-actions {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
  }
}

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

.template-card {
  animation: fadeIn 0.6s ease;
}

/* 实用类 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.loading {
  opacity: 0.6;
  pointer-events: none;
}
