/* ============================================================
   ChatGPT 支付短链生成器 — 2026 UI/UX Design System
   Color Palette: Deep dark + Cyan/Indigo gradient accents
   Glass morphism + micro-animations
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* --- CSS Custom Properties --- */
:root {
  --bg-primary: #06080d;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.05);
  --bg-input: rgba(255, 255, 255, 0.04);
  --bg-input-focus: rgba(255, 255, 255, 0.07);

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-input: rgba(255, 255, 255, 0.10);
  --border-input-focus: rgba(34, 211, 238, 0.40);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-cyan: #22d3ee;
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;
  --accent-violet: #8b5cf6;

  --gradient-primary: linear-gradient(135deg, #22d3ee, #6366f1);
  --gradient-team: linear-gradient(135deg, #8b5cf6, #6366f1);
  --gradient-plus: linear-gradient(135deg, #10b981, #22d3ee);
  --gradient-success: linear-gradient(135deg, #10b981, #059669);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 28px;

  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow-cyan: 0 0 40px rgba(34, 211, 238, 0.15);
  --shadow-glow-indigo: 0 0 40px rgba(99, 102, 241, 0.15);

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* --- Animated Background --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 15% 30%, rgba(34, 211, 238, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 85% 70%, rgba(99, 102, 241, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 50% 100%, rgba(139, 92, 246, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  animation: bgPulse 12s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* --- Noise Overlay --- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.02'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* --- Layout Container --- */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

/* --- Header --- */
.app-header {
  text-align: center;
  margin-bottom: 36px;
}

.app-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.app-header .subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ============================================================
   Stats Bar — 三个统计卡
   ============================================================ */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-smooth), border-color var(--transition-smooth);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.12);
}

/* 顶部渐变装饰线 */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  border-radius: 0 0 4px 4px;
  opacity: 0.8;
}

.stat-card.total::before { background: var(--gradient-primary); }
.stat-card.team::before { background: var(--gradient-team); }
.stat-card.plus::before { background: var(--gradient-plus); }

.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat-card.total .stat-value { color: var(--accent-cyan); }
.stat-card.team .stat-value { color: var(--accent-violet); }
.stat-card.plus .stat-value { color: var(--accent-emerald); }

/* ============================================================
   Main Content — 双栏布局
   ============================================================ */
.main-content {
  display: grid;
  grid-template-columns: 1fr 320px;
  grid-template-rows: auto;
  gap: 24px;
  align-items: start;
}

/* 左侧 config-card 跨所有行 */
.config-card {
  grid-column: 1;
  grid-row: 1 / 3;
}

/* --- Glass Card Base --- */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 32px;
  position: relative;
  overflow: hidden;
}

/* --- Config Card (左侧主卡片) --- */

/* Section Title */
.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

/* --- Plan Toggle (Team/Plus 切换) --- */
.plan-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
}

.plan-option {
  position: relative;
  cursor: pointer;
}

.plan-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.plan-option .plan-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 16px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition-smooth);
  text-align: center;
}

.plan-option .plan-label .plan-icon {
  font-size: 1.5rem;
}

.plan-option .plan-label .plan-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.plan-option .plan-label .plan-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.plan-option input:checked + .plan-label {
  border-color: var(--accent-cyan);
  background: rgba(34, 211, 238, 0.06);
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.08);
}

.plan-option:first-child input:checked + .plan-label {
  border-color: var(--accent-violet);
  background: rgba(139, 92, 246, 0.06);
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.08);
}

.plan-option .plan-label:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: var(--bg-card-hover);
}

/* --- Form Group --- */
.form-group {
  margin-bottom: 24px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* --- Input / Select --- */
.form-input,
.form-select {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  outline: none;
  transition: all var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}

.form-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--border-input-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
}

/* Token 输入框 */
.token-input {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82rem;
  min-height: 52px;
  resize: vertical;
}

.token-hint {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.token-hint.extracted {
  color: var(--accent-emerald);
}

.token-hint a {
  color: var(--accent-violet);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px dashed rgba(139, 92, 246, 0.3);
  transition: all var(--transition-fast);
}

.token-hint a:hover {
  border-bottom-color: var(--accent-violet);
  text-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}

/* Select 下拉箭头 */
.select-wrapper {
  position: relative;
}

.select-wrapper::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-muted);
  pointer-events: none;
}

