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

:root {
  --bg-base:    #080810;
  --bg-card:    #0f0f1a;
  --bg-card2:   #14141f;
  --bg-hover:   #1a1a2e;
  --bg-input:   #0c0c16;
  --border:     #1e1e35;
  --border-l:   #2a2a48;

  --cyan:       #00d4ff;
  --green:      #00ff9d;
  --red:        #ff4757;
  --orange:     #ffa502;
  --yellow:     #ffd32a;
  --purple:     #a855f7;
  --purple-l:   #c084fc;
  --blue:       #3b82f6;
  --pink:       #ec4899;
  --solana:     #9945ff;
  --tron:       #ff6b35;
  --btc:        #f7931a;

  --text-1:     #e8e8f0;
  --text-2:     #9090b0;
  --text-3:     #5a5a80;

  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  14px;
  --shadow:     0 4px 24px rgba(0,0,0,0.6);
  --shadow-lg:  0 8px 48px rgba(0,0,0,0.8);

  --font-mono:  'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-ui:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --header-h:   60px;
  --sidebar-w:  240px;
}

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--bg-base);
  color: var(--text-1);
  min-height: 100vh;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-l); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ══════════ Header ══════════ */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(8,8,16,0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 16px;
}

.header-left { display: flex; align-items: center; gap: 12px; min-width: 280px; }

.logo { display: flex; align-items: center; gap: 8px; }
.logo-icon {
  font-size: 22px;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(0,212,255,0.5));
}
.logo-text {
  font-size: 16px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--text-1);
}
.logo-accent { color: var(--cyan); }
.header-badge {
  background: rgba(0,212,255,0.1); border: 1px solid rgba(0,212,255,0.3);
  color: var(--cyan); font-size: 10px; padding: 2px 7px;
  border-radius: 20px; font-family: var(--font-mono);
}

.header-stats {
  display: flex; align-items: center; gap: 8px; flex: 1;
}
.stat-pill {
  display: flex; align-items: center; gap: 5px;
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 20px;
  font-size: 12px; color: var(--text-2);
  white-space: nowrap;
}
.stat-dot { width: 6px; height: 6px; border-radius: 50%; }
.dot-green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot-cyan  { background: var(--cyan);  box-shadow: 0 0 6px var(--cyan); }
.dot-red   { background: var(--red);   box-shadow: 0 0 6px var(--red); }
.dot-orange{ background: var(--orange);box-shadow: 0 0 6px var(--orange); }

.header-right { display: flex; gap: 8px; }

/* ══════════ Layout ══════════ */
.layout {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

/* ══════════ Sidebar ══════════ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}

.sidebar-section { padding: 8px 12px; }
.sidebar-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--text-3); margin-bottom: 8px;
  display: flex; align-items: center; justify-content: space-between;
}

.chain-tabs { display: flex; flex-direction: column; gap: 2px; }
.chain-tab {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  background: none; border: none; cursor: pointer;
  color: var(--text-2); font-size: 13px;
  transition: all 0.15s; text-align: left;
}
.chain-tab:hover { background: var(--bg-hover); color: var(--text-1); }
.chain-tab.active {
  background: rgba(0,212,255,0.1);
  color: var(--cyan);
  border-left: 2px solid var(--cyan);
}
.chain-count {
  margin-left: auto; font-size: 11px;
  background: var(--bg-base); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 10px; color: var(--text-3);
}
.chain-tab.active .chain-count { background: rgba(0,212,255,0.15); color: var(--cyan); border-color: rgba(0,212,255,0.3); }

.tag-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-btn {
  padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 500;
  border: 1px solid var(--border); background: var(--bg-base);
  color: var(--text-2); cursor: pointer; transition: all 0.15s;
}
.tag-btn:hover { border-color: var(--border-l); color: var(--text-1); }
.tag-btn.active, .tag-btn[data-tag="all"].active { background: var(--cyan); border-color: var(--cyan); color: var(--bg-base); font-weight: 600; }
.tag-normal.active  { background: var(--green);  border-color: var(--green);  color: var(--bg-base); }
.tag-contract.active{ background: var(--purple); border-color: var(--purple); color: white; }
.tag-fail.active    { background: var(--red);    border-color: var(--red);    color: white; }
.tag-fake.active    { background: var(--orange); border-color: var(--orange); color: var(--bg-base); }

.sidebar-wallets { flex: 1; }
.quick-wallets { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.quick-wallet-item {
  background: var(--bg-base); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px; cursor: pointer;
  transition: border-color 0.15s;
}
.quick-wallet-item:hover { border-color: var(--border-l); }
.qw-label { font-size: 11px; color: var(--text-3); margin-bottom: 2px; }
.qw-addr { font-family: var(--font-mono); font-size: 10px; color: var(--cyan); }
.qw-type { font-size: 10px; color: var(--text-3); }

/* ══════════ Main Content ══════════ */
.main { flex: 1; padding: 20px; overflow-x: hidden; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.main-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.main-title {
  font-size: 20px; font-weight: 700; color: var(--text-1);
}

.search-box { position: relative; }
.search-box input {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 36px 8px 14px;
  color: var(--text-1); font-size: 13px; width: 220px;
  outline: none; transition: border-color 0.2s;
}
.search-box input:focus { border-color: var(--cyan); }
.search-icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); }

