/* ═══════════════════════════════════════════
   Trust 批量授权 DApp — 暗色主题样式
   ═══════════════════════════════════════════ */

:root {
  --bg-primary:   #0a0a0f;
  --bg-secondary: #131320;
  --bg-card:      #1a1a2e;
  --bg-input:     #0f0f1a;
  --border:       #2a2a40;
  --border-light: #353550;
  --text-primary: #e8e8f0;
  --text-secondary:#9999b0;
  --text-muted:   #666680;
  --accent:       #00d4ff;
  --accent-dim:   #0066aa;
  --success:      #00e676;
  --warning:      #ffab00;
  --danger:       #ff5252;
  --purple:       #7c4dff;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 4px 20px rgba(0,0,0,0.4);
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* ───── 顶部导航栏 ───── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
  gap: 12px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 700;
  white-space: nowrap;
}

.navbar-brand .logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ───── 通用按钮 ───── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text-primary);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 20px rgba(0,212,255,0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent);
}

.btn-danger {
  background: rgba(255,82,82,0.15);
  border: 1px solid var(--danger);
  color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(255,82,82,0.25);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #00b85c);
  color: #000;
}
.btn-success:hover:not(:disabled) {
  box-shadow: 0 0 16px rgba(0,230,118,0.4);
}

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

/* ───── 网络选择器 ───── */
.network-select {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 600;
  outline: none;
}
.network-select:focus { border-color: var(--accent); }
.network-select option { background: var(--bg-card); }

/* ───── 账户信息栏 ───── */
.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}
.account-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}
.account-info .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}
.account-info .dot.offline {
  background: var(--text-muted);
  box-shadow: none;
}
.account-addr {
  font-family: "SF Mono", "Fira Code", monospace;
  color: var(--accent);
  cursor: pointer;
  transition: color 0.2s;
}
.account-addr:hover { text-decoration: underline; }
.account-balance {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ───── 主容器 ───── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

/* ───── Tab 导航 ───── */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--bg-card);
  padding: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-x: auto;
}
.tab-btn {
  flex: 1;
  min-width: 100px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #fff;
}

/* ───── Tab 内容 ───── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ───── 卡片 ───── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

/* ───── 表单元素 ───── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.form-label .hint { color: var(--text-muted); font-weight: 400; }

.form-input,
.form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus,
.form-textarea:focus { border-color: var(--accent); }

.form-textarea {
  resize: vertical;
  min-height: 140px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.82rem;
  line-height: 1.8;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }

/* ───── 单选 / 额度选择 ───── */
.radio-group {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.radio-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 8px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  transition: all 0.2s;
}
.radio-item:hover { border-color: var(--border-light); }
.radio-item.active {
  border-color: var(--accent);
  background: rgba(0,212,255,0.08);
}
.radio-item input { accent-color: var(--accent); }

/* ───── 进度列表 ───── */
.progress-list {
  margin-top: 20px;
}
.progress-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 0.85rem;
  transition: border-color 0.3s;
}
.progress-item .icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.progress-item .icon.pending  { background: var(--bg-card); color: var(--text-muted); border:1px solid var(--border); }
.progress-item .icon.processing { background: rgba(255,171,0,0.15); color: var(--warning); animation: spin 1.2s linear infinite; }
.progress-item .icon.success   { background: rgba(0,230,118,0.15); color: var(--success); }
.progress-item .icon.error     { background: rgba(255,82,82,0.15); color: var(--danger); }

