/* ============================================================
   BOT-RANK · PANEL STYLES
   Aesthetic: Dark Command Center — refined, data-dense, sharp
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Base */
  --bg:        #0d0e12;
  --bg1:       #13141a;
  --bg2:       #1a1b23;
  --bg3:       #21222d;
  --bg4:       #2a2b38;
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.12);

  /* Accent */
  --accent:    #7c6dfa;
  --accent2:   #5a4fcf;
  --accentRgb: 124,109,250;
  --gold:      #f5c842;
  --silver:    #a8b2c0;
  --bronze:    #cd7f32;
  --green:     #3ecf8e;
  --red:       #f87171;
  --cyan:      #38bdf8;

  /* Text */
  --txt:       #e2e4f0;
  --txt2:      #8b8fa8;
  --txt3:      #555770;
  --bright:    #ffffff;

  /* Sizes */
  --sidebar-w: 220px;
  --header-h:  56px;
  --r:         8px;
  --r2:        12px;
  --trans:     0.18s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--txt);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent2); }

/* ── LOGIN SCREEN ────────────────────────────────────────── */
#login-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}

#login-screen::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 60% at 60% 20%, rgba(124,109,250,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 10% 80%, rgba(62,207,142,0.05) 0%, transparent 60%);
}

.login-card {
  width: 360px;
  background: var(--bg1);
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  padding: 40px 36px;
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4), 0 0 0 1px var(--border);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.login-logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 20px rgba(var(--accentRgb),0.4);
}

.login-logo-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--bright);
  letter-spacing: -0.02em;
}

.login-logo-sub {
  font-size: 11px;
  color: var(--txt3);
  font-family: 'JetBrains Mono', monospace;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--bright);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.login-sub {
  font-size: 13px;
  color: var(--txt2);
  margin-bottom: 28px;
}

.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--txt2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  color: var(--txt);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: var(--trans);
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accentRgb),0.15);
}

.form-input::placeholder { color: var(--txt3); }

.login-error {
  font-size: 12px;
  color: var(--red);
  min-height: 18px;
  margin-bottom: 8px;
}

.btn-primary {
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--trans);
  letter-spacing: 0.01em;
}

.btn-primary:hover { background: #8e80fb; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── APP LAYOUT ──────────────────────────────────────────── */
#app {
  display: none;
  flex-direction: column;
  height: 100vh;
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  height: var(--header-h);
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 8px;
}

.topbar-icon {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.topbar-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--bright);
  letter-spacing: -0.01em;
}

.topbar-season {
  font-size: 12px;
  color: var(--txt3);
  font-family: 'JetBrains Mono', monospace;
  margin-left: 4px;
}

.topbar-guild {
  font-size: 11px;
  color: var(--txt3);
  font-family: 'JetBrains Mono', monospace;
  margin-left: auto;
}

.btn-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--txt2);
  cursor: pointer;
  font-size: 14px;
  transition: var(--trans);
}

.btn-icon:hover { background: var(--bg3); color: var(--txt); }

.btn-logout {
  margin-left: 8px;
  padding: 6px 14px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: transparent;
  color: var(--txt2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--trans);
}

.btn-logout:hover { border-color: var(--red); color: var(--red); }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--txt2);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg1);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
  padding: 12px 8px;
}

.nav-section {
  margin-bottom: 4px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--txt3);
  padding: 8px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r);
  color: var(--txt2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: var(--trans);
  margin-bottom: 1px;
  user-select: none;
}

.nav-item:hover {
  background: var(--bg3);
  color: var(--txt);
}

.nav-item.active {
  background: rgba(var(--accentRgb), 0.12);
  color: var(--accent);
}

.nav-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-label { flex: 1; }

.nav-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
}

.nav-badge.green { background: var(--green); color: #000; }

/* ── PAGE AREA ───────────────────────────────────────────── */
.pages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.page { display: none; }
.page.active { display: block; }

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--bright);
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.page-sub {
  font-size: 13px;
  color: var(--txt2);
}

/* ── KPI GRID ────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 18px 20px;
  transition: var(--trans);
}

.kpi-card:hover {
  border-color: var(--border2);
  transform: translateY(-1px);
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--txt3);
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--bright);
  letter-spacing: -0.02em;
  line-height: 1;
  font-family: 'JetBrains Mono', monospace;
}

.kpi-value.accent { color: var(--accent); }
.kpi-value.gold   { color: var(--gold); }

.kpi-meta {
  font-size: 11px;
  color: var(--txt2);
  margin-top: 6px;
  font-family: 'JetBrains Mono', monospace;
}

/* ── 2-COL LAYOUT ────────────────────────────────────────── */
.col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 900px) { .col-grid { grid-template-columns: 1fr; } }

/* ── CARD ────────────────────────────────────────────────── */
.card {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 20px;
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--txt3);
  margin-bottom: 16px;
}

/* ── RANK ROWS ───────────────────────────────────────────── */
.rank-list { display: flex; flex-direction: column; gap: 6px; }

.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: var(--trans);
  animation: fadeUp 0.3s both;
}

.rank-row:hover { border-color: var(--border2); background: var(--bg3); }
.rank-row.top   { border-color: rgba(var(--accentRgb),0.15); }