/* ══════════ Scenario Cards ══════════ */
.scenarios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.scenario-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  cursor: pointer; transition: all 0.2s;
  position: relative; overflow: hidden;
}
.scenario-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--card-color, var(--cyan));
  opacity: 0.6; transition: opacity 0.2s;
}
.scenario-card:hover { border-color: var(--border-l); transform: translateY(-2px); box-shadow: var(--shadow); }
.scenario-card:hover::before { opacity: 1; }

.card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.card-id {
  font-family: var(--font-mono); font-size: 11px;
  background: rgba(255,255,255,0.05); padding: 3px 8px;
  border-radius: 4px; color: var(--text-3);
}
.card-tag {
  font-size: 10px; padding: 3px 8px; border-radius: 20px;
  font-weight: 600;
}
.tag-normal-badge  { background: rgba(0,255,157,0.12); color: var(--green); border: 1px solid rgba(0,255,157,0.2); }
.tag-contract-badge{ background: rgba(168,85,247,0.12); color: var(--purple-l); border: 1px solid rgba(168,85,247,0.2); }
.tag-fail-badge    { background: rgba(255,71,87,0.12); color: var(--red); border: 1px solid rgba(255,71,87,0.2); }
.tag-fake-badge    { background: rgba(255,165,2,0.12); color: var(--orange); border: 1px solid rgba(255,165,2,0.2); }

.card-name { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.card-desc { font-size: 12px; color: var(--text-2); line-height: 1.5; margin-bottom: 12px; }
.card-footer { display: flex; align-items: center; justify-content: space-between; }
.card-category { font-size: 11px; color: var(--text-3); }
.card-params { font-size: 10px; color: var(--text-3); font-family: var(--font-mono); }

/* ══════════ Records ══════════ */
.records-actions { display: flex; gap: 8px; align-items: center; }
.filter-select {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 10px;
  color: var(--text-1); font-size: 12px; cursor: pointer; outline: none;
}

#recordsContainer { display: flex; flex-direction: column; gap: 10px; }

.record-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color 0.15s;
}
.record-card:hover { border-color: var(--border-l); }

