/* ========================================================================
   WinnerCircle — Terminal Pro Theme
   ======================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

:root {
  --bg: #000000;
  --bg-card: #0a0a0a;
  --bg-input: #111;
  --border: #1a2e1a;
  --border-bright: #2a4a2a;
  --text: #c0c0c0;
  --text-muted: #555;
  --green: #39ff14;
  --green-dim: rgba(57,255,20,0.1);
  --red: #ff3b3b;
  --red-dim: #7a1a1a;
  --amber: #ffb700;
  --accent: #39ff14;
  --accent-hover: #2ecc0f;
  --gold: #ffb700;
  --radius: 4px;
  --font: 'IBM Plex Mono', monospace;
  --mono: 'IBM Plex Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
}
/* Scanline overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.15) 2px,
    rgba(0,0,0,0.15) 4px
  );
  pointer-events: none;
  z-index: 1000;
}

/* Header */
header {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 6px;
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(57,255,20,0.3), 0 0 40px rgba(57,255,20,0.1);
}
header .cursor {
  display: inline-block;
  width: 12px;
  height: 1.8rem;
  background: var(--green);
  margin-left: 4px;
  vertical-align: middle;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.tagline {
  color: var(--text-muted);
  font-size: .85rem;
  margin-top: .5rem;
}
.tagline::before { content: '> '; color: var(--green); }
.last-updated {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .5rem;
}
.last-updated::before { content: '['; color: var(--border-bright); }
.last-updated::after { content: ']'; color: var(--border-bright); }

/* Main */
main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  position: relative;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  opacity: 0.3;
}
.card h2 {
  font-size: .85rem;
  margin-bottom: .75rem;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
}
.card h2::before { content: '// '; color: var(--text-muted); }

