/* ============================================================
   SkyStats — styles.css
   ============================================================ */

:root {
  --bg: #0a0c10;
  --surface: #111318;
  --surface2: #181b22;
  --border: #222530;
  --accent: #5bf0a0;
  --accent2: #3dc8ff;
  --accent3: #ff6b6b;
  --accent4: #ffd166;
  --accent5: #c77dff;
  --text: #e8eaf0;
  --muted: #5a5f72;
  --muted2: #8890a8;
}

/* ── Reset ─────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Base ───────────────────────────────────────────────────── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Syne', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background grid */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(91,240,160,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91,240,160,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ─────────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ── Header ─────────────────────────────────────────────────── */
header {
  padding: 32px 24px 24px;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

.logo {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* Watermelon: "Melon" red, "Farming" green */
.logo span:first-child { color: #ff4444; }
.logo span:last-child  { color: var(--accent); }

.logo-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  font-family: 'Space Mono', monospace;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* ── Search ─────────────────────────────────────────────────── */
.search-section {
  padding: 40px 0 32px;
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
}

.search-section .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.search-wrap {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 520px;
}

.search-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Space Mono', monospace;
  font-size: 14px;
  padding: 12px 18px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input::placeholder { color: var(--muted); }
.search-input:focus        { border-color: var(--accent); }

.search-btn {
  background: var(--accent);
  color: #0a0c10;
  border: none;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 12px 24px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.search-btn:hover  { opacity: 0.85; }
.search-btn:active { transform: scale(0.97); }

/* ── Auto-refresh badge ─────────────────────────────────────── */
.auto-refresh-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: 'Space Mono', monospace;
  color: var(--muted2);
  margin-top: 10px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

/* ── Player header ──────────────────────────────────────────── */
.player-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px 0 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.player-avatar {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  border: 2px solid var(--border);
}

.player-name {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -1px;
}

.player-meta {
  font-size: 12px;
  font-family: 'Space Mono', monospace;
  color: var(--muted2);
  margin-top: 4px;
}

.rank-badge {
  display: inline-block;
  font-size: 11px;
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  padding: 2px 8px;
  margin-right: 8px;
  letter-spacing: 1px;
}

.profile-selector {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted2);
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 1px;
}

.profile-btn.active,
.profile-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Section labels ─────────────────────────────────────────── */
.section-label {
  font-size: 11px;
  font-family: 'Space Mono', monospace;
  color: var(--muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Grid ────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 20px;
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 16px;
  color: var(--muted2);
}

/* ── Skills ──────────────────────────────────────────────────── */
.skill-row { margin-bottom: 14px; }

.skill-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
}

.skill-name {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.skill-icon  { font-size: 14px; }

.skill-level {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 700;
}

.skill-xp {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: var(--muted);
}

.progress-track {
  height: 5px;
  background: var(--surface2);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: rgba(255, 255, 255, 0.6);
}

/* ── Slayers ─────────────────────────────────────────────────── */
.slayer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.slayer-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 12px;
  text-align: center;
}

.slayer-icon { font-size: 24px; margin-bottom: 4px; }

.slayer-name {
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.slayer-tier {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.slayer-xp {
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  color: var(--muted2);
  margin-top: 2px;
}

/* ── Dungeons ────────────────────────────────────────────────── */
.dungeon-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.dungeon-stat:last-child { border-bottom: none; }

.dungeon-stat-label {
  font-size: 12px;
  color: var(--muted2);
  font-family: 'Space Mono', monospace;
}

.dungeon-stat-val {
  font-size: 14px;
  font-weight: 700;
  font-family: 'Space Mono', monospace;
}

/* ── Pets ────────────────────────────────────────────────────── */
.pets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}

.pet-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 10px 6px;
  text-align: center;
  transition: border-color 0.15s;
  position: relative;
}

.pet-card:hover { border-color: var(--accent); }

.pet-emoji {
  font-size: 22px;
  display: block;
  margin-bottom: 4px;
}

.pet-name {
  font-size: 9px;
  font-family: 'Space Mono', monospace;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pet-level-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 8px;
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  background: var(--accent);
  color: #0a0c10;
  padding: 1px 4px;
}

/* Pet rarity top borders */
.rarity-COMMON     { border-top: 2px solid #aaa; }
.rarity-UNCOMMON   { border-top: 2px solid #55ff55; }
.rarity-RARE       { border-top: 2px solid #5555ff; }
.rarity-EPIC       { border-top: 2px solid #aa00aa; }
.rarity-LEGENDARY  { border-top: 2px solid #ffaa00; }
.rarity-MYTHIC     { border-top: 2px solid #ff55ff; }

/* ── Collections ─────────────────────────────────────────────── */
.collection-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.collection-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 11px;
  font-family: 'Space Mono', monospace;
}

.collection-name { color: var(--muted2); }
.collection-val  { color: var(--text); font-weight: 700; }

/* ── Loading ──────────────────────────────────────────────────── */
.loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
  gap: 16px;
}

.loader {
  display: flex;
  gap: 6px;
}

.loader span {
  width: 8px;
  height: 8px;
  background: var(--accent);
  animation: bounce 0.9s infinite;
}

.loader span:nth-child(2) { animation-delay: 0.15s; background: var(--accent2); }
.loader span:nth-child(3) { animation-delay: 0.30s; background: var(--accent5); }

.loading-text {
  font-size: 12px;
  font-family: 'Space Mono', monospace;
  color: var(--muted);
  letter-spacing: 2px;
}

/* ── Error ────────────────────────────────────────────────────── */
.error-box {
  background: rgba(255, 107, 107, 0.08);
  border: 1px solid rgba(255, 107, 107, 0.3);
  padding: 16px 20px;
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  color: var(--accent3);
  margin: 20px 0;
}

/* ── Last updated ────────────────────────────────────────────── */
.last-updated {
  text-align: right;
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  color: var(--muted);
  margin-bottom: 24px;
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  color: var(--muted);
  font-size: 13px;
  font-family: 'Space Mono', monospace;
  padding: 20px 0;
  text-align: center;
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}

@keyframes bounce {
  0%, 100% { transform: scaleY(1); }
  50%       { transform: scaleY(2.2); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.4s ease; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 700px) {
  .stats-grid    { grid-template-columns: 1fr; }
  .search-wrap   { flex-direction: column; }
  .player-header { flex-wrap: wrap; }
}

/* ── Status badge ────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 0;
  margin-top: 5px;
  cursor: default;
  border: 1px solid;
  transition: opacity 0.2s;
  display: inline-flex;
}

.status-offline:hover { opacity: 0.75; }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-online {
  color: #5bf0a0;
  border-color: rgba(91, 240, 160, 0.3);
  background: rgba(91, 240, 160, 0.07);
}

.status-online .status-dot {
  background: #5bf0a0;
  box-shadow: 0 0 5px #5bf0a0;
  animation: pulse 2s infinite;
}

.status-offline {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.3);
  background: rgba(255, 107, 107, 0.07);
  cursor: pointer;
}

.status-offline .status-dot {
  background: #ff6b6b;
  box-shadow: 0 0 4px rgba(255, 107, 107, 0.5);
}

/* ── Economy bar ─────────────────────────────────────────────── */
.economy-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px 20px;
  margin-bottom: 24px;
}

.economy-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
}

.economy-stat:first-child { padding-left: 0; }

.economy-label {
  font-size: 11px;
  font-family: 'Space Mono', monospace;
  color: var(--muted2);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.economy-val {
  font-size: 15px;
  font-weight: 800;
  font-family: 'Space Mono', monospace;
}

.economy-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Recent searches ─────────────────────────────────────────── */
.recent-searches {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  max-width: 520px;
  min-height: 28px;
}

.recent-label {
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-right: 2px;
}

.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: var(--muted2);
  padding: 4px 6px 4px 10px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.recent-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.recent-chip-name {
  cursor: pointer;
}

.recent-chip-remove {
  font-size: 13px;
  line-height: 1;
  color: var(--muted);
  padding: 0 2px;
  cursor: pointer;
  transition: color 0.15s;
  border-left: 1px solid var(--border);
  padding-left: 6px;
  margin-left: 2px;
}

.recent-chip-remove:hover {
  color: #ff4444;
}
