/* Poki Ranking page styles - dark theme matching analytics */
:root {
  --bg: #0f1923;
  --card: #1a2736;
  --card-border: #2a3a4a;
  --text: #e0e6ed;
  --text-muted: #8899aa;
  --accent: #00d4aa;
  --accent2: #667eea;
  --red: #ff6b6b;
  --orange: #ffa94d;
  --green: #51cf66;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
}

.content {
  padding: 24px 30px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Category tabs */
.category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.cat-btn {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.cat-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.cat-btn.active {
  background: var(--accent);
  color: #0f1923;
  border-color: var(--accent);
}

/* Split view */
.split-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Ranking Table */
.ranking-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.ranking-table thead th {
  background: #15202c;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px;
  text-align: center;
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.ranking-table tbody tr {
  border-bottom: 1px solid rgba(42, 58, 74, 0.5);
  transition: background 0.15s;
}

.ranking-table tbody tr:hover {
  background: rgba(0, 212, 170, 0.05);
}

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

.ranking-table td {
  padding: 6px 10px;
  vertical-align: middle;
}

/* Rank cell */
.rank-cell {
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
}

.rank-cell .rank-num {
  display: block;
}

.rank-cell .rank-change {
  font-size: 10px;
  font-weight: 600;
  margin-top: 1px;
}

.rank-change.up {
  color: var(--green);
}

.rank-change.down {
  color: var(--red);
}

.rank-change.same {
  color: var(--text-muted);
  font-size: 10px;
}

/* Top 3 styling */
.ranking-table tbody tr:nth-child(1) .rank-cell .rank-num,
.ranking-table tbody tr:nth-child(2) .rank-cell .rank-num,
.ranking-table tbody tr:nth-child(3) .rank-cell .rank-num {
  color: var(--accent);
  font-size: 16px;
}

/* Game cell */
.game-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
}

.game-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.game-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.game-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s;
}

.game-title:hover {
  color: var(--accent);
}

.game-developer {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
  white-space: nowrap;
}

.badge-trending {
  background: rgba(255, 169, 77, 0.15);
  color: var(--orange);
}

.badge-tile-3x3 {
  background: rgba(255, 107, 107, 0.15);
  color: var(--red);
}

.badge-tile-2x2 {
  background: rgba(102, 126, 234, 0.15);
  color: var(--accent2);
}

/* Our games highlight */
.ranking-table tbody tr.our-game {
  background: rgba(0, 212, 170, 0.08);
  border-left: 3px solid var(--accent);
}

.ranking-table tbody tr.our-game:hover {
  background: rgba(0, 212, 170, 0.12);
}

/* Loading */
#loading {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
  font-size: 16px;
}

.hidden {
  display: none !important;
}

/* Chart modal */
.chart-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.chart-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  width: 90%;
  max-width: 720px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.chart-game-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chart-game-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg);
}

.chart-game-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.chart-game-cat {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}

.chart-close:hover {
  color: var(--text);
}

.chart-container {
  height: 320px;
}

/* Responsive */
@media (max-width: 900px) {
  .split-view {
    grid-template-columns: 1fr;
  }
  .content {
    padding: 16px;
  }
  .game-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
  }
  .ranking-table td, .ranking-table thead th {
    padding: 6px 8px;
  }
}
