/* ══════════════════════════════════════════════════
   GPT Plus 自助充值 — 设计系统 + 前端样式
   Font: Inter | Color: Blue Glassmorphism
   ══════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  --blue-50:  #EFF6FF;
  --blue-100: #DBEAFE;
  --blue-200: #BFDBFE;
  --blue-300: #93C5FD;
  --blue-400: #60A5FA;
  --blue-500: #3B82F6;
  --blue-600: #2563EB;
  --blue-700: #1D4ED8;
  --blue-800: #1E40AF;
  --blue-900: #1E3A8A;

  --green:  #10B981;
  --red:    #EF4444;
  --orange: #F97316;
  --yellow: #EAB308;

  --text-primary:   #0F172A;
  --text-secondary: #334155;
  --text-muted:     #64748B;
  --text-light:     #94A3B8;

  --bg-body:   #F0F4FF;
  --bg-card:   rgba(255, 255, 255, 0.72);
  --bg-card-solid: #FFFFFF;
  --border:    rgba(255, 255, 255, 0.45);
  --shadow:    0 8px 32px rgba(37, 99, 235, 0.08);
  --shadow-lg: 0 16px 48px rgba(37, 99, 235, 0.12);

  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --blur:      16px;
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-primary);
  background: var(--bg-body);
  background-image:
    radial-gradient(ellipse 120% 80% at 20% 0%, rgba(37,99,235,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 80% 60% at 80% 20%, rgba(59,130,246,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(37,99,235,0.04) 0%, transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Floating Navbar ── */
.navbar {
  position: fixed;
  top: 12px;
  left: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(37, 99, 235, 0.06);
  transition: box-shadow 0.3s;
}
.navbar:hover { box-shadow: 0 4px 32px rgba(37, 99, 235, 0.1); }

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--blue-700);
}
.navbar-brand svg { width: 28px; height: 28px; }
.navbar-brand span { background: linear-gradient(135deg, var(--blue-700), var(--blue-500)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.navbar-links { display: flex; gap: 4px; }
.navbar-links a {
  padding: 8px 16px;
  border-radius: var(--radius-xs);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
}
.navbar-links a:hover { background: var(--blue-50); color: var(--blue-600); }
.navbar-links a.active { background: var(--blue-600); color: #fff; }

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 110px 20px 32px;
}
.hero h1 {
  font-size: 2.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--blue-800), var(--blue-500));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}
.hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  font-weight: 400;
}
.hero-badges {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.1);
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--blue-700);
}
.hero-badge svg { width: 14px; height: 14px; }

/* ── Container ── */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ── Tab Navigation ── */
.tab-nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 28px;
}
.tab-btn {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 9px;
  background: transparent;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.25s ease;
}
.tab-btn:hover { color: var(--blue-600); background: rgba(37, 99, 235, 0.04); }
.tab-btn.active {
  background: var(--blue-600);
  color: #fff;
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.25);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

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

/* ── Step Progress ── */
.step-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 32px;
  padding: 0 8px;
}
.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}
.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  background: #E2E8F0;
  color: var(--text-muted);
  transition: all 0.35s ease;
  border: 3px solid transparent;
}
.step-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-light);
  white-space: nowrap;
  transition: color 0.35s;
}
.step-item.active .step-circle {
  background: var(--blue-600);
  color: #fff;
  border-color: var(--blue-200);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.step-item.active .step-label { color: var(--blue-600); font-weight: 600; }
.step-item.completed .step-circle {
  background: var(--green);
  color: #fff;
}
.step-item.completed .step-label { color: var(--green); }

.step-line {
  width: 60px;
  height: 3px;
  background: #E2E8F0;
  border-radius: 2px;
  margin: 0 8px;
  margin-bottom: 26px;
  transition: background 0.4s ease;
}
.step-line.active {
  background: linear-gradient(90deg, var(--green), var(--blue-500));
}

/* ── Glass Card ── */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s, transform 0.3s;
}
.glass-card:hover {
  box-shadow: var(--shadow-lg);
}

/* ── Step Panels ── */
.step-panel { display: none; animation: fadeIn 0.35s ease; }
.step-panel.active { display: block; }

.step-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.step-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ── Form Elements ── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.85);
  transition: all 0.2s;
  outline: none;
}
.form-input:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.form-input::placeholder { color: var(--text-light); }
.form-input.is-error { border-color: var(--red); }
.form-input.is-error:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1); }

textarea.form-input {
  min-height: 100px;
  resize: vertical;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.82rem;
  line-height: 1.5;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  outline: none;
  position: relative;
  overflow: hidden;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
  color: #fff;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.2);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 24px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-secondary {
  background: rgba(37, 99, 235, 0.06);
  color: var(--blue-600);
  border: 1px solid rgba(37, 99, 235, 0.15);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(37, 99, 235, 0.1);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { color: var(--blue-600); background: var(--blue-50); }

.btn-block { width: 100%; }

.btn-loader {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error Message ── */
.error-msg {
  font-size: 0.85rem;
  color: var(--red);
  margin-top: 10px;
  display: none;
  align-items: center;
  gap: 6px;
}
.error-msg.show { display: flex; }
.error-msg svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Token Preview ── */
.token-preview {
  display: none;
  margin-top: 16px;
  padding: 16px;
  background: var(--blue-50);
  border: 1px solid var(--blue-200);
  border-radius: var(--radius-sm);
}
.token-preview.is-error {
  background: #FEF2F2;
  border-color: #FECACA;
}
.token-preview-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.88rem;
}
.token-preview-row .label { color: var(--text-muted); }
.token-preview-row .value { font-weight: 600; color: var(--text-primary); }

.plus-cover-warning {
  display: none;
  margin-top: 12px;
  padding: 12px 16px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-xs);
  font-size: 0.84rem;
  color: #92400E;
  align-items: flex-start;
  gap: 8px;
}
.plus-cover-warning svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

