/* ═══════════════════════════════════════════════════════════════════
   CF-Sub — 暗色主题样式 (Redesign)
   ═══════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;
  --bg: #0b1220;
  --card: rgba(15, 23, 42, 0.86);
  --line: rgba(148, 163, 184, 0.18);
  --text: #e5eefc;
  --muted: #9fb0cb;
  --accent: #60a5fa;
  --accent-2: #34d399;
  --warning: #f59e0b;
  --danger: #f87171;
  --shadow: 0 18px 60px rgba(2, 6, 23, 0.38);
  
  --font-sans: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Fira Code', 'Cascadia Code', monospace;
  
  --bg-gradient: radial-gradient(circle at 0% 0%, #1e293b 0%, #0f172a 100%);
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(255, 255, 255, 0.08);
  --input-bg: rgba(15, 23, 42, 0.6);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html.light {
  color-scheme: light;
  --bg: #f8fafc;
  --card: rgba(255, 255, 255, 0.9);
  --line: rgba(148, 163, 184, 0.12);
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-2: #10b981;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.06);
  
  --bg-gradient: radial-gradient(circle at top right, #f1f5f9 0%, #e2e8f0 100%);
  --card-bg: rgba(255, 255, 255, 0.8);
  --card-border: rgba(0, 0, 0, 0.06);
  --input-bg: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text);
  background: 
    radial-gradient(circle at top right, rgba(52, 211, 153, 0.12), transparent 30%),
    radial-gradient(circle at top left, rgba(96, 165, 250, 0.18), transparent 26%),
    var(--bg-gradient);
  line-height: 1.5;
  transition: var(--transition);
  background-color: var(--bg);
}

.controls {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 12px;
  z-index: 100;
}

.control-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow);
  padding: 0;
}

.control-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.control-btn svg {
  width: 20px;
  height: 20px;
}

.lang-btn {
  width: auto;
  padding: 0 12px;
  font-size: 0.85rem;
  font-weight: 700;
}

code {
  font-family: var(--font-mono);
  background: rgba(96, 165, 250, 0.1);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.9em;
}

a { color: var(--accent); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }

/* ── Layout ─────────────────────────────────────────────────────── */

.container {
  width: min(1000px, calc(100% - 40px));
  margin: 20px auto 80px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.grid { display: grid; gap: 24px; }
.two-col { grid-template-columns: 1fr 1fr; }
.three-col { grid-template-columns: 1.5fr 1fr 0.8fr; }
.two-col-75-25 { grid-template-columns: 2.8fr 1.2fr; }

.side-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: space-between;
}

.hidden { display: none !important; }

/* ── Hero ───────────────────────────────────────────────────────── */

.hero {
  text-align: center;
  padding: 48px 24px;
  background: transparent;
  border: none;
  box-shadow: none;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero.compact {
  padding: 24px 24px 16px;
  margin-bottom: 12px;
  flex-direction: row;
  justify-content: space-between;
  text-align: left;
  align-items: center;
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero-title {
  font-size: 2.5rem; /* Slightly smaller for compact */
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #60a5fa 0%, #34d399 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero.compact .hero-title {
  font-size: 2.2rem;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-badge-group {
  display: flex;
  gap: 6px;
}

.badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--muted);
  font-weight: 600;
}

.hero.compact .lead {
  font-size: 1rem;
  margin: 0;
  max-width: none;
}

.hero-info {
  background: rgba(255, 255, 255, 0.03);
  padding: 16px 20px;
  border-radius: 16px;
  border: 1px solid var(--card-border);
  max-width: 320px;
}

.tiny-text {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.hero-logo {
  width: 44px;
  height: 44px;
  filter: drop-shadow(0 0 10px rgba(96, 165, 250, 0.4));
  -webkit-text-fill-color: initial;
}

.lead {
  font-size: 1.25rem;
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Main Form ──────────────────────────────────────────────────── */

.main-form {
  overflow: hidden;
  border-radius: 28px;
}

.form-section {
  padding: 40px;
}

.primary-input {
  background: rgba(255, 255, 255, 0.015);
  border-bottom: 1px solid var(--card-border);
}

.secondary-options {
  padding: 32px 40px 12px;
}

label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  color: #cbd5e1;
}

textarea,
input[type="text"] {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--input-bg);
  color: var(--text);
  padding: 16px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: var(--font-sans);
}

textarea#nodeLinks {
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

textarea:focus,
input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
}

.hint {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 10px;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
}

.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.checkbox-wrap input {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  cursor: pointer;
}

.form-actions {
  padding: 12px 40px 40px;
  display: flex;
  gap: 16px;
}

/* ── Buttons ────────────────────────────────────────────────────── */

button {
  appearance: none;
  border: none;
  border-radius: 16px;
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.client-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: var(--accent);
}

.client-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.client-info h3 {
  margin: 0;
  font-size: 1.1rem;
}

.client-info p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.6;
}

.client-icon svg { width: 22px; height: 22px; }

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.3);
}

button:active { transform: translateY(0); }

button.secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

#submitBtn { flex: 2; }
#fillDemoBtn { flex: 1; }

button.small {
  padding: 8px 16px;
  font-size: 0.875rem;
}

/* ── Result Section ─────────────────────────────────────────────── */

#resultSection.hidden {
  display: none !important;
}

#resultSection {
  padding: 32px;
  border-radius: 24px;
  margin-top: 32px;
}

#resultSection:not(.hidden) {
  display: block;
  animation: fadeSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.counts { display: flex; gap: 12px; }
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  min-width: 80px;
}
.stat-num {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-2);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.sub-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.sub-card {
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  transition: all 0.2s;
}

.sub-card-head {
  margin-bottom: 12px;
}

.sub-card:hover { border-color: var(--accent); background: rgba(255, 255, 255, 0.04); }
.sub-card-wide { grid-column: 1 / -1; }

.sub-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.sub-actions input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--muted);
}

/* ── Preview Table ──────────────────────────────────────────────── */

.preview-wrap { margin-top: 32px; }
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--card-border);
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

th, td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
}

th { background: rgba(255, 255, 255, 0.02); color: #94a3b8; font-weight: 600; }

/* ── Animations ─────────────────────────────────────────────────── */

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 840px) {
  .two-col, .three-col, .two-col-75-25, .sub-grid {
    grid-template-columns: 1fr;
  }
  
  .checkbox-group { height: auto; margin-top: 8px; }
  .form-section, .secondary-options, .form-actions { padding: 24px; }
}
