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

:root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  font-weight: 400;
  
  /* 颜色主题 */
  --primary-color: #2c5282;
  --secondary-color: #3182ce;
  --accent-color: #38b2ac;
  --text-primary: #2d3748;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --background-primary: #ffffff;
  --background-secondary: #f7fafc;
  --background-accent: #edf2f7;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-primary);
  background-color: var(--background-primary);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h3 {
  font-size: 1.25rem;
}

/* ===== 应用布局 ===== */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
}

/* ===== 导航栏样式 ===== */
.main-navigation {
  background-color: var(--background-primary);
  border-bottom: 2px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  /* max-width: 1200px; */
  /* margin: 0 auto; */
  width: 100%;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand {
  display: flex;
  align-items: center;
}

.nav-brand-link {
  text-decoration: none;
  color: var(--primary-color);
  font-weight: 700;
  font-size: 1.5rem;
  transition: color 0.2s ease;
}

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

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

.nav-link {
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 500;
  padding: 0.75rem 1.25rem;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  position: relative;
}

.nav-link:hover {
  color: var(--primary-color);
  background-color: var(--background-secondary);
}

.nav-link.active {
  color: var(--primary-color);
  background-color: var(--background-accent);
  font-weight: 600;
}

/* ===== 页面容器 ===== */
.page-container {
  max-width: 1800px;
  margin: 0 auto;
  padding: 2rem 1rem;
  width: 95%;
}

@media (max-width: 1400px) {
  .page-container {
    max-width: 1200px;
  }
}

@media (max-width: 768px) {
  .page-container {
    padding: 1rem 0.5rem;
  }
}

.page-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-light);
}

.page-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.page-description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 800px;
  margin: 0 auto;
}

.page-content {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.section {
  background-color: var(--background-primary);
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.section h2 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
}

.section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

/* ===== 主页样式 ===== */
.homepage {
  padding: 0;
}

.hero-section {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  padding: 4rem 2rem;
  text-align: center;
  margin-bottom: 4rem;
}

.hero-content {
  max-width: 900px;
  margin: 0 auto;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero-subtitle {
  font-size: 1.75rem;
  font-weight: 400;
  margin-bottom: 2rem;
  opacity: 0.95;
}

.hero-description {
  font-size: 1.1rem;
  line-height: 1.7;
  opacity: 0.9;
  max-width: 700px;
  margin: 0 auto;
}

.features-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.feature-card {
  background-color: var(--background-primary);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  overflow: hidden;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.feature-link {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 2rem;
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  display: block;
}

.feature-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.feature-description {
  color: var(--text-secondary);
  line-height: 1.6;
}

.info-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 1rem;
  background-color: var(--background-secondary);
  border-radius: 1rem;
}

.info-content {
  text-align: center;
}

.info-content h3 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
}

.info-content p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 800px;
  margin: 0 auto 3rem;
}

.statistics {
  display: flex;
  justify-content: center;
  gap: 4rem;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.citation-section {
  max-width: 1200px;
  margin: 4rem auto 0;
  padding: 0 1rem;
}

.citation-section h3 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  text-align: center;
}

.citation-box {
  background-color: var(--background-accent);
  padding: 2rem;
  border-radius: 0.75rem;
  border-left: 4px solid var(--primary-color);
  text-align: center;
}

.citation-box p {
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.copy-citation-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.copy-citation-btn:hover {
  background-color: var(--secondary-color);
}

/* ===== 基因查看页面样式 ===== */
.gene-view-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.gene-view-container h2 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  text-align: center;
  margin-bottom: 3rem;
}

.stage-selector, .gene-selector {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background-color: var(--background-secondary);
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
}

.stage-selector label, .gene-label {
  font-weight: 600;
  color: var(--text-primary);
  margin-right: 1rem;
}

.gene-select, .stage-selector select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background-color: white;
  color: var(--text-primary);
  font-size: 1rem;
  margin-right: 1rem;
  min-width: 200px;
}

.gene-select:focus, .stage-selector select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
}

button:hover:not(:disabled) {
  background-color: var(--secondary-color);
  transform: translateY(-1px);
}

