/* 🪐 SOLANA COLOR ENGINE VARIABLES */
:root {
  --bg-base: #0a0b10;
  --bg-surface: #121420;
  --bg-card: #1a1d30;
  --border-color: rgba(153, 69, 255, 0.15);
  --border-hover: rgba(20, 241, 149, 0.4);
  
  --solana-purple: #9945FF;
  --solana-green: #14F195;
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* 🧊 RESET & BASE LAYOUT */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* 🖥️ HEADER LOGIC */
header {
  background: linear-gradient(180deg, rgba(18, 20, 32, 0.8) 0%, transparent 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  background: linear-gradient(45deg, var(--text-main) 30%, var(--solana-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 🧬 GLOBAL WALLET / CONFIG HEADERS */
.controls-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-surface);
  padding: 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

input[type="text"] {
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 0.5rem;
  font-family: inherit;
  width: 260px;
  outline: none;
}

input[type="text"]::placeholder {
  color: var(--text-muted);
}

button {
  background: linear-gradient(135deg, var(--solana-purple), #7a22e0);
  border: none;
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(153, 69, 255, 0.4);
}

button:disabled {
  background: #2e3142;
  color: var(--text-muted);
  cursor: not-allowed;
}

/* 📊 DASHBOARD STAT CARDS */
.ecosystem-dashboard {
  display: flex;
  gap: 1rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-weight: 700;
  font-size: 0.95rem;
}

.text-gradient-green { color: var(--solana-green); }
.text-gradient-purple { color: #b77eff; }

.pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background-color: var(--solana-green);
  border-radius: 50%;
  margin-right: 4px;
  box-shadow: 0 0 8px var(--solana-green);
  animation: pulse 2s infinite;
}

/* 🏢 MAIN APP CONTAINER GRID */
#app {
  flex: 1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
  padding: 2rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.simulation-stage, .leaderboard-stage {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* 🎨 CANVAS INTERFACES */
.canvas-wrapper {
  background: var(--bg-surface);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

canvas {
  background: #111218;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

#cityCanvas {
  position: relative;
  z-index: 10; /* Forces the canvas to sit on top of all background wrappers */
  display: block;
}

/* 📋 CONTAINERS AND SIDEBAR WRAPPERS */
.panel-card, .inspection-panel, .stats-panel {
  background: var(--bg-surface);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  padding: 1.5rem;
}

.inspection-panel h3, .panel-card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.muted {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* 🏆 SCROLLABLE LEADERBOARD CONFIGURATIONS */
.table-wrapper {
  max-height: 280px;
  overflow-y: auto;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255,255,255,0.03);
}

/* Custom Scrollbars */
.table-wrapper::-webkit-scrollbar {
  width: 6px;
}
.table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.table-wrapper::-webkit-scrollbar-thumb {
  background: var(--bg-card);
  border-radius: 10px;
}
.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--solana-purple);
}

/* 👥 LEADERBOARD DATA ROWS */
ul {
  list-style: none;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  cursor: pointer;
  transition: all 0.15s ease;
}

.leaderboard-item:hover {
  background: rgba(153, 69, 255, 0.05);
  border-left: 3px solid var(--solana-purple);
  padding-left: calc(1rem - 3px);
}

.leaderboard-item.active {
  background: rgba(20, 241, 149, 0.05);
  border-left: 3px solid var(--solana-green);
  padding-left: calc(1rem - 3px);
}

.player-rank {
  font-weight: 800;
  width: 35px;
  color: var(--solana-purple);
  font-size: 0.9rem;
}

.leaderboard-item:nth-child(1) .player-rank { color: #ffd700; }
.leaderboard-item:nth-child(2) .player-rank { color: #c0c0c0; }
.leaderboard-item:nth-child(3) .player-rank { color: #cd7f32; }

.player-info {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.9rem;
}

.player-address {
  font-family: monospace;
  font-weight: 600;
}

.player-score {
  color: var(--solana-green);
  font-weight: 700;
}

.loading-state {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* 📌 FOOTER BOUNDS */
footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

/* 🎥 ANIMATIONS */
@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(20, 241, 149, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(20, 241, 149, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(20, 241, 149, 0); }
}

/* 📱 RESPONSIVE ADAPTATIONS */
@media (max-width: 900px) {
  #app {
    grid-template-columns: 1fr;
  }
}