/* ============================================================
   NEXUSTRACK — Wallet Activity Tracker
   Premium Web3 Dashboard CSS
   ============================================================ */

/* --- Variables --- */
:root {
  --bg: #0a0a0a;
  --surface: #111114;
  --surface2: #16161b;
  --border: rgba(255, 255, 255, 0.07);
  --border-glow: rgba(0, 240, 255, 0.35);

  --primary: #00f0ff;
  --primary-dim: rgba(0, 240, 255, 0.12);
  --accent: #6c5ce7;
  --accent-dim: rgba(108, 92, 231, 0.15);
  --green: #00ffa3;
  --green-dim: rgba(0, 255, 163, 0.12);
  --red: #ff4d6a;
  --red-dim: rgba(255, 77, 106, 0.12);

  --text: #eaeaea;
  --text-muted: #6b7280;
  --text-dim: #333340;

  --font-display: "Syne", sans-serif;
  --font-mono: "Space Mono", monospace;

  --radius: 16px;
  --radius-sm: 8px;
  --shadow: 0 0 40px rgba(0, 240, 255, 0.04), 0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(0, 240, 255, 0.18);

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Animated Background --- */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.025) 1px, transparent 1px);
  background-size: 60px 60px;
  z-index: 0;
  pointer-events: none;
}
#particleCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

/* --- Header --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary-dim);
  border: 1px solid var(--border-glow);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--primary);
  font-size: 16px;
}
.logo-text {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--text);
}
.logo-accent {
  color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.network-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  display: inline-block;
  position: relative;
}
.pulse-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  background: var(--green);
  border-radius: 50%;
  opacity: 0.3;
  animation: pulseDot 2s ease-in-out infinite;
}
@keyframes pulseDot {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* --- Icon Buttons --- */
.icon-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-display);
  transition: var(--transition);
}
.icon-btn:hover {
  color: var(--primary);
  border-color: var(--border-glow);
  background: var(--primary-dim);
}
.icon-btn.active {
  color: var(--primary);
  border-color: var(--border-glow);
  background: var(--primary-dim);
}
.icon-btn.spin i {
  animation: spin 0.7s linear;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.icon-btn-sm {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  text-decoration: none;
  transition: var(--transition);
}
.icon-btn-sm:hover {
  color: var(--primary);
  border-color: var(--border-glow);
  background: var(--primary-dim);
}

/* --- Main Wrapper --- */
.main-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* --- Search Section --- */
.search-section {
  padding: 80px 0 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.search-hero {
  width: 100%;
  max-width: 720px;
  text-align: center;
}
.hero-title {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 16px;
}
.gradient-text {
  background: linear-gradient(120deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 36px;
  font-weight: 400;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 6px 6px 18px;
  gap: 12px;
  transition: var(--transition);
}
.search-bar:focus-within {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}
.search-icon {
  color: var(--text-muted);
  font-size: 15px;
  flex-shrink: 0;
}
#walletInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 10px 0;
  min-width: 0;
}
#walletInput::placeholder {
  color: var(--text-dim);
}

.track-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: var(--primary);
  color: #000;
  border: none;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}
.track-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity 0.2s;
}
.track-btn:hover {
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.5);
  transform: translateY(-1px);
}
.track-btn:active::after {
  opacity: 0.15;
}
.track-btn:active {
  transform: scale(0.97);
}
.track-btn.loading .btn-text {
  opacity: 0.6;
}

.input-error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--red);
  font-size: 13px;
}
.input-error i {
  font-size: 12px;
}

/* --- Dashboard --- */
.dashboard {
  animation: fadeInUp 0.5s ease both;
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.hidden {
  display: none !important;
}

/* --- Skeleton Loaders --- */
.skeleton-layer {
  padding-bottom: 40px;
}
.sk-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.sk-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.sk-card.chart-sk {
  grid-column: span 2;
}
.sk-line {
  height: 14px;
  background: linear-gradient(
    90deg,
    var(--surface2) 25%,
    var(--text-dim) 50%,
    var(--surface2) 75%
  );
  background-size: 200% 100%;
  border-radius: 4px;
  margin-bottom: 12px;
  animation: shimmer 1.5s infinite;
}
.sk-line.short {
  width: 50%;
}
.sk-chart-placeholder {
  height: 160px;
  background: linear-gradient(
    90deg,
    var(--surface2) 25%,
    var(--text-dim) 50%,
    var(--surface2) 75%
  );
  background-size: 200% 100%;
  border-radius: 8px;
  margin-top: 16px;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  transition: var(--transition);
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--border-glow),
    transparent
  );
  opacity: 0;
  transition: opacity 0.3s;
}
.card:hover {
  border-color: rgba(0, 240, 255, 0.15);
  box-shadow:
    0 0 30px rgba(0, 240, 255, 0.06),
    0 8px 32px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}
.card:hover::before {
  opacity: 1;
}

.card-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
}

