/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, html {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
  font-size: 16px;
}

/* 容器样式 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 头部样式 */
header {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: white;
  padding: 40px 20px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23ffffff' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
}

.header-content {
  position: relative;
  z-index: 1;
  margin-bottom: 20px;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 8px;
  font-weight: 700;
}

.subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 20px;
}

/* 搜索和筛选容器 */
.search-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.search-box {
  padding: 12px 20px;
  width: 100%;
  max-width: 400px;
  font-size: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 25px;
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  backdrop-filter: blur(5px);
  transition: all 0.3s ease;
}

.search-box::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.search-box:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.8);
  background-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.filter-select {
  padding: 12px 20px;
  font-size: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 25px;
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  backdrop-filter: blur(5px);
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.8);
  background-color: rgba(255, 255, 255, 0.2);
}

.filter-select option {
  background-color: #3b82f6;
  color: white;
}

/* 统计卡片样式 */
.stats-container {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: -30px auto 40px;
  padding: 0 20px;
  position: relative;
  z-index: 2;
  flex-wrap: wrap;
}

.stat-card {
  background: white;
  padding: 20px 30px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  text-align: center;
  flex: 1;
  min-width: 150px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 0.9rem;
  color: #666;
  font-weight: 500;
}

/* 脚本卡片网格 */
.script-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  padding: 0 20px 40px;
}

/* 脚本卡片样式 */
.script-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.script-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.script-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
}

.card-header {
  padding: 20px 20px 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}

.card-icon-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background-color: #f0f9ff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3b82f6;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
  flex: 1;
}

.card-body {
  padding: 15px 20px;
}

.card-description {
  font-size: 0.95rem;
  color: #6b7280;
  margin-bottom: 15px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  gap: 15px;
  font-size: 0.85rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #9ca3af;
}

.card-footer {
  padding: 15px 20px;
  display: flex;
  gap: 10px;
  border-top: 1px solid #f0f0f0;
}

.detail-link {
  flex: 1;
  padding: 8px 16px;
  text-align: center;
  border: 1px solid #3b82f6;
  border-radius: 6px;
  color: #3b82f6;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.detail-link:hover {
  background-color: #3b82f6;
  color: white;
}

.download-link {
  flex: 1;
  padding: 8px 16px;
  text-align: center;
  background-color: #3b82f6;
  border-radius: 6px;
  color: white;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.download-link:hover {
  background-color: #2563eb;
  transform: translateY(-1px);
}

/* 详情页样式 */
.detail-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  margin: 20px;
  overflow: hidden;
}

/* 脚本头部 */
.script-header {
  padding: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  border-bottom: 1px solid #f0f0f0;
}

.script-header-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
}

.script-icon {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  object-fit: cover;
}

.script-icon-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  background-color: #f0f9ff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3b82f6;
}

.script-info h2 {
  font-size: 1.8rem;
  color: #1f2937;
  margin-bottom: 10px;
}

.script-description {
  font-size: 1rem;
  color: #6b7280;
  line-height: 1.6;
  max-width: 600px;
}

.script-actions {
  display: flex;
  gap: 15px;
}

.download-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background-color: #3b82f6;
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
}

.download-button:hover {
  background-color: #2563eb;
  transform: translateY(-1px);
}

/* 元数据部分 */
.metadata-section {
  padding: 30px;
  border-bottom: 1px solid #f0f0f0;
}

.metadata-section h3 {
  font-size: 1.3rem;
  color: #1f2937;
  margin-bottom: 20px;
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.metadata-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.metadata-label {
  font-size: 0.9rem;
  color: #9ca3af;
  font-weight: 500;
}

.metadata-value {
  font-size: 1rem;
  color: #374151;
  font-weight: 500;
}

.break-all {
  word-break: break-all;
}

/* 代码部分 */
.code-section {
  padding: 30px;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.code-header h3 {
  font-size: 1.3rem;
  color: #1f2937;
}

.copy-button {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  background-color: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  color: #374151;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.copy-button:hover {
  background-color: #e5e7eb;
}

.copy-button.copied {
  background-color: #10b981;
  color: white;
  border-color: #10b981;
}

.code-block {
  margin: 0;
  border-radius: 8px;
  overflow: hidden;
  max-height: 600px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.code-block code {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* 页脚样式 */
.footer {
  background: white;
  padding: 30px 20px;
  text-align: center;
  border-top: 1px solid #f0f0f0;
  margin-top: auto;
}

.footer p {
  color: #6b7280;
  font-size: 0.9rem;
}

/* 返回按钮样式 */
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  background-color: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.back-button:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .script-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (max-width: 768px) {
  header {
    padding: 30px 15px;
  }
  
  header h1 {
    font-size: 2rem;
  }
  
  .stats-container {
    flex-direction: column;
    align-items: center;
    margin-top: -20px;
  }
  
  .stat-card {
    width: 100%;
    max-width: 300px;
  }
  
  .script-grid {
    grid-template-columns: 1fr;
    padding: 0 15px 30px;
    gap: 20px;
  }
  
  .script-header {
    padding: 20px;
    flex-direction: column;
    align-items: flex-start;
  }
  
  .script-header-left {
    width: 100%;
  }
  
  .script-icon,
  .script-icon-placeholder {
    width: 60px;
    height: 60px;
  }
  
  .script-info h2 {
    font-size: 1.5rem;
  }
  
  .metadata-section,
  .code-section {
    padding: 20px;
  }
  
  .metadata-grid {
    grid-template-columns: 1fr;
  }
  
  .code-block {
    max-height: 400px;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.8rem;
  }
  
  .search-container {
    flex-direction: column;
  }
  
  .search-box,
  .filter-select {
    width: 100%;
  }
  
  .script-card {
    margin: 0;
  }
  
  .detail-content {
    margin: 10px;
    border-radius: 8px;
  }
}

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

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}