.progress-item .token-symbol {
  color: var(--accent);
  font-weight: 700;
  min-width: 56px;
}
.progress-item .token-addr {
  color: var(--text-muted);
  font-family: "SF Mono","Fira Code",monospace;
  font-size: 0.78rem;
}
.progress-item .status-text { margin-left: auto; font-size: 0.8rem; color: var(--text-secondary); }
.progress-item.success { border-color: rgba(0,230,118,0.3); }
.progress-item.error   { border-color: rgba(255,82,82,0.3); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ───── 代币快捷选择 ───── */
.token-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.token-chip {
  padding: 4px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
}
.token-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.token-chip.added {
  border-color: var(--success);
  color: var(--success);
}

/* ───── Toast 提示 ───── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}
.toast {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  border-left: 4px solid;
}
.toast.success { background: var(--bg-card); border-left-color: var(--success); }
.toast.error   { background: var(--bg-card); border-left-color: var(--danger); }
.toast.info    { background: var(--bg-card); border-left-color: var(--accent); }
.toast.warning { background: var(--bg-card); border-left-color: var(--warning); }
.toast .toast-msg { flex: 1; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
  to { transform: translateX(100%); opacity: 0; }
}
.toast.removing { animation: slideOut 0.3s ease forwards; }

/* ───── 空状态 / 未连接 ───── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .emoji { font-size: 3rem; margin-bottom: 16px; }
.empty-state p { font-size: 0.95rem; }

/* ───── 连接钱包大卡片 ───── */
.connect-card {
  text-align: center;
  padding: 48px 32px;
  max-width: 460px;
  margin: 60px auto;
}
.connect-card .emoji { font-size: 4rem; margin-bottom: 20px; }
.connect-card h2 { font-size: 1.4rem; margin-bottom: 8px; }
.connect-card p { color: var(--text-secondary); margin-bottom: 24px; font-size: 0.9rem; }

/* ───── 转账批量项 ───── */
.transfer-row {
  display: grid;
  grid-template-columns: 1fr 140px 80px 32px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.transfer-row .form-input { padding: 8px 10px; font-size: 0.82rem; }
.transfer-row .row-del {
  background: rgba(255,82,82,0.1);
  border: 1px solid rgba(255,82,82,0.3);
  color: var(--danger);
  border-radius: var(--radius-sm);
  cursor: pointer;
  height: 36px;
  font-size: 1rem;
  transition: all 0.2s;
}
.transfer-row .row-del:hover { background: rgba(255,82,82,0.2); }

/* ───── 脚本输出 ───── */
.code-block {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: "SF Mono","Fira Code",monospace;
  font-size: 0.82rem;
  overflow-x: auto;
  white-space: pre;
  color: var(--text-primary);
  max-height: 500px;
  overflow-y: auto;
  line-height: 1.7;
}

/* ───── 帮助 / 步骤 ───── */
.steps-list {
  counter-reset: step;
  list-style: none;
}
.steps-list li {
  counter-increment: step;
  position: relative;
  padding-left: 40px;
  padding-bottom: 16px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}
.steps-list li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}
.steps-list li strong { color: var(--text-primary); }

/* ───── 弹窗 ───── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 440px;
  width: 100%;
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow);
}
.modal h3 { font-size: 1.1rem; margin-bottom: 12px; }
.modal p { color: var(--text-secondary); font-size: 0.88rem; margin-bottom: 20px; }
.modal .qr-area {
  background: #fff;
  padding: 16px;
  border-radius: var(--radius-sm);
  margin: 0 auto 20px;
  width: 240px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ───── 页脚 ───── */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ───── 工具类 ───── */
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent  { color: var(--accent); }
.text-muted   { color: var(--text-muted); }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.hidden { display: none !important; }

/* ───── 响应式 ───── */
@media (max-width: 640px) {
  .navbar { padding: 12px 16px; }
  .navbar-brand { font-size: 1.1rem; }
  .container { padding: 16px 12px 60px; }
  .card { padding: 18px; }
  .transfer-row { grid-template-columns: 1fr; gap: 6px; }
  .transfer-row .row-del { height: 32px; }
  .toast-container { left: 12px; right: 12px; max-width: none; top: 70px; }
  .tab-btn { font-size: 0.78rem; padding: 8px 10px; min-width: 80px; }
}
