/* public/css/ranking.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --green:    #22c55e; --green-dk: #16a34a; --green-lt: #dcfce7;
  --ink:      #0f172a; --ink-2: #334155;    --ink-3: #64748b;
  --border:   #e2e8f0; --surface: #ffffff;  --surface-2: #f8fafc;
  --r: 12px;
}
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--surface-2); color: var(--ink);
  min-height: 100vh;
}

/* ─── NAV ─────────────────────────────────── */
.rk-nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--ink); height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem;
}
.logo {
  font-family: 'Outfit', sans-serif; font-weight: 800;
  font-size: 1.25rem; color: #fff; text-decoration: none;
  display: flex; align-items: center; gap: 6px;
}
.logo-p {
  width: 26px; height: 26px; background: var(--green);
  border-radius: 7px; display: flex; align-items: center;
  justify-content: center; font-size: .85rem;
}
.rk-back, .rk-perfil-link {
  color: rgba(255,255,255,.65); text-decoration: none;
  font-size: .85rem; transition: color .2s;
}
.rk-back:hover, .rk-perfil-link:hover { color: var(--green); }

/* ─── WRAP ────────────────────────────────── */
.rk-wrap { max-width: 600px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

/* ─── HERO ────────────────────────────────── */
.rk-hero {
  text-align: center; padding: 2rem 0 1.75rem;
}
.rk-hero-icon { font-size: 3rem; margin-bottom: .75rem; }
.rk-hero h1 {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800; color: var(--ink); margin-bottom: .5rem;
}
.rk-hero p { color: var(--ink-2); font-size: .95rem; }

/* ─── MI POSICIÓN BANNER ─────────────────── */
.mi-pos-banner {
  background: var(--green-lt); border: 1px solid #bbf7d0;
  border-radius: var(--r); padding: .9rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; margin-bottom: 1.5rem; flex-wrap: wrap;
  font-size: .88rem; color: #166534;
}
.mi-pos-banner strong { font-size: 1.4rem; font-family: 'Outfit', sans-serif; font-weight: 800; }

/* ─── PODIO ───────────────────────────────── */
.podio {
  display: flex; align-items: flex-end; justify-content: center;
  gap: .75rem; margin-bottom: 2rem; padding: 0 .5rem;
}
.podio-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: .4rem; max-width: 160px;
}
.corona { font-size: 1.5rem; }
.podio-avatar {
  position: relative; width: 64px; height: 64px;
}
.podio-avatar img,
.podio-initials {
  width: 64px; height: 64px; border-radius: 50%;
  object-fit: cover; border: 3px solid var(--border);
}
.podio-initials {
  display: flex; align-items: center; justify-content: center;
  background: var(--green); color: #fff;
  font-size: 1.5rem; font-weight: 700;
}
.pos-1 .podio-initials { border-color: #fbbf24; }
.pos-2 .podio-initials { border-color: #94a3b8; }
.pos-3 .podio-initials { border-color: #cd7c4b; }
.podio-medal {
  position: absolute; bottom: -4px; right: -4px;
  font-size: 1.1rem; background: #fff;
  border-radius: 50%; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.podio-nombre {
  font-size: .85rem; font-weight: 600; color: var(--ink);
  text-align: center; max-width: 80px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.podio-num {
  font-family: 'Outfit', sans-serif; font-size: 1.3rem; font-weight: 800;
  color: var(--ink);
}
.podio-num::after { content: ' 🅿'; font-size: .75rem; }
.podio-bar {
  width: 100%; border-radius: 8px 8px 0 0;
}
.bar-1 { height: 80px; background: linear-gradient(to top, #fbbf24, #fef3c7); }
.bar-2 { height: 55px; background: linear-gradient(to top, #94a3b8, #f1f5f9); }
.bar-3 { height: 40px; background: linear-gradient(to top, #cd7c4b, #fef3c7); }

/* ─── LISTA ───────────────────────────────── */
.rk-list {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden; margin-bottom: 1.5rem;
}
.rk-list-header {
  display: grid; grid-template-columns: 48px 1fr 80px 56px;
  padding: .65rem 1rem; background: var(--surface-2);
  font-size: .75rem; font-weight: 600; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
.rk-row {
  display: grid; grid-template-columns: 48px 1fr 80px 56px;
  align-items: center; padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.rk-row:last-child { border-bottom: none; }
.rk-row:hover { background: var(--surface-2); }
.rk-row-tuyo { background: #f0fdf4 !important; }
.rk-pos { font-size: .85rem; font-weight: 600; }
.pos-gold   { color: #d97706; font-family: 'Outfit', sans-serif; font-size: 1rem; }
.pos-silver { color: #64748b; font-family: 'Outfit', sans-serif; font-size: 1rem; }
.pos-bronze { color: #92400e; font-family: 'Outfit', sans-serif; font-size: 1rem; }
.pos-normal { color: var(--ink-3); }
.rk-user { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.rk-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover; border: 1.5px solid var(--border); flex-shrink: 0;
}
.rk-avatar-init {
  display: flex; align-items: center; justify-content: center;
  background: var(--green); color: #fff;
  font-size: .9rem; font-weight: 600;
}
.rk-user-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rk-nombre {
  font-size: .88rem; font-weight: 500; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tu-label {
  display: inline-block; background: var(--green); color: #fff;
  font-size: .65rem; padding: 1px 5px; border-radius: 4px;
  vertical-align: middle; margin-left: 4px;
}
.rk-badge {
  display: inline-block; font-size: .7rem; padding: 1px 7px;
  border-radius: 99px; font-weight: 500; width: fit-content;
}
.rk-plazas-mes { text-align: center; }
.rk-plazas-mes strong { display: block; font-family: 'Outfit', sans-serif; font-size: 1.1rem; color: var(--green-dk); }
.rk-plazas-mes span  { font-size: .7rem; color: var(--ink-3); }
.rk-total { text-align: right; font-size: .85rem; color: var(--ink-3); }
.rk-empty {
  padding: 2.5rem; text-align: center;
  font-size: .9rem; color: var(--ink-3); line-height: 1.7;
}

/* ─── BADGES INFO ─────────────────────────── */
.badges-info { margin-bottom: 1.5rem; }
.badges-title {
  font-size: .78rem; font-weight: 600; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .75rem;
}
.badges-grid {
  display: flex; gap: .5rem; flex-wrap: wrap;
}
.badge-item {
  flex: 1; min-width: 80px; max-width: 120px;
  background: var(--surface); border: 1.5px solid;
  border-radius: var(--r); padding: .75rem .5rem;
  text-align: center; display: flex; flex-direction: column; gap: 3px;
}
.badge-ico { font-size: 1.4rem; }
.badge-item strong { font-size: .8rem; }
.badge-item span { font-size: .72rem; color: var(--ink-3); }

/* ─── PERFIL ──────────────────────────────── */
.perfil-card {
  background: var(--ink); border-radius: 20px;
  padding: 2rem 1.5rem; text-align: center;
  margin-bottom: 1.25rem;
}
.perfil-avatar-wrap { position: relative; display: inline-block; margin-bottom: 1rem; }
.perfil-avatar {
  width: 84px; height: 84px; border-radius: 50%;
  object-fit: cover; border: 3px solid var(--green);
}
.perfil-avatar-init {
  display: flex; align-items: center; justify-content: center;
  background: var(--green); color: #fff;
  font-size: 2.2rem; font-weight: 700;
}
.perfil-badge-icon {
  position: absolute; bottom: -4px; right: -4px;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; border: 2px solid var(--ink);
}
.perfil-nombre {
  font-family: 'Outfit', sans-serif; font-size: 1.5rem;
  font-weight: 800; color: #fff; margin-bottom: .5rem;
}
.perfil-badge-label {
  display: inline-block; padding: .3rem .9rem;
  border-radius: 99px; font-size: .85rem; font-weight: 500;
  margin-bottom: .5rem;
}
.perfil-email { font-size: .82rem; color: rgba(255,255,255,.45); }

/* ─── STATS ───────────────────────────────── */
.perfil-stats {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: .65rem; margin-bottom: 1.25rem;
}
.stat-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1rem; text-align: center;
}
.stat-num {
  display: block; font-family: 'Outfit', sans-serif;
  font-size: 1.8rem; font-weight: 800; margin-bottom: .2rem;
}
.stat-box span { font-size: .8rem; color: var(--ink-3); }

/* ─── PROGRESO ────────────────────────────── */
.progreso-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.25rem; margin-bottom: 1.25rem;
}
.progreso-header {
  display: flex; justify-content: space-between;
  font-size: .88rem; color: var(--ink-2); margin-bottom: .75rem;
}
.progreso-bar-wrap {
  height: 10px; background: var(--surface-2);
  border-radius: 99px; overflow: hidden; margin-bottom: .5rem;
  border: 1px solid var(--border);
}
.progreso-bar {
  height: 100%; background: linear-gradient(to right, var(--green), #4ade80);
  border-radius: 99px; transition: width .5s ease;
}
.progreso-sub { font-size: .82rem; color: var(--ink-3); }

/* ─── HISTORIAL ───────────────────────────── */
.historial-section { margin-bottom: 1.5rem; }
.historial-title {
  font-size: .78rem; font-weight: 600; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .75rem;
}
.historial-list {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden;
}
.historial-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.historial-item:last-child { border-bottom: none; }
.hi-dir { font-size: .88rem; font-weight: 500; color: var(--ink); margin-bottom: .2rem; }
.hi-meta { font-size: .76rem; color: var(--ink-3); }
.hi-estado {
  font-size: .76rem; padding: .25rem .65rem;
  border-radius: 99px; white-space: nowrap; flex-shrink: 0;
}

/* ─── BOTONES ─────────────────────────────── */
.rk-cta {
  display: flex; flex-direction: column; gap: .65rem;
  margin-bottom: 1.5rem;
}
.btn-mapa {
  display: block; text-align: center;
  background: var(--green); color: #fff;
  padding: .9rem; border-radius: var(--r);
  text-decoration: none; font-weight: 500; font-size: .95rem;
  transition: background .2s;
}
.btn-mapa:hover { background: var(--green-dk); }
.btn-perfil {
  display: block; text-align: center;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--border); padding: .8rem;
  border-radius: var(--r); text-decoration: none;
  font-size: .9rem; transition: all .2s;
}
.btn-perfil:hover { border-color: var(--ink-3); }

/* ─── FOOTER ──────────────────────────────── */
.rk-footer {
  text-align: center; padding: 1.5rem;
  font-size: .82rem; color: var(--ink-3);
}
.rk-footer a { color: var(--ink-3); text-decoration: none; }

/* ─── RESPONSIVE ──────────────────────────── */
@media (max-width: 420px) {
  .perfil-stats { grid-template-columns: 1fr 1fr; }
  .rk-list-header, .rk-row { grid-template-columns: 40px 1fr 70px 46px; }
}