/* ══════════════════════════════════════════════════════════
   SPOTSYNC RANKINGS — ATP layout, mobile-first
   4 columns: # | Jugador | Puntos | Torneos
   ══════════════════════════════════════════════════════════ */

.rk { min-height: 100vh; display: flex; flex-direction: column; background: #fff; }
.rk-wrap { max-width: 1200px; margin: 0 auto; width: 100%; padding-left: 1rem; padding-right: 1rem; }

/* ── DARK HEADER ──────────────────────────────────────────── */
.rk-head { background: #0b1121; padding-top: calc(var(--nav-h) + .75rem); }
.rk-head-top { padding-bottom: .7rem; }
.rk-logo-line { display: flex; align-items: center; gap: 8px; }
.rk-logo-sm { width: 18px; height: 18px; opacity: .55; }
.rk-logo-label { font-size: .56rem; font-weight: 800; letter-spacing: .22em; color: rgba(255,255,255,.3); }

/* ── NAV TABS ─────────────────────────────────────────────── */
.rk-nav {
  display: flex; gap: 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.rk-nav::-webkit-scrollbar { display: none; }
.rk-nav-loading { color: rgba(255,255,255,.2); font-size: .72rem; padding: .6rem 0; }
.rk-tab {
  padding: .6rem 1rem; font-size: .72rem; font-weight: 700;
  color: rgba(255,255,255,.35); background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  cursor: pointer; white-space: nowrap; transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.rk-tab.active { color: #fff; border-bottom-color: #1A6BFF; }

/* ── TWO-COLUMN LAYOUT ────────────────────────────────────── */
.rk-layout { flex: 1; }
.rk-layout-inner { display: flex; flex-direction: column; gap: 0; }
.rk-main { flex: 1; min-width: 0; }
.rk-side { display: flex; flex-direction: column; gap: 1rem; padding: 1.5rem 0 2rem; }

/* ── COLUMN GRID (4 cols) ─────────────────────────────────── */
.rk-colhead, .rk-row {
  display: grid;
  grid-template-columns: 38px 1fr 68px 56px;
  align-items: center;
}
.rk-colhead {
  padding: .5rem 0;
  border-bottom: 2px solid #e5e7eb;
  position: sticky; top: var(--nav-h); z-index: 10;
  background: #fff;
}
.rk-col {
  font-size: .5rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: #9ca3af;
}
.rk-col-rank { text-align: center; }
.rk-col-pts, .rk-col-t { text-align: center; }

/* Sort arrows */
.rk-col-rank::after, .rk-col-pts::after, .rk-col-t::after {
  content: ''; display: inline-block; margin-left: 2px;
  width: 0; height: 0; vertical-align: middle;
  border-left: 2.5px solid transparent; border-right: 2.5px solid transparent;
  border-bottom: 3px solid #d1d5db;
}

/* ── ROWS ─────────────────────────────────────────────────── */
.rk-rows { transition: opacity .2s ease; }
.rk-rows.fading { opacity: 0; }
.rk-row { padding: .6rem 0; border-bottom: 1px solid #f0f1f3; }
.rk-row.rk-top5 { padding: .75rem 0; border-bottom-color: #e5e7eb; }

/* ── RANK CELL ────────────────────────────────────────────── */
.rk-rank-cell { display: flex; align-items: center; justify-content: center; }
.rk-num { font-size: .88rem; font-weight: 800; color: #d1d5db; }
.rk-row.rk-top5 .rk-num { font-size: 1rem; color: #6b7280; }

/* ── PLAYER CELL ──────────────────────────────────────────── */
.rk-player { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.rk-av {
  width: 28px; height: 28px; border-radius: 50%; overflow: hidden;
  flex-shrink: 0; display: grid; place-items: center;
  font-size: .58rem; font-weight: 800; color: #fff;
}
.rk-av img { width: 100%; height: 100%; object-fit: cover; }
.rk-row.rk-top5 .rk-av { width: 36px; height: 36px; font-size: .72rem; }
.rk-name {
  font-size: .78rem; font-weight: 600; color: #111827;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}
.rk-row.rk-top5 .rk-name { font-size: .85rem; font-weight: 700; }

/* ── DATA CELLS ───────────────────────────────────────────── */
.rk-pts { font-size: .82rem; font-weight: 800; color: #111827; text-align: center; }
.rk-row.rk-top5 .rk-pts { font-size: .9rem; }
.rk-tc { font-size: .75rem; font-weight: 500; color: #6b7280; text-align: center; }

/* ── STATES ───────────────────────────────────────────────── */
.rk-state {
  display: flex; flex-direction: column; align-items: center;
  gap: .5rem; padding: 3rem 1rem; color: #9ca3af; font-size: .8rem;
}
.rk-spinner {
  width: 26px; height: 26px;
  border: 2.5px solid #e5e7eb; border-top-color: #1A6BFF;
  border-radius: 50%; animation: rkspin .7s linear infinite;
}
@keyframes rkspin { to { transform: rotate(360deg); } }

/* ── POINTS REF (collapsible, in main area) ───────────────── */
.rk-ref { margin: 1rem 0; border: 1px solid #e5e7eb; border-radius: 6px; }
.rk-ref-toggle {
  padding: .6rem .75rem; font-size: .65rem; font-weight: 700;
  color: #6b7280; letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: .4rem;
}
.rk-ref-toggle::-webkit-details-marker { display: none; }
.rk-ref-toggle::before { content: '▸'; font-size: .55rem; transition: transform .2s; }
.rk-ref[open] .rk-ref-toggle::before { transform: rotate(90deg); }
.rk-ref-body { padding: 0 .75rem .6rem; }
.rk-ref-row {
  display: flex; justify-content: space-between;
  padding: .3rem 0; border-bottom: 1px solid #f3f4f6; font-size: .75rem;
}
.rk-ref-row span:first-child { font-weight: 700; color: #374151; }
.rk-ref-row span:last-child { font-weight: 800; color: #1A6BFF; }
.rk-ref-row:last-child { border-bottom: none; }

/* ── SIDEBAR PANELS ───────────────────────────────────────── */
.rk-panel { border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; }
.rk-panel-head {
  background: #0b1121; padding: .65rem .85rem;
  display: flex; align-items: center; justify-content: space-between;
}
.rk-panel-title { font-size: .62rem; font-weight: 800; letter-spacing: .14em; color: #fff; }
.rk-panel-body { }

/* Recent tournament card (sidebar) */
.rk-recent {
  padding: .65rem .85rem;
  border-bottom: 1px solid #f0f1f3;
}
.rk-recent:last-child { border-bottom: none; }
.rk-recent-name { font-size: .75rem; font-weight: 700; color: #111827; margin-bottom: .15rem; }
.rk-recent-date { font-size: .6rem; color: #9ca3af; margin-bottom: .35rem; }
.rk-recent-result {
  display: flex; align-items: center; gap: .35rem;
  font-size: .68rem;
}
.rk-recent-result .rk-av { width: 20px; height: 20px; font-size: .44rem; }
.rk-recent-winner { font-weight: 700; color: #111827; }
.rk-recent-pts { font-weight: 800; color: #1A6BFF; margin-left: auto; font-size: .65rem; }

/* Points table (sidebar) */
.rk-pts-table { }
.rk-pts-row {
  display: flex; justify-content: space-between;
  padding: .4rem .85rem;
  border-bottom: 1px solid #f3f4f6;
  font-size: .75rem;
}
.rk-pts-row:last-child { border-bottom: none; }
.rk-pts-row span:first-child { font-weight: 700; color: #374151; }
.rk-pts-row span:last-child { font-weight: 800; color: #1A6BFF; }
.rk-pts-gold { background: rgba(245,158,11,.04); }
.rk-pts-silver { background: rgba(148,163,184,.04); }
.rk-pts-bronze { background: rgba(205,127,50,.04); }

/* ── FOOTER ───────────────────────────────────────────────── */
.rk-footer { background: #0b1121; padding: 2rem 0 1.25rem; margin-top: auto; }
.rk-footer-top {
  display: flex; flex-direction: column; gap: 1rem;
  padding-bottom: 1rem; border-bottom: 1px solid rgba(255,255,255,.06); margin-bottom: .75rem;
}
.rk-footer-logo { height: 24px; width: auto; display: block; opacity: .4; margin-bottom: .3rem; }
.rk-footer-tag { font-size: .72rem; color: rgba(255,255,255,.25); }
.rk-footer-links { display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.rk-footer-links a { font-size: .72rem; color: rgba(255,255,255,.35); transition: color .15s; }
.rk-footer-links a:hover { color: rgba(255,255,255,.7); }
.rk-footer-bottom { font-size: .62rem; color: rgba(255,255,255,.15); }
.nav-link.active { color: var(--color-primary); }


/* ══════════════════════════════════════════════════════════
   TABLET — 601px+
   ══════════════════════════════════════════════════════════ */
@media (min-width: 601px) {
  .rk-wrap { padding-left: 1.5rem; padding-right: 1.5rem; }
  .rk-tab { padding: .65rem 1.3rem; font-size: .76rem; }

  .rk-colhead, .rk-row {
    grid-template-columns: 50px 1fr 88px 72px;
  }
  .rk-col { font-size: .54rem; }
  .rk-row { padding: .75rem 0; }
  .rk-row.rk-top5 { padding: .95rem 0; }
  .rk-av { width: 32px; height: 32px; font-size: .65rem; }
  .rk-row.rk-top5 .rk-av { width: 42px; height: 42px; font-size: .8rem; }
  .rk-name { font-size: .85rem; }
  .rk-row.rk-top5 .rk-name { font-size: .92rem; }
  .rk-num { font-size: .95rem; }
  .rk-row.rk-top5 .rk-num { font-size: 1.1rem; }
  .rk-pts { font-size: .9rem; }
  .rk-row.rk-top5 .rk-pts { font-size: 1rem; }
  .rk-player { gap: .55rem; }
  .rk-tc { font-size: .78rem; }

  .rk-footer-top { flex-direction: row; justify-content: space-between; align-items: flex-start; }
}


/* ══════════════════════════════════════════════════════════
   DESKTOP — 961px+ — sidebar goes right
   ══════════════════════════════════════════════════════════ */
@media (min-width: 961px) {
  .rk-wrap { padding-left: 2rem; padding-right: 2rem; }
  .rk-head { padding-top: calc(var(--nav-h) + 1rem); }
  .rk-tab { padding: .7rem 1.5rem; font-size: .8rem; }
  .rk-tab:hover { color: rgba(255,255,255,.65); }

  .rk-layout-inner {
    flex-direction: row; gap: 1.5rem;
    padding-top: .5rem; padding-bottom: 2rem;
  }
  .rk-side {
    width: 300px; flex-shrink: 0;
    padding-top: 0; padding-bottom: 0;
    position: sticky; top: calc(var(--nav-h) + .5rem);
    align-self: flex-start;
    max-height: calc(100vh - var(--nav-h) - 1rem);
    overflow-y: auto; scrollbar-width: thin;
  }

  .rk-colhead, .rk-row {
    grid-template-columns: 58px 1fr 100px 84px;
  }
  .rk-col { font-size: .58rem; letter-spacing: .1em; }
  .rk-row { padding: .85rem 0; }
  .rk-row:hover { background: #fafbfc; }
  .rk-row.rk-top5 { padding: 1.05rem 0; }
  .rk-row.rk-top5:hover { background: #f7f8ff; }

  .rk-av { width: 34px; height: 34px; }
  .rk-row.rk-top5 .rk-av { width: 46px; height: 46px; }
  .rk-player { gap: .65rem; }
  .rk-name { font-size: .9rem; }
  .rk-row.rk-top5 .rk-name { font-size: .98rem; font-weight: 700; }
  .rk-num { font-size: 1rem; }
  .rk-row.rk-top5 .rk-num { font-size: 1.2rem; }
  .rk-pts { font-size: .95rem; }
  .rk-row.rk-top5 .rk-pts { font-size: 1.08rem; }
  .rk-tc { font-size: .82rem; }
}

@media (min-width: 1100px) {
  .rk-side { width: 330px; }
  .rk-layout-inner { gap: 2rem; }
  .rk-colhead, .rk-row {
    grid-template-columns: 64px 1fr 110px 90px;
  }
}