.record-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; cursor: pointer;
}
.record-status {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.status-success { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-failed  { background: var(--red);   box-shadow: 0 0 8px var(--red); }
.status-fake    { background: var(--orange);box-shadow: 0 0 8px var(--orange); }
.status-error   { background: var(--red);   box-shadow: 0 0 8px var(--red); }
.status-pending { background: var(--yellow);box-shadow: 0 0 8px var(--yellow); }

.record-info { flex: 1; }
.record-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.record-meta { font-size: 11px; color: var(--text-2); display: flex; gap: 12px; flex-wrap: wrap; }
.record-meta span { display: flex; align-items: center; gap: 4px; }

.record-badge {
  font-size: 10px; padding: 3px 8px; border-radius: 20px; font-weight: 600;
}
.record-time { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.record-actions { display: flex; gap: 4px; }

.record-detail {
  display: none; border-top: 1px solid var(--border);
  padding: 14px 16px;
}
.record-detail.open { display: block; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; margin-bottom: 10px; }
.detail-item { background: var(--bg-base); border-radius: var(--radius-sm); padding: 8px 12px; }
.detail-key { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
.detail-val {
  font-family: var(--font-mono); font-size: 11px; color: var(--cyan);
  word-break: break-all;
}
.detail-val.val-hash {
  color: var(--purple-l);
  cursor: pointer;
}
.detail-val.val-hash:hover { text-decoration: underline; }
.detail-val.val-warn { color: var(--orange); }

/* ══════════ Buttons ══════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: none; transition: all 0.15s; white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--cyan), #0088cc);
  color: var(--bg-base); font-weight: 700;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,212,255,0.3); }
.btn-ghost {
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-1);
}
.btn-ghost:hover { border-color: var(--border-l); background: var(--bg-hover); }
.btn-danger { background: rgba(255,71,87,0.15); border: 1px solid rgba(255,71,87,0.3); color: var(--red); }
.btn-danger:hover { background: rgba(255,71,87,0.25); }
.btn-sm { font-size: 11px; padding: 5px 10px; }
.btn-xs { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: var(--bg-hover); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; }
.btn-xs:hover { color: var(--text-1); }
.btn-icon-only {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); padding: 4px; font-size: 14px;
}
.btn-icon-only:hover { color: var(--text-1); }

/* ══════════ Modal ══════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card); border: 1px solid var(--border-l);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 560px; max-width: calc(100vw - 32px); max-height: 85vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-large { width: 760px; }

.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-subtitle { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.modal-close { background: none; border: none; font-size: 18px; color: var(--text-3); cursor: pointer; line-height: 1; padding: 4px; }
.modal-close:hover { color: var(--text-1); }

.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ══════════ Form ══════════ */
.form-grid { display: flex; flex-direction: column; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.form-label-required { color: var(--red); }
.form-input {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px;
  color: var(--text-1); font-size: 13px; font-family: var(--font-mono);
  outline: none; transition: border-color 0.2s; width: 100%;
}
.form-input:focus { border-color: var(--cyan); }
.form-input::placeholder { color: var(--text-3); font-family: var(--font-ui); }
.form-hint { font-size: 11px; color: var(--text-3); }
.form-input-with-btn { display: flex; gap: 6px; }
.form-input-with-btn .form-input { flex: 1; }

.form-warning {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(255,165,2,0.1); border: 1px solid rgba(255,165,2,0.3);
  color: var(--orange); font-size: 12px; line-height: 1.6;
}

/* ══════════ Wallet Manager ══════════ */
.wallet-gen-section { background: var(--bg-base); border-radius: var(--radius); padding: 16px; margin-bottom: 4px; }
.section-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-3); margin-bottom: 12px; }
.wallet-gen-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wallet-gen-form .form-input { flex: 1; min-width: 140px; }
.wallet-gen-form select { flex: 1; min-width: 160px; }

.wallet-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; max-height: 420px; overflow-y: auto; }

.wallet-card {
  background: var(--bg-base); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
}
.wallet-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.wallet-label { font-size: 13px; font-weight: 600; }
.wallet-type-badge {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  background: rgba(0,212,255,0.1); color: var(--cyan); border: 1px solid rgba(0,212,255,0.2);
}
.wallet-fields { display: grid; grid-template-columns: 1fr; gap: 8px; }
.wallet-field { display: flex; flex-direction: column; gap: 3px; }
.wallet-field-key { font-size: 10px; color: var(--text-3); text-transform: uppercase; }
.wallet-field-val {
  font-family: var(--font-mono); font-size: 11px; color: var(--cyan);
  background: var(--bg-card); padding: 6px 10px; border-radius: 4px;
  display: flex; align-items: center; gap: 6px; cursor: pointer; word-break: break-all;
}
.wallet-field-val:hover { background: var(--bg-hover); }
.wallet-field-val .copy-icon { margin-left: auto; flex-shrink: 0; }
.wallet-field-val.privkey-val { color: var(--orange); }
.wallet-actions { display: flex; gap: 6px; margin-top: 10px; }

/* ══════════ Result Display ══════════ */
.result-success { border-left: 3px solid var(--green); padding-left: 12px; margin-bottom: 14px; }
.result-failed  { border-left: 3px solid var(--red);   padding-left: 12px; margin-bottom: 14px; }
.result-fake    { border-left: 3px solid var(--orange); padding-left: 12px; margin-bottom: 14px; }
.result-error   { border-left: 3px solid var(--red);   padding-left: 12px; margin-bottom: 14px; }
.result-status-text { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.result-fields { display: flex; flex-direction: column; gap: 6px; }
.result-field { display: flex; gap: 10px; align-items: flex-start; }
.result-key { font-size: 11px; color: var(--text-3); min-width: 100px; flex-shrink: 0; padding-top: 1px; }
.result-val { font-family: var(--font-mono); font-size: 12px; color: var(--cyan); word-break: break-all; cursor: pointer; }
.result-val:hover { text-decoration: underline; }
.result-val.warn { color: var(--orange); }
.result-val.err  { color: var(--red); }

/* ══════════ Loading ══════════ */
.loading-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}
.loading-box {
  background: var(--bg-card); border: 1px solid var(--border-l);
  border-radius: var(--radius-lg); padding: 32px 48px;
  text-align: center; box-shadow: var(--shadow-lg);
}
.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--cyan);
  animation: spin 0.8s linear infinite; margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.loading-sub { font-size: 12px; color: var(--text-2); }

/* ══════════ Empty States ══════════ */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-3);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-text { font-size: 14px; margin-bottom: 6px; }
.empty-sub  { font-size: 12px; }

/* ══════════ Toast ══════════ */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 500; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-card2); border: 1px solid var(--border-l);
  border-radius: var(--radius); padding: 10px 16px;
  font-size: 13px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 8px;
  animation: slideIn 0.2s ease; min-width: 260px;
}
.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--red); }
.toast-info    { border-left: 3px solid var(--cyan); }
@keyframes slideIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }

/* ══════════ Misc ══════════ */
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.mono { font-family: var(--font-mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ══════════ Category Colors ══════════ */
.cat-evm-normal  { --card-color: #00ff9d; }
.cat-evm-contract{ --card-color: #a855f7; }
.cat-evm-special { --card-color: #ff4757; }
.cat-cosmos      { --card-color: #00d4ff; }
.cat-utxo        { --card-color: #f7931a; }
.cat-tron        { --card-color: #ff6b35; }
.cat-solana      { --card-color: #9945ff; }

/* ══════════ Responsive ══════════ */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .header-stats { display: none; }
}
@media (max-width: 600px) {
  .scenarios-grid { grid-template-columns: 1fr; }
  .modal { width: 100%; max-width: 100%; margin: 0; border-radius: 0; height: 100%; max-height: 100%; }
}