/* Buttons */
.btn {
  padding: .55rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: .85rem;
  font-family: var(--font);
  transition: all .15s;
  text-decoration: none;
  text-transform: uppercase;
}
.btn-primary { background: var(--green-dim); color: var(--green); border-color: var(--green); }
.btn-primary:hover { background: var(--accent); color: #000; }
.btn-danger { background: transparent; color: var(--red); border-color: var(--red); font-size: .75rem; padding: .3rem .6rem; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-copy { background: var(--green-dim); color: var(--green); border-color: var(--green); font-size: .75rem; padding: .3rem .6rem; font-weight: 600; text-decoration: none; }
.btn-copy:hover { background: var(--accent); color: #000; }

/* Wallet Chips */
.wallet-list {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.wallet-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .3rem .75rem;
  font-size: .8rem;
}
.wallet-chip::before { content: '$'; color: var(--green); margin-right: 2px; }

.error {
  color: var(--red);
  font-size: .85rem;
  margin-top: .4rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}
.tab {
  padding: .45rem 1rem;
  border: 1px solid var(--border);
  border-right: none;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  font-size: .8rem;
  font-family: var(--font);
  font-weight: 500;
  transition: all .15s;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.tab:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.tab:last-child { border-right: 1px solid var(--border); border-radius: 0 var(--radius) var(--radius) 0; }
.tab:hover { color: var(--green); border-color: var(--border-bright); }
.tab.active {
  background: var(--green-dim);
  color: var(--green);
  border-color: var(--green);
  text-shadow: 0 0 8px rgba(57,255,20,0.3);
}

/* Sort Bar */
.sort-bar {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .75rem;
  color: var(--text-muted);
  font-size: .8rem;
  flex-wrap: wrap;
}
.sort-btn {
  padding: .3rem .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .75rem;
  font-family: var(--font);
  transition: all .15s;
  text-transform: uppercase;
}
.sort-btn:hover { border-color: var(--green); color: var(--text); }
.sort-btn.active { border-color: var(--green); color: var(--green); font-weight: 600; }

/* Table */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: .6rem .7rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: .82rem;
}
th {
  color: var(--green);
  font-weight: 600;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--green-dim);
  border-bottom: 1px solid var(--border-bright);
}
tbody tr {
  cursor: pointer;
  transition: background .12s;
}
tbody tr:hover { background: rgba(57,255,20,0.04); }

.rank-cell { font-weight: 700; font-size: 1rem; }
.rank-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  font-size: .85rem;
  font-weight: 700;
}
.rank-box.first { border-color: var(--amber); color: var(--amber); background: rgba(255,183,0,0.08); }
.trophy { font-size: 1.1rem; }
.profit { color: var(--green); font-weight: 600; }
.loss { color: var(--red); font-weight: 600; }
.neutral { color: var(--text-muted); }
.trader-name { font-weight: 600; color: #e0e0e0; }
.trader-top { color: var(--amber); text-shadow: 0 0 8px rgba(255,183,0,0.3); }
td:nth-child(2), th:nth-child(2) { min-width: 140px; }

/* Live indicator */
.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  margin-right: 6px;
  animation: pulse 2s ease-in-out infinite;
  box-shadow: 0 0 6px var(--green);
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-content {
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute;
  top: .5rem;
  right: .75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  font-family: var(--font);
}
.modal-close:hover { color: var(--green); }

.detail-header {
  margin-bottom: 1rem;
}
.detail-header h2 { margin-bottom: .25rem; color: #e0e0e0; }
.detail-header .address {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--text-muted);
  word-break: break-all;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.stat-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem;
  text-align: center;
}
.stat-box .label {
  font-size: .65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
}
.stat-box .value {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: .15rem;
}

.detail-section { margin-bottom: 1rem; }
.detail-section h3 {
  font-size: .8rem;
  color: var(--green);
  margin-bottom: .5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.detail-section h3::before { content: '// '; color: var(--text-muted); }

.trade-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .5rem .5rem;
  border-bottom: 1px solid var(--border);
  font-size: .82rem;
  gap: .5rem;
  flex-wrap: wrap;
}
.trade-row:last-child { border-bottom: none; }
.trade-market {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trade-meta { color: var(--text-muted); font-size: .75rem; white-space: nowrap; }

/* Feed */
.feed-badge {
  font-size: .7rem;
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green);
  padding: .15rem .45rem;
  border-radius: var(--radius);
  font-weight: 600;
  vertical-align: middle;
}
.feed-controls { display: flex; align-items: center; gap: 1.5rem; margin-bottom: .75rem; flex-wrap: wrap; }
.feed-filter, .feed-sort { display: flex; align-items: center; gap: .5rem; }
.feed-filter label, .feed-sort label { color: var(--text-muted); font-size: .8rem; }
.feed-filter select {
  background: var(--bg-input); color: var(--text); border: 1px solid var(--border);
  padding: .3rem .5rem; border-radius: var(--radius); font-size: .8rem; font-family: var(--font);
}
.feed-list { display: flex; flex-direction: column; }
.feed-header, .feed-item {
  display: grid;
  grid-template-columns: 160px 1fr 100px 100px 80px 80px 50px;
  align-items: center;
  gap: .25rem;
  padding: .5rem .25rem;
  white-space: nowrap;
  font-size: .82rem;
}
.feed-header {
  font-size: .65rem;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border-bright);
  padding-bottom: .4rem;
  background: var(--green-dim);
}
.feed-item { border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: none; }
.feed-item:hover { background: rgba(57,255,20,0.03); }
.feed-trader { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.feed-trader-top { color: var(--amber); text-shadow: 0 0 8px rgba(255,183,0,0.3); }
.feed-market { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.feed-market a { color: var(--text); text-decoration: none; }
.feed-market a:hover { color: var(--green); }
.feed-cell { text-align: right; font-size: .8rem; }
.feed-time { color: var(--text-muted); font-size: .7rem; text-align: right; }
.feed-pagination {
  display: flex; justify-content: center; align-items: center; gap: .75rem;
  padding: .75rem 0 .25rem; font-size: .8rem;
}
.feed-pagination button {
  background: var(--bg-card); color: var(--text); border: 1px solid var(--border);
  padding: .35rem .75rem; border-radius: var(--radius); cursor: pointer; font-size: .8rem;
  font-family: var(--font); text-transform: uppercase;
}
.feed-pagination button:hover { border-color: var(--green); color: var(--green); }
.feed-pagination button:disabled { opacity: .4; cursor: default; border-color: var(--border); color: var(--text-muted); }
.feed-pagination span { color: var(--text-muted); }

/* Empty / Loading */
.empty-msg {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 0;
}
.loading {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-muted);
}

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: .75rem;
  border-top: 1px solid var(--border);
}
footer p::before { content: '> '; color: var(--green); }

/* Responsive */
@media (max-width: 640px) {
  header h1 { font-size: 1.5rem; letter-spacing: 3px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  th, td { padding: .5rem .4rem; font-size: .75rem; }
  .feed-header, .feed-item {
    grid-template-columns: 130px 1fr 100px 100px 70px 70px 45px;
    font-size: .75rem;
  }
}