.form-select {
  padding-right: 40px;
  cursor: pointer;
}

/* --- Generate Button --- */
.btn-generate {
  width: 100%;
  padding: 16px 24px;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-smooth);
  letter-spacing: 0.02em;
}

.btn-generate::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(34, 211, 238, 0.25);
}

.btn-generate:hover::before {
  opacity: 1;
}

.btn-generate:active {
  transform: translateY(0);
}

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-generate:disabled:hover {
  box-shadow: none;
}

/* Loading Spinner */
.btn-generate .spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
}

.btn-generate.loading .spinner {
  display: inline-block;
}

.btn-generate.loading .btn-text {
  opacity: 0.8;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   Result Display — 生成结果
   ============================================================ */
.result-section {
  margin-top: 24px;
  display: none;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-section.visible {
  display: block;
}

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

.result-box {
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.20);
  border-radius: var(--radius-md);
  padding: 20px;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.result-header .check-icon {
  width: 22px;
  height: 22px;
  background: var(--gradient-success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #fff;
  flex-shrink: 0;
}

.result-header .result-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-emerald);
}

.result-link {
  word-break: break-all;
  font-size: 0.82rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.25);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  line-height: 1.5;
  user-select: all;
}

.result-actions {
  display: flex;
  gap: 10px;
}

.btn-action {
  flex: 1;
  padding: 11px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-action:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.18);
}

.btn-action.copied {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.30);
  color: var(--accent-emerald);
}

/* --- Error Display --- */
.error-section {
  margin-top: 24px;
  display: none;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.error-section.visible {
  display: block;
}

.error-box {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.20);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  color: #fca5a5;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ============================================================
   Instructions Card (右侧说明卡片)
   ============================================================ */
.instructions-card {
  position: sticky;
  top: 24px;
}

.instructions-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.instructions-card h3 .icon {
  font-size: 1.1rem;
}

.step-list {
  list-style: none;
  counter-reset: step;
}

.step-list li {
  counter-increment: step;
  position: relative;
  padding-left: 36px;
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.step-list li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  background: rgba(34, 211, 238, 0.10);
  border: 1px solid rgba(34, 211, 238, 0.20);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.step-list li a {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px dashed rgba(34, 211, 238, 0.3);
  transition: all var(--transition-fast);
}

.step-list li a:hover {
  border-bottom-color: var(--accent-cyan);
  text-shadow: 0 0 12px rgba(34, 211, 238, 0.3);
}

/* --- Privacy Notice --- */
.privacy-notice {
  margin-top: 24px;
  padding: 14px 16px;
  background: rgba(34, 211, 238, 0.04);
  border: 1px solid rgba(34, 211, 238, 0.10);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.privacy-notice strong {
  color: var(--accent-cyan);
  font-weight: 600;
}

/* ============================================================
   Shop Card (店铺卡片)
   ============================================================ */
.shop-card {
  margin-top: 0;
}

.shop-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.shop-card h3 .icon {
  font-size: 1.1rem;
}

.shop-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: rgba(139, 92, 246, 0.05);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all var(--transition-smooth);
}

.shop-link:hover {
  background: rgba(139, 92, 246, 0.10);
  border-color: rgba(139, 92, 246, 0.30);
  transform: translateY(-1px);
}

.shop-link-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.shop-link-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.shop-link-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.shop-link-url {
  font-size: 0.75rem;
  color: var(--accent-violet);
  font-weight: 500;
}

.shop-link-arrow {
  font-size: 1.1rem;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.shop-link:hover .shop-link-arrow {
  transform: translateX(3px);
  color: var(--accent-violet);
}

/* ============================================================
   Footer
   ============================================================ */
.app-footer {
  text-align: center;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================
   Responsive — 移动端适配
   ============================================================ */
@media (max-width: 768px) {
  .app-container {
    padding: 24px 16px 40px;
  }

  .stats-bar {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    text-align: left;
  }

  .stat-card .stat-value {
    font-size: 1.35rem;
  }

  .main-content {
    grid-template-columns: 1fr;
  }

  .instructions-card {
    position: static;
    order: -1;
  }

  .glass-card {
    padding: 24px 20px;
    border-radius: var(--radius-lg);
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .plan-toggle {
    gap: 10px;
  }

  .app-header h1 {
    font-size: 1.4rem;
  }

  .result-actions {
    flex-direction: column;
  }
}
