/* KecleonDEX - GBA/DS Pixel Art Dashboard Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
  /* Pokemon Mystery Dungeon Palette */
  --bg-dungeon: #1a1c2c;
  --bg-panel: #262b44;
  --bg-grass: #3d5a47;
  --grass-light: #4a7c59;
  --stone-dark: #333c57;
  --stone-light: #5a6988;
  --text-white: #f4f4f4;
  --text-gold: #f8d858;
  --text-blue: #5fcde4;
  --text-green: #4ade80;
  --text-red: #ef4444;
  --border-dark: #1a1c2c;
  --border-light: #5a6988;
  --accent-purple: #7c3aed;
  --accent-orange: #f97316;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

body {
  font-family: 'Press Start 2P', cursive;
  font-size: 10px;
  line-height: 2;
  background-color: var(--bg-dungeon);
  color: var(--text-white);
  min-height: 100vh;
  /* Dungeon floor tiling pattern */
  background-image: 
    repeating-linear-gradient(0deg, transparent, transparent 8px, rgba(0,0,0,0.1) 8px, rgba(0,0,0,0.1) 16px),
    repeating-linear-gradient(90deg, transparent, transparent 8px, rgba(0,0,0,0.05) 8px, rgba(0,0,0,0.05) 16px);
}

/* Pixel Borders */
.pixel-border {
  border: 4px solid var(--border-dark);
  box-shadow: 
    inset -4px -4px 0 0 var(--stone-dark),
    inset 4px 4px 0 0 var(--stone-light),
    0 0 0 4px var(--border-dark);
  background: var(--bg-panel);
}

.pixel-border-gold {
  border: 4px solid #8b6914;
  box-shadow: 
    inset -4px -4px 0 0 #c9a227,
    inset 4px 4px 0 0 #f8d858,
    0 0 0 4px #8b6914;
  background: var(--bg-panel);
}

.pixel-border-green {
  border: 4px solid #166534;
  box-shadow: 
    inset -4px -4px 0 0 #15803d,
    inset 4px 4px 0 0 #22c55e,
    0 0 0 4px #166534;
  background: var(--bg-panel);
}

/* Pokemon Dialog Box */
.dialog-box {
  position: relative;
  padding: 20px;
  margin: 16px;
  background: var(--bg-dungeon);
  border: 4px solid var(--text-white);
  box-shadow: 
    inset 0 0 0 4px var(--bg-dungeon),
    inset 0 0 0 8px var(--border-light);
}

.dialog-box.no-indicator::after {
  display: none;
}

.dialog-box::after {
  content: '▼';
  position: absolute;
  bottom: 8px;
  right: 16px;
  animation: bounce 0.5s infinite alternate;
  color: var(--text-white);
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(4px); }
}

/* Typewriter Effect */
.typewriter {
  overflow: hidden;
  border-right: 4px solid var(--text-gold);
  white-space: nowrap;
  animation: typing 2s steps(30), blink 0.5s step-end infinite alternate;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink {
  50% { border-color: transparent; }
}

/* RPG Menu Navigation */
.rpg-menu {
  list-style: none;
  padding: 16px;
  background: var(--bg-dungeon);
}

.rpg-menu li {
  padding: 12px 16px;
  margin: 4px 0;
  cursor: pointer;
  position: relative;
  color: var(--text-white);
  transition: none;
}

.rpg-menu li::before {
  content: '';
  position: absolute;
  left: 0;
  opacity: 0;
}

.rpg-menu li:hover::before,
.rpg-menu li.active::before {
  content: '▶';
  opacity: 1;
  color: var(--text-gold);
  animation: selector-pulse 0.3s infinite alternate;
}

.rpg-menu li:hover,
.rpg-menu li.active {
  color: var(--text-gold);
  padding-left: 24px;
}

@keyframes selector-pulse {
  from { opacity: 1; }
  to { opacity: 0.6; }
}

/* Stat Boxes (HP/EXP Bar Style) */
.stat-box {
  padding: 12px 16px;
  margin: 8px 0;
}

.stat-label {
  font-size: 8px;
  color: var(--text-blue);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 14px;
  color: var(--text-gold);
}

.stat-value.positive { color: var(--text-green); }
.stat-value.negative { color: var(--text-red); }

/* HP/Value Bar */
.value-bar {
  height: 16px;
  background: var(--bg-dungeon);
  border: 2px solid var(--border-light);
  margin-top: 8px;
  position: relative;
  overflow: hidden;
}

.value-bar-fill {
  height: 100%;
  background: var(--text-green);
  transition: width 0.5s steps(10);
}

.value-bar-fill.gold { background: var(--text-gold); }
.value-bar-fill.blue { background: var(--text-blue); }

.value-bar-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 8px;
  color: var(--text-white);
  text-shadow: 1px 1px 0 var(--bg-dungeon);
}

