/* ==========================================
   RESET & BASE
   ========================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #0a0a0f;
  --bg-card: #12121a;
  --bg-card-hover: #1a1a26;
  --bg-elevated: #16161f;
  --border-subtle: rgba(255,255,255,0.06);
  --border-active: rgba(0, 82, 255, 0.4);
  --text-primary: #f0f0f5;
  --text-secondary: #8a8a9a;
  --text-muted: #55556a;
  --accent: #0052FF;
  --accent-glow: rgba(0, 82, 255, 0.25);
  --accent-soft: rgba(0, 82, 255, 0.1);
  --accent-hover: #003ECB;
  --accent-light: #4D8AFF;
  --success: #22c55e;
  --warning: #f59e0b;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ==========================================
   BACKGROUND EFFECTS
   ========================================== */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(0, 82, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(120, 40, 200, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(0, 82, 255, 0.02) 0%, transparent 70%);
  z-index: -1;
  animation: bgDrift 30s ease-in-out infinite alternate;
}

@keyframes bgDrift {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-2%, -2%) rotate(3deg); }
}

/* Noise overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.025'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: -1;
}

/* ==========================================
   PRELOADER
   ========================================== */
.loader {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.loader.hidden {
  opacity: 0;
  visibility: hidden;
}
.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================
   LAYOUT
   ========================================== */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================
   HEADER / NAV
   ========================================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  gap: 16px;
  flex-wrap: wrap;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex-shrink: 0;
  object-fit: contain;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.logo-text strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.logo-text span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 24px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 6px 32px rgba(0, 82, 255, 0.35);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--accent-soft);
  color: var(--accent-light);
  border-color: transparent;
}

.btn-connect {
  background: linear-gradient(135deg, var(--accent), #003ECB);
  color: #fff;
  border: none;
  padding: 10px 24px;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 24px var(--accent-glow);
}
.btn-connect:hover {
  box-shadow: 0 8px 40px rgba(0, 82, 255, 0.4);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
}

/* ==========================================
   METRIC CARDS (Stats)
   ========================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 32px 0;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
  overflow: hidden;
  transition: all 0.35s ease;
}
.stat-card:hover {
  border-color: rgba(255,255,255,0.1);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.stat-card:hover::before {
  opacity: 1;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 20px;
}
.stat-icon.blue {
  background: var(--accent-soft);
  color: var(--accent-light);
}
.stat-icon.green {
  background: rgba(34,197,94,0.1);
  color: var(--success);
}
.stat-icon.amber {
  background: rgba(245,158,11,0.1);
  color: var(--warning);
}
.stat-icon.purple {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 8px;
  letter-spacing: -1px;
}

.stat-sub {
  font-size: 13px;
  color: var(--text-secondary);
}
.stat-sub strong {
  color: var(--text-primary);
}

/* ==========================================
   ACTION PANEL (4th card)
   ========================================== */
.action-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.badge-label {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  font-family: var(--font-display);
}
.badge-value {
  background: var(--accent-soft);
  color: var(--accent-light);
}
.badge-success {
  background: rgba(34,197,94,0.1);
  color: var(--success);
}

.separator {
  height: 1px;
  background: var(--border-subtle);
}

.balance-display {
  text-align: center;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.balance-display strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-buttons .btn {
  justify-content: center;
  width: 100%;
}

.create-note {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: -4px;
}

/* ==========================================
   TABLE
   ========================================== */
.table-section {
  margin: 16px 0 40px;
}

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

.table-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.table-hint {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border-subtle);
}

.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-responsive {
  overflow-x: auto;
}

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

table thead th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
}

table tbody tr:last-child td {
  border-bottom: none;
}

table tbody tr:hover td {
  background: rgba(255,255,255,0.02);
}

table tbody td:first-child {
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.daily-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: rgba(34,197,94,0.1);
  color: var(--success);
}

.table-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.table-actions .btn {
  padding: 6px 12px;
  font-size: 11px;
}

.empty-table {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-table i {
  font-size: 36px;
  margin-bottom: 12px;
  display: block;
  opacity: 0.3;
}

/* ==========================================
   MODALS
   ========================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  max-width: 460px;
  width: 100%;
  padding: 40px;
  position: relative;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s ease;
}
.modal-close:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.modal-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.modal-text {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 8px;
}

.modal-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
}
.modal-list li {
  position: relative;
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 8px;
}
.modal-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ==========================================
   FOOTER
   ========================================== */
.app-footer {
  text-align: center;
  padding: 32px 0;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 20px;
}

/* ==========================================
   SCROLLBAR
   ========================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ==========================================
   SELECTION
   ========================================== */
::selection { background: var(--accent); color: #fff; }

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
  .app-header { padding: 16px 0; }
  .logo-text strong { font-size: 16px; }
  .logo-text span { display: none; }
  .stat-value { font-size: 28px; }
  .stat-card { padding: 22px; }
  .nav-actions .btn span.btn-label { display: none; }
}

@media (max-width: 480px) {
  .app-container { padding: 0 16px; }
  .stats-grid { gap: 12px; }
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in {
  animation: fadeInUp 0.5s ease forwards;
}
.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }

/* Network badge in header */
.network-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}
.network-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}
.network-dot.connected {
  background: var(--success);
  box-shadow: 0 0 8px rgba(34,197,94,0.5);
}/* Connected button state */
.btn-connect.connected {
  background: rgba(34, 197, 94, 0.1);
  border-color: var(--success);
  color: var(--success);
}

.btn-connect.connected:hover {
  background: rgba(34, 197, 94, 0.15);
  border-color: var(--success);
  transform: translateY(-1px);
}

.btn-connect.connected i {
  color: var(--success);
}

/* Wallet connected group */
.wallet-connected-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wallet-address-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: var(--success);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.wallet-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
  flex-shrink: 0;
}

.btn-disconnect {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.btn-disconnect:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .wallet-connected-group {
    gap: 6px;
  }
  .wallet-address-badge {
    padding: 6px 10px;
    font-size: 11px;
  }
  .btn-disconnect span {
    display: none;
  }
  .btn-disconnect {
    padding: 6px 10px;
  }
}