/* Page Rankings */

.rk-page { padding-top: 64px; }

/* Hero — unified pattern: left-heavy dark vignette for text legibility,
   fading right so the image breathes. */
.rk-hero {
  position: relative;
  padding: 120px 0 80px;
  background:
    linear-gradient(180deg, transparent 0%, transparent 55%, rgba(0,0,0,1) 100%),
    linear-gradient(90deg, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.85) 30%, rgba(0,0,0,0.60) 55%, rgba(0,0,0,0.20) 80%, rgba(0,0,0,0.35) 100%),
    url('/images/classement.png') center / cover no-repeat,
    #000;
  overflow: hidden;
  text-align: left;
}
.rk-hero .container { position: relative; z-index: 1; }
.rk-title { font-size: clamp(34px, 5vw, 54px); font-weight: 800; color: #fff; margin-top: 4px; }
.rk-sub   { font-size: 16px; color: var(--muted); margin-top: 14px; max-width: 640px; line-height: 1.6; }

.rk-section { padding: 36px 0 60px; }

/* Filtres */
.rk-filters {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end;
  background: var(--card); border: 1px solid var(--border2);
  border-radius: 12px; padding: 18px 22px;
  margin-bottom: 20px;
}
.rk-filter { display: flex; flex-direction: column; gap: 6px; }
.rk-filter-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--muted);
}
.rk-select {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 8px 32px 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23999' d='M0 0l5 6 5-6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.rk-select:hover { border-color: var(--border); }

.rk-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.rk-toggle input { display: none; }
.rk-toggle-slider {
  width: 38px; height: 22px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border2);
  border-radius: 12px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.rk-toggle-slider::before {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #ccc; border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.rk-toggle input:checked + .rk-toggle-slider { background: rgba(46,204,113,0.3); border-color: #2ECC71; }
.rk-toggle input:checked + .rk-toggle-slider::before { transform: translateX(16px); background: #2ECC71; }
.rk-toggle-label { font-size: 13px; color: var(--text); font-weight: 600; }

.rk-filter-info {
  margin-left: auto;
  font-size: 12px; color: var(--muted);
  font-weight: 600;
}
.rk-filter-info #rk-count { color: var(--gold); font-size: 16px; font-weight: 800; }

/* Table */
.rk-table-wrap {
  background: var(--card); border: 1px solid var(--border2);
  border-radius: 12px;
  /* overflow-x: auto allows horizontal scrolling on narrow viewports
     instead of forcing the table to overflow its container.
     overflow-y: hidden keeps the rounded corners clipped. */
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.rk-table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px;
}
.rk-table thead {
  background: rgba(255,255,255,0.03);
}
.rk-table th {
  padding: 12px 18px;
  text-align: left;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted);
  border-bottom: 1px solid var(--border2);
}
.rk-table th.rk-num { text-align: right; }
.rk-table td {
  padding: 11px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text);
}
.rk-table tbody tr:last-child td { border-bottom: none; }
.rk-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.rk-num { text-align: right; font-variant-numeric: tabular-nums; }
.rk-rank { color: var(--gold); font-weight: 700; width: 70px; }
.rk-name { color: #fff; font-weight: 600; }
.rk-class { color: var(--muted); }

.rk-sang   { color: #E74C3C; font-weight: 600; }
.rk-gloire { color: #f1c40f; font-weight: 600; }

/* Tier icon — naked, no frame */
.rk-tier-icon {
  display: inline-block;
  width: 40px; height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.45));
  transition: transform 0.15s;
  cursor: default;
}
.rk-tier-icon:hover { transform: scale(1.1); }
.rk-tier-icon--hero      { filter: drop-shadow(0 0 8px rgba(241,196,15,0.5)) drop-shadow(0 2px 4px rgba(0,0,0,0.45)); }
.rk-tier-icon--meurtrier { filter: drop-shadow(0 0 8px rgba(192,57,43,0.6))  drop-shadow(0 2px 4px rgba(0,0,0,0.45)); }
.rk-tier-empty {
  display: inline-block;
  width: 40px; line-height: 40px;
  text-align: center;
  color: #555; font-size: 16px;
}

/* Online indicator */
.rk-online { font-size: 12px; color: var(--muted); }
.rk-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.rk-dot--on  { background: #2ECC71; box-shadow: 0 0 6px rgba(46,204,113,0.6); }
.rk-dot--off { background: #555; }

.rk-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* Mobile */
@media (max-width: 800px) {
  .rk-table th, .rk-table td { padding: 10px 12px; font-size: 12px; }
  .rk-table .rk-class, .rk-table th:nth-child(3) { display: none; }
}
@media (max-width: 600px) {
  .rk-table .rk-online, .rk-table th:nth-child(8) { display: none; }
  .rk-filters { gap: 12px; padding: 14px; }
  .rk-filter-info { width: 100%; margin-left: 0; }
  /* Tighter columns on narrow screens — table can still scroll horizontally
     thanks to .rk-table-wrap's overflow-x: auto, but most users will see
     all visible columns at once with these widths. */
  .rk-table th, .rk-table td { padding: 9px 8px !important; font-size: 12px; }
  .rk-table th:nth-child(2), .rk-table td:nth-child(2) { width: 140px !important; }
  .rk-table th, .rk-table td { width: 90px !important; }
  .rk-portrait { width: 36px; height: 36px; }
  .rk-name-cell { gap: 8px; }
  .rk-tier-icon, .rk-tier-empty { width: 28px; height: 28px; }
  .rk-tier-empty { line-height: 28px; font-size: 13px; }
}

/* Portrait tête */
.rk-name-cell { display: flex; align-items: center; gap: 12px; }
.rk-portrait {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.rk-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* Guild cell */
.rk-guild-cell { display: flex; align-items: center; gap: 8px; }
.rk-emblem {
  width: 24px; height: 24px;
  flex-shrink: 0;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}
.rk-no-guild { color: var(--muted); opacity: 0.4; }
.rk-guild { color: var(--text); }

@media (max-width: 1000px) {
  .rk-table .rk-guild, .rk-table th:nth-child(4) { display: none; }
}

/* K/D */
.rk-kd { color: var(--gold-lt); font-weight: 700; }

@media (max-width: 1200px) {
  .rk-table .rk-col-kd { display: none; }
}

/* Territoires */
.rk-terr { color: #c98b5a; font-weight: 700; }
@media (max-width: 1100px) {
  .rk-table .rk-col-terr { display: none; }
}

/* Blood/Glory consolidé */
.rk-bg { white-space: nowrap; font-weight: 700; }
.rk-bg-sang   { color: #E74C3C; }
.rk-bg-gloire { color: #f1c40f; }
.rk-bg-sep    { color: var(--muted); margin: 0 4px; opacity: 0.5; }
.rk-bg-empty  { color: #555; }

/* K/D consolidé : ratio principal + raw en sous-titre */
.rk-kd-cell  { line-height: 1.15; }
.rk-kd-ratio { color: var(--gold-lt); font-weight: 700; font-size: 14px; }
.rk-kd-raw   { color: var(--muted); font-size: 10.5px; margin-top: 2px; opacity: 0.7; }

/* Colonne Faction (Tier + Sang/Gloire fusionnés) */
.rk-col-faction { text-align: center; }
.rk-faction { text-align: center; white-space: nowrap; line-height: 1.2; }
.rk-faction .rk-tier { display: inline-block; margin-bottom: 4px; }
.rk-faction .rk-bg { font-size: 12px; font-weight: 600; }

/* (alignement headers : géré par règle uniforme plus bas) */

/* Zebra striping sur lignes paires */
.rk-table tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.022);
}

/* Le hover reste prioritaire */
.rk-table tbody tr:hover {
  background: rgba(255,255,255,0.05) !important;
}

/* Padding plus serré pour densifier */
.rk-table th, .rk-table td {
  padding-left: 14px;
  padding-right: 14px;
}

/* Largeurs explicites par colonne pour homogénéiser */
.rk-table th:nth-child(1), .rk-table td:nth-child(1) { width: 60px; }    /* Rank */
.rk-table th:nth-child(3), .rk-table td:nth-child(3) { width: 130px; }   /* Class */
.rk-table th:nth-child(4), .rk-table td:nth-child(4) { width: 160px; }   /* Guild */
.rk-table th:nth-child(5), .rk-table td:nth-child(5) { width: 130px; }   /* Level */
.rk-table th:nth-child(6), .rk-table td:nth-child(6) { width: 130px; }   /* Faction */
.rk-table th:nth-child(7), .rk-table td:nth-child(7) { width: 130px; }   /* Terr */
.rk-table th:nth-child(8), .rk-table td:nth-child(8) { width: 130px; }   /* K/D */
.rk-table th:nth-child(9), .rk-table td:nth-child(9) { width: 130px; }   /* Status */
/* Name (col 2) prend le reste */

.rk-table th:nth-child(2), .rk-table td:nth-child(2) { width: 220px; }   /* Name */

/* ═══ LAYOUT UNIFORME ═══ */
/* Toutes les colonnes : 130px, centrées */
.rk-table th, .rk-table td {
  width: 130px;
  text-align: center;
  padding-left: 10px;
  padding-right: 10px;
}

/* Override .rk-num pour aussi être centrée */
.rk-table .rk-num { text-align: center; }

/* Name (col 2) : large + gauche */
.rk-table th:nth-child(2), .rk-table td:nth-child(2) {
  width: 220px;
  text-align: left;
}

/* Guild (col 4) : large + gauche */
.rk-table th:nth-child(4), .rk-table td:nth-child(4) {
  width: 180px;
  text-align: left;
}

/* Le contenu interne (cellules complexes) reste centré naturellement */
.rk-name-cell, .rk-guild-cell { justify-content: flex-start; }

/* ═══ Table-layout fixed pour widths strictes ═══ */
.rk-table { table-layout: fixed; }

/* Empêche les noms de classe trop longs de casser l'alignement */
.rk-table td { overflow: hidden; text-overflow: ellipsis; }

/* ═══════ CLEAN LAYOUT (override final) ═══════ */
.rk-table {
  table-layout: fixed;
  width: auto;
  margin: 0 auto;
}
.rk-table th,
.rk-table td {
  width: 120px !important;
  padding: 11px 10px !important;
  text-align: center !important;
  vertical-align: middle;
}
.rk-table th:nth-child(2),
.rk-table td:nth-child(2) {
  width: 220px !important;
  text-align: left !important;
}
.rk-table th:nth-child(4),
.rk-table td:nth-child(4) {
  width: 180px !important;
  text-align: left !important;
}
.rk-rank, .rk-name, .rk-class, .rk-guild { width: auto !important; }

/* Name et Guild centrés aussi (uniforme avec les autres) */
.rk-table th:nth-child(2),
.rk-table td:nth-child(2),
.rk-table th:nth-child(4),
.rk-table td:nth-child(4) {
  text-align: center !important;
}
.rk-name-cell, .rk-guild-cell {
  justify-content: center !important;
}

/* Name : aligné à gauche pour que les têtes s'alignent verticalement */
.rk-table th:nth-child(2),
.rk-table td:nth-child(2) {
  text-align: left !important;
}
.rk-name-cell {
  justify-content: flex-start !important;
}

/* Header NAME centré (cellules restent left) */
.rk-table th:nth-child(2) {
  text-align: center !important;
}