.rank-pos {
  font-size: 14px;
  min-width: 28px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--txt2);
}

.rank-pos.gold   { color: var(--gold); }
.rank-pos.silver { color: var(--silver); }
.rank-pos.bronze { color: var(--bronze); }

.rank-name {
  flex: 1;
  font-weight: 500;
  color: var(--txt);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-meta {
  font-size: 11px;
  color: var(--txt3);
  font-family: 'JetBrains Mono', monospace;
}

.rank-bar-wrap {
  width: 80px;
  height: 4px;
  background: var(--bg4);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.rank-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

.rank-pts {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--txt);
  min-width: 70px;
  text-align: right;
}

/* ── EVENTO ACTIVO ───────────────────────────────────────── */
.ev-active-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green);
  background: rgba(62,207,142,0.1);
  border: 1px solid rgba(62,207,142,0.2);
  border-radius: 4px;
  padding: 3px 8px;
  margin-bottom: 8px;
}

.ev-active-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.5s infinite;
}

.ev-active-badge.lg { font-size: 11px; }

.ev-active-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--bright);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.ev-active-meta { font-size: 12px; color: var(--txt2); font-family: 'JetBrains Mono', monospace; }

.ev-inactive {
  color: var(--txt3);
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--txt3);
}

.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--txt2); margin-bottom: 6px; }
.empty-sub { font-size: 13px; }

/* ── HISTORIAL CARDS ─────────────────────────────────────── */
.hist-card {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  margin-bottom: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: var(--trans);
  animation: fadeUp 0.3s both;
}

.hist-card:hover { border-color: var(--border2); }

.hist-card-top {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  gap: 12px;
}

.hist-info { flex: 1; min-width: 0; }

.hist-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--txt);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-meta { font-size: 11px; color: var(--txt3); font-family: 'JetBrains Mono', monospace; }

.hist-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.hist-pts {
  font-size: 13px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--txt2);
}

.badge-global {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  background: rgba(var(--accentRgb),0.15);
  color: var(--accent);
  border-radius: 4px;
}

.hist-chevron { color: var(--txt3); font-size: 18px; }

.hist-detail {
  padding: 0 18px 14px;
  border-top: 1px solid var(--border);
}

.hist-player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--txt);
}

.hist-player-row:last-child { border-bottom: none; }

.rank-pos-sm {
  font-size: 13px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.hist-player-pts {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--txt2);
}

.loading-inline {
  text-align: center;
  color: var(--txt3);
  font-size: 12px;
  padding: 12px 0;
  font-family: 'JetBrains Mono', monospace;
}

.empty-inline { color: var(--txt3); font-size: 12px; padding: 8px 0; }

/* ── PODIO ───────────────────────────────────────────────── */
.podio {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
  padding: 24px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--r2);
}

.podio-slot {
  text-align: center;
  flex: 1;
  max-width: 160px;
  position: relative;
}

.podio-slot.pos-1 .podio-bar { height: 80px; background: linear-gradient(0deg, var(--gold), rgba(245,200,66,0.3)); }
.podio-slot.pos-2 .podio-bar { height: 55px; background: linear-gradient(0deg, var(--silver), rgba(168,178,192,0.3)); }
.podio-slot.pos-3 .podio-bar { height: 38px; background: linear-gradient(0deg, var(--bronze), rgba(205,127,50,0.3)); }

.podio-bar { width: 100%; border-radius: 6px 6px 0 0; margin-top: 10px; }

.podio-avatar { font-size: 28px; margin-bottom: 6px; }
.podio-name { font-size: 13px; font-weight: 600; color: var(--txt); margin-bottom: 2px; }
.podio-pts { font-size: 13px; font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--bright); }
.podio-events { font-size: 11px; color: var(--txt3); }

/* ── TREND CHART ─────────────────────────────────────────── */
.trend-wrap {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 20px;
  margin-bottom: 20px;
}

.trend-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--txt2);
}

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

.trend-dot-sm {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.trend-svg {
  width: 100%;
  height: 180px;
  display: block;
}

.trend-dates {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--txt3);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 8px;
}

/* ── SECTION HEADER BLOCK ────────────────────────────────── */
.section-header-block { margin-bottom: 20px; }

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--bright);
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.section-sub { font-size: 12px; color: var(--txt2); font-family: 'JetBrains Mono', monospace; }

/* ── DIVIDER ─────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ── RANKING PAGE HEADER ─────────────────────────────────── */
.ranking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.ranking-count {
  font-size: 12px;
  color: var(--txt3);
  font-family: 'JetBrains Mono', monospace;
}

/* ── ANIMATIONS ──────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── MOBILE ──────────────────────────────────────────────── */
@media (max-width: 680px) {
  .menu-toggle { display: block; }
  .topbar-season, .topbar-guild { display: none; }

  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: -100%;
    bottom: 0;
    width: 240px;
    z-index: 200;
    transition: left 0.25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  }

  .sidebar.open { left: 0; }

  .pages { padding: 16px; }

  .kpi-grid { grid-template-columns: 1fr 1fr; }

  .rank-bar-wrap { display: none; }
}