/* --- Overview Row --- */
.overview-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.wallet-card {
  background: linear-gradient(
    135deg,
    var(--surface) 0%,
    rgba(0, 240, 255, 0.03) 100%
  );
}
.wallet-address-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.wallet-addr {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-muted);
}
.wallet-balance {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.balance-val {
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.balance-unit {
  font-size: 16px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.wallet-usd {
  display: flex;
  align-items: center;
  gap: 10px;
}
.usd-val {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-muted);
}
.pct {
  font-size: 13px;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: 4px;
}
.pct.positive {
  background: var(--green-dim);
  color: var(--green);
}
.pct.negative {
  background: var(--red-dim);
  color: var(--red);
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-dim);
  border: 1px solid var(--border-glow);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--primary);
  font-size: 15px;
}
.stat-icon.green {
  background: var(--green-dim);
  border-color: rgba(0, 255, 163, 0.25);
  color: var(--green);
}
.stat-icon.purple {
  background: var(--accent-dim);
  border-color: rgba(108, 92, 231, 0.3);
  color: var(--accent);
}
.stat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.stat-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-sub {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* --- Charts Row --- */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.chart-card {
  display: flex;
  flex-direction: column;
}
.wide-chart {
  /* already wider via grid */
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title i {
  color: var(--primary);
}

.chart-tabs {
  display: flex;
  gap: 4px;
}
.chart-tab {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: var(--transition);
}
.chart-tab.active {
  background: var(--primary-dim);
  border-color: var(--border-glow);
  color: var(--primary);
}

.chart-wrap {
  flex: 1;
  position: relative;
  min-height: 180px;
}
.pie-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.pie-wrap canvas {
  max-height: 160px;
}
.pie-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-pct {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
}

/* --- Transaction Table --- */
.tx-card {
  padding: 0;
  overflow: visible;
}
.tx-card .card-header {
  padding: 20px 24px 0;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

.tx-filter {
  display: flex;
  gap: 6px;
}
.filter-btn {
  padding: 5px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-display);
  transition: var(--transition);
}
.filter-btn.active {
  background: var(--primary-dim);
  border-color: var(--border-glow);
  color: var(--primary);
}

.tx-table-wrap {
  overflow-x: auto;
}
.tx-table {
  width: 100%;
  border-collapse: collapse;
}
.tx-table thead th {
  padding: 12px 20px;
  text-align: left;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tx-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition:
    background 0.2s,
    transform 0.2s;
  cursor: default;
}
.tx-table tbody tr:hover {
  background: rgba(0, 240, 255, 0.03);
}
.tx-table tbody tr:last-child {
  border-bottom: none;
}
.tx-table td {
  padding: 14px 20px;
  font-size: 13px;
  white-space: nowrap;
}
.tx-hash {
  font-family: var(--font-mono);
  color: var(--primary);
  text-decoration: none;
  font-size: 12px;
  transition: color 0.2s;
}
.tx-hash:hover {
  color: #fff;
  text-decoration: underline;
}

.tx-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.tx-type.send {
  background: var(--red-dim);
  color: var(--red);
}
.tx-type.receive {
  background: var(--green-dim);
  color: var(--green);
}

.tx-amount {
  font-family: var(--font-mono);
  font-size: 13px;
}
.tx-amount.send {
  color: var(--red);
}
.tx-amount.receive {
  color: var(--green);
}

.tx-addr {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.tx-time {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.tx-link {
  color: var(--text-dim);
  font-size: 12px;
  text-decoration: none;
  transition: color 0.2s;
}
.tx-link:hover {
  color: var(--primary);
}

.tx-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px;
  color: var(--text-dim);
  gap: 12px;
}
.tx-empty i {
  font-size: 28px;
}

/* --- Toast --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.3s ease both;
  pointer-events: all;
  min-width: 220px;
  max-width: 320px;
}
.toast.success {
  border-color: rgba(0, 255, 163, 0.3);
}
.toast.success i {
  color: var(--green);
}
.toast.error {
  border-color: rgba(255, 77, 106, 0.3);
}
.toast.error i {
  color: var(--red);
}
.toast.info {
  border-color: var(--border-glow);
}
.toast.info i {
  color: var(--primary);
}
.toast.hiding {
  animation: toastOut 0.3s ease both;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(30px);
  }
}

/* --- Footer --- */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  display: flex;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
}

/* ---- Responsiveness ---- */
@media (max-width: 1100px) {
  .overview-row {
    grid-template-columns: 1fr 1fr;
  }
  .wallet-card {
    grid-column: span 2;
  }
  .charts-row {
    grid-template-columns: 1fr 1fr;
  }
  .wide-chart {
    grid-column: span 2;
  }
  .sk-row {
    grid-template-columns: 1fr 1fr;
  }
  .sk-card.chart-sk {
    grid-column: span 1;
  }
}
@media (max-width: 700px) {
  .header-inner {
    padding: 0 16px;
  }
  .main-wrapper {
    padding: 0 16px 60px;
  }
  .hero-title {
    font-size: 32px;
  }
  .search-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
  }
  .track-btn {
    justify-content: center;
  }
  .overview-row {
    grid-template-columns: 1fr;
  }
  .wallet-card {
    grid-column: span 1;
  }
  .charts-row {
    grid-template-columns: 1fr;
  }
  .wide-chart {
    grid-column: span 1;
  }
  .sk-row {
    grid-template-columns: 1fr;
  }
  .tx-table thead th:nth-child(4) {
    display: none;
  }
  .tx-table td:nth-child(4) {
    display: none;
  }
  .footer {
    flex-direction: column;
    gap: 4px;
  }
  .btn-label {
    display: none;
  }
}