/* ── Confirm Card ── */
.confirm-section {
  padding: 20px;
  background: var(--blue-50);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}
.confirm-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(37, 99, 235, 0.08);
  font-size: 0.92rem;
}
.confirm-row:last-child { border-bottom: none; }
.confirm-row .label { color: var(--text-muted); }
.confirm-row .value { font-weight: 600; color: var(--text-primary); }

/* ── Result Panel ── */
.result-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-icon.success {
  background: linear-gradient(135deg, #D1FAE5, #A7F3D0);
  color: var(--green);
  animation: resultPop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.result-icon.failed {
  background: linear-gradient(135deg, #FEE2E2, #FECACA);
  color: var(--red);
  animation: resultShake 0.5s ease;
}
.result-icon svg { width: 36px; height: 36px; }

@keyframes resultPop {
  0%   { transform: scale(0); }
  80%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}
@keyframes resultShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(5px); }
}

.result-title {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.result-detail {
  text-align: center;
  padding: 16px;
  background: var(--blue-50);
  border-radius: var(--radius-sm);
  margin: 16px 0;
}
.result-btns {
  display: none;
  gap: 12px;
  margin-top: 24px;
}

/* Loading Spinner */
.loading-container {
  text-align: center;
  padding: 32px;
}
.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--blue-100);
  border-top-color: var(--blue-600);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}
.loading-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
#poll-status {
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* ── Batch Query ── */
.query-results {
  display: none;
  margin-top: 24px;
}
.results-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--blue-50);
  border-radius: var(--radius-xs);
}
.results-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid #E2E8F0;
}
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.results-table th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
  white-space: nowrap;
}
.results-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #F1F5F9;
  color: var(--text-secondary);
}
.results-table tr:hover td { background: var(--blue-50); }
.results-table .col-code { font-family: monospace; font-size: 0.82rem; }

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-available  { background: #D1FAE5; color: #065F46; }
.status-queued     { background: #CFFAFE; color: #0E7490; }
.status-processing { background: #DBEAFE; color: #1E40AF; }
.status-used, .status-completed { background: #E2E8F0; color: #475569; }
.status-failed     { background: #FEE2E2; color: #991B1B; }
.status-disabled   { background: #F1F5F9; color: #94A3B8; }
.status-unknown    { background: #FEF3C7; color: #92400E; }

/* ── Tutorial ── */
.tutorial-section {
  margin-bottom: 24px;
}
.tutorial-section h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tutorial-step {
  padding: 16px;
  background: var(--blue-50);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  border-left: 3px solid var(--blue-400);
}
.tutorial-step code {
  padding: 2px 6px;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 4px;
  font-size: 0.84rem;
  color: var(--blue-700);
}

/* ── FAQ ── */
.faq-section { margin-top: 40px; }
.faq-section h2 {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 20px;
  color: var(--text-primary);
}
.faq-item {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.faq-item:hover { box-shadow: 0 2px 12px rgba(37, 99, 235, 0.06); }
.faq-q {
  padding: 16px 20px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: background 0.2s;
}
.faq-q:hover { background: rgba(37,99,235,0.03); }
.faq-q svg {
  width: 18px; height: 18px;
  transition: transform 0.3s;
  color: var(--text-muted);
  flex-shrink: 0;
}
.faq-item.open .faq-q svg { transform: rotate(180deg); }
.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}
.faq-item.open .faq-a {
  max-height: 300px;
  padding: 0 20px 16px;
}
.faq-a p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-light);
  font-size: 0.82rem;
}
.footer a { color: var(--blue-500); }

/* ── Workflow Badge ── */
.workflow-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 700;
}
.workflow-plus { background: linear-gradient(135deg, #DBEAFE, #BFDBFE); color: var(--blue-700); }
.workflow-pro  { background: linear-gradient(135deg, #F3E8FF, #E9D5FF); color: #7C3AED; }
/* 通用 workflow badge fallback (动态新增的 workflow 自动使用) */
.workflow-badge:not(.workflow-plus):not(.workflow-pro) {
  background: linear-gradient(135deg, #CFFAFE, #A5F3FC); color: #0E7490;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .navbar { left: 8px; right: 8px; top: 8px; padding: 10px 16px; }
  .navbar-brand { font-size: 1rem; }
  .navbar-links a { padding: 6px 10px; font-size: 0.82rem; }
  .hero { padding-top: 90px; }
  .hero h1 { font-size: 1.8rem; }
  .hero p { font-size: 0.92rem; }
  .glass-card { padding: 24px 20px; }
  .step-line { width: 36px; }
  .confirm-row { flex-direction: column; gap: 2px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.5rem; }
  .hero-badges { gap: 8px; }
  .hero-badge { font-size: 0.75rem; padding: 5px 10px; }
  .tab-btn { font-size: 0.82rem; padding: 10px 8px; }
  .step-circle { width: 30px; height: 30px; font-size: 0.78rem; }
  .step-label { font-size: 0.7rem; }
  .step-line { width: 24px; margin: 0 4px; }
  .btn { padding: 12px 20px; font-size: 0.88rem; }
  .results-table { font-size: 0.78rem; }
  .results-table th, .results-table td { padding: 8px 10px; }
}

/* ── Utility ── */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-12 { gap: 12px; }
.hidden { display: none !important; }