/* Live Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 16px;
}

/* Header */
.game-header {
  background: var(--bg-dungeon);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 4px solid var(--border-light);
}

.logo {
  font-size: 16px;
  color: var(--text-gold);
  text-shadow: 2px 2px 0 var(--border-dark);
}

.logo-sub {
  font-size: 8px;
  color: var(--text-blue);
  margin-top: 4px;
}

/* Layout */
.game-container {
  display: flex;
  min-height: calc(100vh - 80px);
}

.sidebar {
  width: 220px;
  background: var(--bg-dungeon);
  border-right: 4px solid var(--border-light);
  padding-top: 16px;
  flex-shrink: 0;
}

.main-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  max-width: 1200px;
}

/* Kecleon NPC Section */
.kecleon-section {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.kecleon-sprite {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  image-rendering: pixelated;
}

.kecleon-dialog {
  flex: 1;
}

/* Trade Ticker */
.trade-ticker {
  background: var(--bg-dungeon);
  border: 4px solid var(--border-light);
  padding: 12px 16px;
  margin-top: 24px;
  overflow: hidden;
}

.ticker-title {
  font-size: 8px;
  color: var(--text-blue);
  margin-bottom: 8px;
}

.ticker-content {
  display: flex;
  animation: scroll-left 20s linear infinite;
}

.ticker-item {
  white-space: nowrap;
  margin-right: 48px;
  color: var(--text-gold);
}

@keyframes scroll-left {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Portfolio List */
.portfolio-list {
  background: var(--bg-dungeon);
}

.portfolio-item {
  display: grid;
  grid-template-columns: 48px 1fr 100px 100px 80px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border-dark);
  font-size: 8px;
}

.portfolio-item:hover {
  background: var(--bg-panel);
}

.portfolio-item-img {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
}

.portfolio-item-name {
  color: var(--text-white);
}

.portfolio-item-type {
  font-size: 6px;
  color: var(--text-blue);
}

/* Pixel Graph */
.pixel-graph {
  background: var(--bg-dungeon);
  border: 4px solid var(--border-light);
  padding: 16px;
  height: 250px;
  position: relative;
  margin: 24px 0;
}

.graph-grid {
  position: absolute;
  top: 16px;
  left: 60px;
  right: 16px;
  bottom: 30px;
  background-image: 
    repeating-linear-gradient(90deg, var(--border-dark) 0, var(--border-dark) 1px, transparent 1px, transparent 40px),
    repeating-linear-gradient(0deg, var(--border-dark) 0, var(--border-dark) 1px, transparent 1px, transparent 30px);
}

.graph-line {
  position: absolute;
  bottom: 30px;
  left: 60px;
  right: 16px;
  height: calc(100% - 46px);
}

.graph-point {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--text-gold);
  border: 2px solid var(--text-white);
}

.graph-y-axis {
  position: absolute;
  left: 8px;
  top: 16px;
  bottom: 30px;
  width: 50px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 6px;
  color: var(--text-blue);
}

