/* ==========================================
   TRON USDT 批量查询工具 - 浅色主题样式系统
   ========================================== */

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

/* ---------- CSS Variables ---------- */
:root {
  /* 主色系 - 浅色主题 */
  --bg-primary: #f4f6fb;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #fafbff;
  --bg-input: #f8f9fc;
  --bg-table-row: #ffffff;
  --bg-table-row-alt: #f8f9fd;
  --bg-table-header: #f0f2f8;

  /* 强调色 */
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
  --accent-glow: rgba(99, 102, 241, 0.15);
  --accent-light: rgba(99, 102, 241, 0.06);

  /* 文字色 */
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-highlight: #0f172a;

  /* 状态色 */
  --success: #16a34a;
  --success-bg: rgba(22, 163, 74, 0.08);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.08);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.08);
  --info: #2563eb;

  /* 边框 */
  --border-color: #e2e8f0;
  --border-hover: rgba(99, 102, 241, 0.35);

  /* 阴影 */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.1);

  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* 过渡 */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

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

/* ---------- Background Decoration ---------- */
body::before {
  content: '';
  position: fixed;
  top: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.06), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -200px;
  left: -200px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.05), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

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

/* ---------- Header ---------- */
.app-header {
  text-align: center;
  padding: 28px 0 16px;
}

.app-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.logo-icon img {
  display: block;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-highlight);
  letter-spacing: -0.3px;
  line-height: 1.3;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: unset;
  background-clip: unset;
  background: none;
}

.logo-text-sub {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ---------- Ad Bar ---------- */
.ad-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
  padding: 0;
}

.ad-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-normal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ad-item:hover {
  border-color: var(--border-hover);
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.ad-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-radius: 3px;
  flex-shrink: 0;
  line-height: 1.4;
}

/* ---------- Glass Card ---------- */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.glass-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

/* ---------- Input Section ---------- */
.input-section {
  padding: 28px;
  margin-bottom: 24px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 14px;
}

.section-label .icon {
  font-size: 16px;
}

/* ---------- API Key Input ---------- */
.apikey-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.apikey-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.apikey-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  outline: none;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.apikey-input::placeholder {
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
}

.apikey-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.apikey-hint {
  font-size: 11px;
  color: var(--text-muted);
  width: 100%;
  margin-top: -4px;
}

.apikey-hint a {
  color: var(--accent-primary);
  text-decoration: none;
}

.apikey-hint a:hover {
  text-decoration: underline;
}

/* ---------- Textarea ---------- */
.address-textarea {
  width: 100%;
  min-height: 200px;
  padding: 16px 18px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.8;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.address-textarea::placeholder {
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
}

.address-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.address-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.address-count span {
  color: var(--accent-primary);
  font-weight: 600;
}

.btn-group {
  display: flex;
  gap: 10px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  outline: none;
  position: relative;
  overflow: hidden;
}

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

.btn:hover::after {
  opacity: 1;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 25px rgba(99, 102, 241, 0.35);
}

.btn-primary:active {
  transform: translateY(0px) scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--accent-light);
  color: var(--accent-primary);
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.btn-secondary:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
}

.btn-danger {
  background: rgba(220, 38, 38, 0.06);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.15);
}

.btn-danger:hover {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.3);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

/* ---------- Progress Bar ---------- */
.progress-section {
  margin-bottom: 24px;
  display: none;
}

.progress-section.active {
  display: block;
  animation: fadeSlideIn 0.3s ease;
}

.progress-wrapper {
  padding: 20px 28px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.progress-text {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.progress-percent {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-primary);
  font-variant-numeric: tabular-nums;
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 80px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100px); }
}

/* ---------- Stats Panel ---------- */
.stats-section {
  margin-bottom: 24px;
  display: none;
}

.stats-section.active {
  display: block;
  animation: fadeSlideIn 0.3s ease;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  padding: 24px 28px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all var(--transition-normal);
}

.stat-item:hover {
  border-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-highlight);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.stat-value.success { color: var(--success); }