button:disabled {
  background-color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

.error-message {
  color: #e53e3e;
  background-color: #fed7d7;
  padding: 1rem;
  border-radius: 0.5rem;
  border-left: 4px solid #e53e3e;
  margin-bottom: 1.5rem;
}

.visualization-container {
  width: 100%;
  height: 550px;
  min-width: 400px;
  border: 2px solid var(--border-color);
  border-radius: 0.75rem;
  position: relative;
  background-color: var(--background-secondary);
  overflow: hidden;
}

.point-cloud-visualization-container {
  width: 100%;
  height: calc(100% - 1.5rem);
  min-width: 400px;
  position: relative;
  background-color: var(--background-secondary);
  overflow: hidden;
}

.no-data-message {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ===== 点云组件样式 ===== */
.point-cloud-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.point-cloud-legend {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.95);
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  max-width: 200px;
  max-height: 400px;
  overflow-y: auto;
}

/* ===== 新的图例样式 ===== */
.legend-container {
  width: 100%;
}

.legend-container .legend-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.5rem;
  font-size: 1.1rem;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.legend-item {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border-radius: 0.375rem;
  background-color: white;
  border: 1px solid var(--border-light);
  transition: all 0.2s ease;
}

.legend-item:hover {
  background-color: var(--background-accent);
  transform: translateX(2px);
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin-right: 0.75rem;
  border: 2px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.legend-label {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
  font-weight: 500;
}

.legend-gradient-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.legend-gradient {
  background: linear-gradient(to top, 
    hsla(180, 100%, 50%, 1.00), 
    hsla(72, 100%, 50%, 1.00), 
    hsla(0, 100%, 50%, 0.99));
  width: 30px;
  height: 120px;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== 原有图例样式（保持兼容性） ===== */
.point-cloud-legend .legend-gradient {
  background: linear-gradient(to top, 
    hsla(180, 100%, 50%, 1.00), 
    hsla(72, 100%, 50%, 1.00), 
    hsla(0, 100%, 50%, 0.99));
  width: 20px;
  height: 100px;
  border-radius: 2px;
  margin-bottom: 0.5rem;
}

.point-cloud-legend .legend-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.5rem;
}

.point-cloud-legend .legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  padding: 0.25rem 0;
}

.point-cloud-legend .legend-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.point-cloud-legend .legend-label {
  font-size: 0.8rem;
  color: var(--text-primary);
  line-height: 1.2;
  word-break: break-word;
}

/* ===== 其他页面样式 ===== */
.clustering-features, .resource-grid, .software-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.cluster-card, .resource-card, .software-card {
  background-color: var(--background-secondary);
  padding: 2rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.cluster-card:hover, .resource-card:hover, .software-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.cluster-card h3, .resource-card h3, .software-card h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.interactive-notice {
  background-color: var(--background-accent);
  padding: 2rem;
  border-radius: 0.75rem;
  border-left: 4px solid var(--accent-color);
  margin-top: 2rem;
}

.interactive-notice p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.interactive-notice ul {
  margin-left: 1.5rem;
  color: var(--text-secondary);
}

.software-links {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.software-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border: 1px solid var(--primary-color);
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.software-link:hover {
  background-color: var(--primary-color);
  color: white;
}

.support-info {
  background-color: var(--background-secondary);
  padding: 2rem;
  border-radius: 0.75rem;
  margin-top: 2rem;
}

.support-info ul {
  margin-left: 1.5rem;
  margin-top: 1rem;
}

/* ===== 下载页面样式 ===== */
.download-notice {
  background-color: var(--background-secondary);
  padding: 2rem;
  border-radius: 0.75rem;
  border-left: 4px solid var(--accent-color);
  margin-bottom: 3rem;
}

.download-notice h2 {
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.download-notice ul {
  margin-left: 1.5rem;
  margin-top: 1rem;
}

.downloads-section {
  margin-bottom: 4rem;
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.download-card {
  background-color: var(--background-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.download-card h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.download-description {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.download-files {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.download-file {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background-color: var(--background-secondary);
  border-radius: 0.5rem;
  border: 1px solid var(--border-light);
}

.file-info {
  display: flex;
  flex-direction: column;
}

.file-name {
  font-weight: 600;
  color: var(--text-primary);
}

.file-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.download-btn {
  background-color: var(--accent-color);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.download-btn:hover {
  background-color: #2c7a7b;
}

.bulk-download {
  background-color: var(--background-secondary);
  padding: 2rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
}

.bulk-download h2 {
  color: var(--primary-color);
  margin-bottom: 2rem;
}

.bulk-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.bulk-option {
  background-color: var(--background-primary);
  padding: 2rem;
  border-radius: 0.75rem;
  text-align: center;
  border: 1px solid var(--border-color);
}

.bulk-option h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.bulk-option p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.bulk-download-btn {
  background-color: var(--secondary-color);
  padding: 0.75rem 2rem;
  font-size: 1rem;
}

.bulk-download-btn:hover {
  background-color: var(--primary-color);
}

/* ===== 查询控制器样式 ===== */
.query-controls {
  padding: 1.5rem;
  background-color: var(--background-accent);
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
}

.query-controls label {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.query-controls select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  background-color: var(--background-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  min-width: 200px;
  margin-left: 0.5rem;
}

.query-controls select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

.query-controls button {
  padding: 0.5rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.query-controls button:hover:not(:disabled) {
  background-color: var(--secondary-color);
}

.query-controls button:disabled {
  background-color: var(--text-muted);
  cursor: not-allowed;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
  .nav-container {
    padding: 0 0.5rem;
    flex-direction: column;
    height: auto;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
  
  .nav-links {
    margin-top: 1rem;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.5rem;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
  }
  
  .statistics {
    gap: 2rem;
  }
  
  .download-grid {
    grid-template-columns: 1fr;
  }
  
  .bulk-options {
    grid-template-columns: 1fr;
  }
  
  .clustering-features, .resource-grid, .software-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .query-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem !important;
  }
  
  .query-controls select {
    min-width: auto;
    width: 100%;
    margin-left: 0;
    margin-top: 0.5rem;
  }
  
  .query-controls button {
    margin-top: 0.5rem;
  }
}

/* ===== 响应式网格布局 ===== */
@media (max-width: 1200px) {
  .three-column-grid {
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: auto auto auto;
  }
  
  .three-column-grid > div:first-child {
    grid-column: 1 / -1;
  }
  
  .visualization-container {
    min-width: 350px;
  }
}

@media (max-width: 768px) {
  .three-column-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
  
  .visualization-container {
    height: 450px;
    min-width: auto;
  }
}

/* ===== 扁平化标题样式 ===== */
.flat-section-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 1rem;
  margin-top: 1rem;
}

.flat-section-description {
  margin-bottom: 2rem;
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.6;
}

.visualization-grid {
  margin-bottom: 3rem;
}