.graph-x-axis {
  position: absolute;
  bottom: 8px;
  left: 60px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  font-size: 6px;
  color: var(--text-blue);
}

/* Adventure Log */
.adventure-log {
  background: var(--bg-dungeon);
  border: 4px solid var(--border-light);
  padding: 16px;
  height: 400px;
  overflow-y: auto;
  font-size: 9px;
}

.log-entry {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-dark);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.log-time {
  color: var(--text-blue);
  font-size: 7px;
  flex-shrink: 0;
}

.log-icon {
  font-size: 12px;
  flex-shrink: 0;
}

.log-text {
  color: var(--text-white);
}

.log-text.action-buy { color: var(--text-green); }
.log-text.action-sell { color: var(--text-gold); }
.log-text.action-critical { color: var(--accent-orange); }

/* Strategy Dialog Sequence */
.dialog-sequence {
  max-width: 600px;
  margin: 0 auto;
}

.dialog-nav {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}

.pixel-btn {
  font-family: 'Press Start 2P', cursive;
  font-size: 8px;
  padding: 12px 20px;
  background: var(--grass-light);
  color: var(--text-white);
  border: none;
  cursor: pointer;
  box-shadow: 
    inset -4px -4px 0 0 #2d4a35,
    inset 4px 4px 0 0 #6ba377;
}

.pixel-btn:hover {
  background: var(--text-green);
}

.pixel-btn:active {
  box-shadow: 
    inset 4px 4px 0 0 #2d4a35,
    inset -4px -4px 0 0 #6ba377;
  transform: translate(2px, 2px);
}

.pixel-btn:disabled {
  background: var(--stone-dark);
  cursor: not-allowed;
}

/* Trainer Card (About Page) */
.trainer-card {
  max-width: 400px;
  margin: 0 auto;
  background: linear-gradient(180deg, #1e3a5f 0%, #0f1c2e 100%);
  padding: 24px;
}

.trainer-card-header {
  text-align: center;
  margin-bottom: 24px;
}

.trainer-card-name {
  font-size: 14px;
  color: var(--text-gold);
}

.trainer-card-title {
  font-size: 8px;
  color: var(--text-blue);
  margin-top: 4px;
}

.trainer-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 24px 0;
}

.trainer-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 24px;
}

.badge {
  width: 32px;
  height: 32px;
  background: var(--text-gold);
  border: 2px solid var(--border-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge.locked {
  background: var(--stone-dark);
  opacity: 0.5;
}

/* Page Transitions */
.page {
  display: none;
  animation: fade-in 0.3s steps(5);
}

.page.active {
  display: block;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Sort/Filter Menu */
.filter-menu {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-btn {
  font-family: 'Press Start 2P', cursive;
  font-size: 7px;
  padding: 8px 12px;
  background: transparent;
  color: var(--text-white);
  border: 2px solid var(--border-light);
  cursor: pointer;
}

.filter-btn:hover,
.filter-btn.active {
  color: var(--text-gold);
  border-color: var(--text-gold);
}

.filter-btn::before {
  content: '▶ ';
  opacity: 0;
}

.filter-btn:hover::before,
.filter-btn.active::before {
  opacity: 1;
}

/* Live Indicator */
.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 8px;
  color: var(--text-green);
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--text-green);
  animation: pulse-live 1s infinite;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Scanlines */
.scanlines::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.1),
    rgba(0,0,0,0.1) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 9999;
}

/* Mobile */
@media (max-width: 768px) {
  body { font-size: 8px; }
  
  .game-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 4px solid var(--border-light);
  }
  
  .rpg-menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 8px;
  }
  
  .rpg-menu li {
    padding: 8px 12px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .portfolio-item {
    grid-template-columns: 40px 1fr;
    gap: 8px;
  }
  
  .portfolio-item > *:nth-child(n+3) {
    display: none;
  }
  
  .kecleon-section {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .main-content {
    padding: 16px;
  }
}
