/* Reset & Variables from React App */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg-body: #f3f4f6;
  --bg-card: #ffffff;
  --text-main: #111827;
  --text-sub: #6b7280;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --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);
}

* { box-sizing: border-box; outline: none; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.header {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  background-color: rgba(255, 255, 255, 0.9);
}

.header-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-box {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.3);
  color: white;
}

.brand-text h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.badge {
  font-size: 0.75rem;
  background: #eff6ff;
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  font-weight: 600;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-links a {
  color: var(--text-sub);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
  font-weight: 500;
}

.nav-links a:hover { color: var(--primary); }

/* Hero */
.hero {
  text-align: center;
  padding: 60px 20px 40px;
}

.hero h2 {
  font-size: 2.2rem;
  font-weight: 800;
  margin: 0 0 16px;
  background: linear-gradient(135deg, #111827 0%, #4b5563 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #111827; /* Fallback */
}

.hero p {
  color: var(--text-sub);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Controls Section */
.controls-section {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  margin: 0 auto 40px;
  max-width: 900px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.5);
}

.controls-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  gap: 24px;
}

/* Search */
.search-group {
  flex: 1;
  min-width: 250px;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}

.search-input-wrapper input {
  width: 100%;
  padding: 11px 12px 11px 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--text-main);
  transition: all 0.2s;
}

.search-input-wrapper input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-sub);
  pointer-events: none;
  display: flex;
}

.filters-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.control-group {
  display: flex;
  align-items: center; /* 改为横向对齐 */
  gap: 12px;
}

.control-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

.control-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
}

/* Custom Select */
.select-wrapper {
  position: relative;
  min-width: 200px;
}

.select-wrapper select {
  appearance: none;
  width: 100%;
  padding: 10px 36px 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 0.95rem;
  color: var(--text-main);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.select-wrapper select:hover { border-color: #cbd5e1; }
.select-wrapper select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.select-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-sub);
  display: flex;
}

/* Toggle Switch */
.toggle-switch {
  display: flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 4px;
  position: relative;
  cursor: pointer;
  user-select: none;
  width: 200px;
  height: 42px;
}

.toggle-option {
  flex: 1;
  text-align: center;
  z-index: 2;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-sub);
  transition: color 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-switch.active .toggle-option:nth-child(2) { color: var(--primary); font-weight: 600; }
.toggle-switch:not(.active) .toggle-option:nth-child(1) { color: var(--text-main); font-weight: 600; }

.toggle-handle {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.toggle-switch.active .toggle-handle { transform: translateX(100%); }

/* Grid */
.versions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 24px;
  padding-bottom: 20px;
  align-items: start; /* Prevent cards from stretching to match height */
}

/* Version Card */
.version-card {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid rgba(229, 231, 235, 0.5);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.version-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(37, 99, 235, 0.1);
}

.card-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  cursor: pointer; /* Added for clickable expansion */
}

.channel-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.version-number {
  font-family: 'SF Mono', 'Menlo', monospace;
  color: var(--text-sub);
  font-size: 0.9rem;
  background: #f9fafb;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #f3f4f6;
}

.card-content {
  padding: 0; /* Reset */
  background: #fff;
  flex-grow: 1;
}

/* Download Rows */
.download-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  text-decoration: none;
  color: var(--text-main);
  transition: background 0.15s;
  border-bottom: 1px solid #f3f4f6;
}

.download-row:last-child { border-bottom: none; }
.download-row:hover { background: #f8fafc; }

.platform-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.platform-icon-box {
  color: var(--text-sub);
  display: flex;
}

.download-row:hover .platform-icon-box { color: var(--text-main); }

.platform-name {
  font-size: 0.95rem;
  font-weight: 500;
}

.download-action {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.download-row:hover .download-action { opacity: 1; }

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--text-sub);
  font-size: 0.9rem;
}

/* Loading & Error */
.status-msg {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-sub);
  font-size: 1.1rem;
}

/* Footer */
.footer-section {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 40px 0;
  text-align: center;
  margin-top: 40px;
}

.footer-content p {
  margin: 6px 0;
  font-size: 0.9rem;
  color: var(--text-main);
}

.footer-sub {
  color: var(--text-sub) !important;
  font-size: 0.8rem !important;
}

/* Mobile Responsive */
@media (max-width: 800px) {
  .controls-inner {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }
  
  .mobile-hidden { display: none; }
  .filters-group { flex-direction: column; width: 100%; }
  .control-group { width: 100%; }
  .select-wrapper, .toggle-switch { width: 100%; }
  
  .hero h2 { font-size: 1.8rem; }
}

/* --- Added Styles for History List & Legacy Compatibility --- */

.history-section {
  margin-top: 40px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pagination {
  margin-top: 30px;
  text-align: center;
}

.btn-outline {
  background: white;
  border: 1px solid var(--border);
  padding: 12px 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-main);
  font-weight: 500;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-md);
}

/* Helper classes for JS */
.hidden { display: none !important; }

/* File list inside version card */
.version-content {
    display: none;
    border-top: 1px solid var(--border);
}

.version-card.expanded .version-content {
    display: block;
}

/* Guide Steps (Tutorial) */
.guide-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.step {
  background: var(--bg-card);
  padding: 24px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.step:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.step-num {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-bottom: 16px;
  font-size: 1rem;
}

.step h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: var(--text-main);
}

.step p {
  color: var(--text-sub);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 12px;
}

.small-tip {
  margin-top: 12px;
  font-size: 0.85rem !important;
  color: #1e40af !important; /* Blue-800 */
  background: #eff6ff; /* Blue-50 */
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #dbeafe;
}

.code-block {
  margin-top: 12px;
  background: #1f2937; /* Gray-800 */
  color: #e5e7eb; /* Gray-200 */
  padding: 12px;
  border-radius: 8px;
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

.code-block code {
  color: #60a5fa; /* Blue-400 */
}

/* FAQ Section */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.faq-item {
  background: var(--bg-card);
  padding: 20px 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.faq-item h3 {
  font-size: 1rem;
  color: var(--text-main);
  margin: 0 0 8px;
  display: flex;
  align-items: flex-start;
  font-weight: 600;
}

.faq-item h3::before {
  content: "Q";
  background: #eff6ff;
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 12px;
  font-size: 0.85rem;
  font-weight: 700;
}

.faq-item p {
  color: var(--text-sub);
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  padding-left: 38px; /* Align with text */
}

/* Loading spinner */
.loading-spinner {
    border: 3px solid rgba(37, 99, 235, 0.1);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border-left-color: var(--primary);
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.v-toggle {
    transition: transform 0.3s;
}
.version-card.expanded .v-toggle {
    transform: rotate(180deg);
}

/* --- Channel Cards (Latest Versions) --- */
.channel-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.channel-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.channel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.channel-icon {
    opacity: 0.8;
}

.channel-version {
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    word-break: break-all;
}

.channel-actions {
    margin-top: auto; /* Push to bottom */
}

.btn-download {
    display: inline-block;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    width: auto;
}

.btn-download:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f8fafc;
}