.stat-value.danger { color: var(--danger); }
.stat-value.accent { color: var(--accent-primary); }

/* ---------- Results Section ---------- */
.results-section {
  display: none;
}

.results-section.active {
  display: block;
  animation: fadeSlideIn 0.4s ease;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 12px;
}

.results-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.results-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Selected count indicator */
.selected-info {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-primary);
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.selected-info.active {
  display: inline-flex;
}

/* ---------- Table ---------- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrapper::-webkit-scrollbar {
  height: 4px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  background: var(--bg-table-header);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  user-select: none;
}

.data-table th.sortable {
  cursor: pointer;
  transition: color var(--transition-fast);
}

.data-table th.sortable:hover {
  color: var(--accent-primary);
}

.sort-icon {
  display: inline-flex;
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.3;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.data-table th.sortable:hover .sort-icon {
  opacity: 0.6;
}

.data-table th.sort-asc .sort-icon,
.data-table th.sort-desc .sort-icon {
  opacity: 1;
  color: var(--accent-primary);
}

.data-table th.sort-desc .sort-icon {
  transform: rotate(180deg);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:nth-child(even) {
  background: var(--bg-table-row-alt);
}

.data-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.04);
}

/* Selected row highlight */
.data-table tbody tr.row-selected {
  background: rgba(99, 102, 241, 0.06) !important;
}

/* Row entrance animation */
.data-table tbody tr {
  animation: rowFadeIn 0.3s ease both;
}

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

/* Table cell styles */
.cell-index {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  width: 50px;
}

.cell-address {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  position: relative;
}

.cell-address:hover {
  color: var(--accent-primary);
}

.cell-address .copy-hint {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-highlight);
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.cell-address:hover .copy-hint {
  opacity: 1;
}

.cell-number {
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

.cell-trx { color: #d97706; }
.cell-usdt { color: #16a34a; }
.cell-create-time {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-normal {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-muted);
}

.multi-sig-yes {
  color: var(--danger);
  font-weight: 600;
}

.multi-sig-no {
  color: var(--text-muted);
}

/* ---------- Checkbox ---------- */
.custom-checkbox {
  width: 16px;
  height: 16px;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid var(--border-color);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  flex-shrink: 0;
}

.custom-checkbox:checked {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.custom-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: #fff;
  font-weight: 700;
}

.custom-checkbox:hover {
  border-color: var(--accent-primary);
}

/* ---------- Toast Notification ---------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ---------- Footer ---------- */
.app-footer {
  text-align: center;
  padding: 40px 0 20px;
  color: var(--text-muted);
  font-size: 12px;
}

.app-footer a {
  color: var(--accent-primary);
  text-decoration: none;
}

/* ---------- Animations ---------- */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .app-container {
    padding: 16px 12px 40px;
  }

  .app-header {
    padding: 16px 0 12px;
  }

  .app-logo {
    gap: 10px;
  }

  .logo-icon {
    width: 34px;
    height: 34px;
  }

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

  .logo-text {
    font-size: 15px;
  }

  .logo-text-sub {
    font-size: 13px;
  }

  .ad-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
  }

  .ad-item {
    padding: 8px 10px;
    font-size: 11px;
  }

  .input-section,
  .progress-wrapper,
  .results-header {
    padding: 18px 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 16px;
    gap: 10px;
  }

  .stat-item {
    padding: 12px;
  }

  .stat-value {
    font-size: 18px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 10px;
    font-size: 12px;
  }

  .data-table th {
    font-size: 10px;
  }

  .btn {
    padding: 10px 18px;
    font-size: 13px;
  }

  .input-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-group {
    justify-content: center;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .results-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .address-textarea {
    min-height: 150px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .logo-icon {
    width: 30px;
    height: 30px;
  }

  .logo-text {
    font-size: 13px;
  }

  .logo-text-sub {
    font-size: 11px;
    display: block;
  }

  .ad-bar {
    grid-template-columns: repeat(2, 1fr);
  }
}
