.khlassements * { box-sizing: border-box; }

/* Table */
.khlassements .kh-table-responsive { width: 100%; }
.khlassements .kh-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 14px;
}
.khlassements .kh-table th,
.khlassements .kh-table td {
  padding: 10px 8px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  text-align: left;
  white-space: nowrap;
}
.khlassements .kh-table th.col-rank,
.khlassements .kh-table td.col-rank { width: 1%; text-align: center; }

/* ========= AVATAR / COURONNE / HALO ========= */

/* Conteneur avatar : pas d’overflow, sert de référence */
.khlassements .kh-avatar-box {
  position: relative;
  width: 44px;
  height: 44px;
  display: inline-block;
  overflow: visible;            /* <-- IMPORTANT */
  isolation: isolate;           /* crée un contexte : z-index fiables */
}

/* Avatar (clip dans le cercle) */
.khlassements .kh-avatar-wrap {
  position: absolute;
  inset: 0;
  border: 2px solid currentColor;
  border-radius: 50%;
  overflow: hidden;
  display: inline-block;
/*  z-index: 2;*/
}

.khlassements .kh-avatar {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.khlassements .kh-zoom { transform: scale(1.2); transform-origin: center; }

/* Couronne : au-dessus de tout, jamais rognée */
.khlassements .kh-crown {
    position: absolute;
    top: -2px;
    left: -1px;
    transform: rotate(-45deg);
    font-size: 11px;
    line-height: 1;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .35);
    z-index: 10;
    pointer-events: none;
    animation: kh-bounce 2.5s infinite ease-in-out;
}

/* Shiny: reste DANS le wrap (clip) */
.khlassements .kh-shiny {
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.45) 50%, transparent 100%);
  transform: translateX(-120%);
  animation: kh-shiny-sweep 3.2s infinite;
  pointer-events: none;
}

/* Halo en-dessous de l’avatar */
.khlassements .kh-halo {
  position: absolute;
  left: 50%; top: 50%;
  width: 56px; height: 56px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;                   /* < avatar (2) < couronne (10) */
  border: 2px dashed #fff;
  opacity: .95;
  box-shadow: 0 0 8px rgba(255, 152, 0, .35);
  animation: kh-rotate 60s linear infinite, kh-glow-breathe 3.2s ease-in-out infinite;
}

/* L’avatar du rang 2 peut respirer légèrement (scale) */
.khlassements .is-second .kh-avatar { animation: kh-breathe-scale 3s infinite ease-in-out; }

/* Animations */
@keyframes kh-breathe-scale { 0%,100% { transform: scale(1); } 50% { transform: scale(1.02); } }
@keyframes kh-bounce { 0%,100% { transform: rotate(-45deg) translateY(0); } 50% { transform: rotate(-45deg) translateY(-2px); } }
@keyframes kh-shiny-sweep { 0% { transform: translateX(-120%); } 60% { transform: translateX(120%); } 100% { transform: translateX(120%); } }
@keyframes kh-rotate { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes kh-glow-breathe { 0%,100% { box-shadow: 0 0 8px rgba(255,152,0,.35); } 50% { box-shadow: 0 0 16px rgba(255,152,0,.6); } }

/* ========= KHV ========= */

.khlassements .kh-khol-user { display: flex; align-items: center; gap: 10px; }
.khlassements .kh-user-meta { display: flex; align-items: center; gap: 6px; }
.khlassements .kh-user-name { font-weight: 600; }

/* icône khibrille à côté du nom (KHV) */
.khlassements .kh-user-meta .kh-name-badge {
  margin-left: 6px;
  font-size: 14px;
  vertical-align: middle;
  opacity: .9;
}

.khlassements .kh-dropdown-toggle { border: none; background: none; padding: 4px; cursor: pointer; }

/* Cellule cliquable pour ouvrir le dropdown */
.col-khol:hover { cursor: pointer; }

/* Dropdown animé */
.khlassements .kh-dropdown {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}
.khlassements .kh-dropdown.is-open { max-height: 500px; opacity: 1; }

/* Chevron rotation */
.khlassements .kh-chevron {
  display: inline-block; width: 10px; height: 10px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); transition: transform 0.3s ease;
}
.khlassements .kh-dropdown-toggle[aria-expanded="true"] .kh-chevron { transform: rotate(-135deg); }

.khlassements .kh-dd-title { font-size: 12px; opacity: .7; margin-bottom: 6px; }
.khlassements .kh-dd-list { list-style: none; margin: 0; padding: 0; }
.khlassements .kh-dd-list li { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
/* Badge rareté (dropdown) */
.khlassements .kh-badge {
  display: inline-block; min-width: 18px; padding: 2px 6px; margin-left: 6px;
  font-size: 12px; font-weight: 600; line-height: 1;
  color: #fff; background: #444; border-radius: 999px; text-align: center;
}

/* ========= PROGRESS BARS ========= */

.khlassements .kh-progress { position: relative; height: 4px; border-radius: 999px; margin-top: 6px; }
.khlassements .kh-progress .kh-rail { position: absolute; inset: 0; border-radius: inherit; background: rgba(0,0,0,0.1); }
.khlassements .kh-progress .kh-bar { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; background: #e9e9e9; }

/* Palier en cours (barre orange) */
.khlassements .kh-progress .kh-bar.orange { background: #ff9800; }
.khlassements .kh-palier { height: 4px; }
.khlassements .kh-palier-label { margin-top: 4px; font-size: 11px; opacity: .7; }

/* Progressbar pleine = verte */
.khlassements .kh-progress .kh-bar.full { background-color: #4caf50; }

/* ========= KHM (ratio & rareté) ========= */
.kh-total{
  font-size: 1.2em;
  font-weight: bold;
}
.khlassements .kh-ratio .kh-rail.purple { background: #9c27b0; }
.khlassements .kh-ratio .kh-bar.orange { background: #ff9800; }
.khlassements .kh-ratio-legend { margin-top: 4px; display: flex; justify-content: space-between; font-size: 12px; }
.khlassements .kh-ratio-legend .kh-norm { color: #ff9800; }
.khlassements .kh-ratio-legend .kh-khib { color: #9c27b0; }

/* Rareté image */
.khlassements .kh-rarete-img { width: 28px; height: 28px; object-fit: contain; }

/* ========= PAGINATION ========= */

/* Pagination sombre & centrée */
.khlassements .kh-pagination {
  display: flex;
  justify-content: center;   /* centré horizontalement */
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.khlassements .kh-page-btn {
  appearance: none;
  border: 1px solid #2a2a2a;
  background: #111;          /* fond sombre */
  color: #eaeaea;            /* texte clair */
  padding: 8px 12px;
  border-radius: 5px;      /* pilule */
  cursor: pointer;
  font-weight: 600;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}

.khlassements .kh-page-btn:hover {
  background: #181818;
  border-color: #3a3a3a;
  transform: translateY(-1px);
}

.khlassements .kh-page-btn:active {
  transform: translateY(0);
}

.khlassements .kh-page-btn.is-active {
  background: #555555;
    border-color: #1c1c1c;
    color: #111;
}

.khlassements .kh-page-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255,152,0,.35);
}

/* Optionnel: mode réduit sur mobile */
@media (max-width: 480px) {
  .khlassements .kh-page-btn {
    padding: 6px 10px;
    font-weight: 600;
  }
}


/* ========= EN-TÊTES LONG/COURT & RWD ========= */

.khlassements .kh-th-full { display: inline; }
.khlassements .kh-th-short { display: none; }

@media (max-width: 768px) {
  .khlassements .kh-table th, .khlassements .kh-table td { white-space: normal; }
  .khlassements .kh-meche .kh-meche-title { font-size: 13px; }
  .khlassements .kh-th-full { display: none; }
  .khlassements .kh-th-short { display: inline; }
  .khlassements .kh-user-name {
    max-width: 15ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
  }
}

/* ========= RECHERCHE KHM ========= */

.khlassements .khm-search-row th { padding-top: 6px; padding-bottom: 12px; }
.khlassements .khm-search-input {
  width: 100%;
  display: block;
  padding: 8px 10px;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 8px;
  font-size: 14px;
}

/* Alerte */
.khlassements .kh-alert { padding: 10px; background: #fff8e1; border: 1px solid #ffe0b2; }


/* ---- Loading overlay pour le conteneur AJAX ---- */
.khlassements .khm-table-container {
  position: relative;
  min-height: 60px; /* évite les sauts si vide */
}

/* Calque sombre + spinner centrés quand .kh-loading est présent */
.khlassements .khm-table-container.kh-loading::before,
.khlassements .khm-table-container.kh-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* voile */
.khlassements .khm-table-container.kh-loading::before {
  background: rgba(0,0,0,0.35);
  border-radius: 8px;
}

/* Assure un contexte propre et pas d'overflow sur la boîte avatar */
.khlassements .kh-avatar-box {
  position: relative;
  overflow: visible;
  isolation: isolate; /* z-index fiables */
}

/* L’avatar reste au-dessus du fond et des halos “autres” si besoin */
.khlassements .kh-avatar-wrap {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  z-index: 2;
}

/* spinner */
.khlassements .khm-table-container.kh-loading::after {
  width: 36px;
  height: 36px;
  margin: auto;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.25);
  border-top-color: #ff9800; /* cohérent avec l’orange du thème */
  animation: khm-spin 0.8s linear infinite;
}

@keyframes khm-spin { to { transform: rotate(360deg); } }

/* (optionnel) désature le contenu en dessous pendant le chargement */
.khlassements .khm-table-container.kh-loading {
  filter: grayscale(0.3);
}

/* Base - référence (taille ajustée et neutre) */
.khlassements .kh-ref-halo{
  position:absolute; left:50%; top:50%;
  width:52px; height:52px; transform:translate(-50%,-50%);
  pointer-events:none; border-radius:50%; z-index:3;
}

.khlassements .kh-ref-halo.style-ticks {
  --tick: radial-gradient(circle at 50% 2px, #fff 0 1px, transparent 1.2px);
  -webkit-mask:
    conic-gradient(from 0deg, #000 0 360deg),
    var(--tick);
  -webkit-mask-composite: source-in;
          mask-composite: intersect;
  background:
    repeating-conic-gradient(#fff 0deg 6deg, transparent 6deg 12deg);
  opacity: .8;
  animation: ref-ticks-spin 8s linear infinite;
}
@keyframes ref-ticks-spin { to{ transform: translate(-50%,-50%) rotate(360deg); } }

/* 4) RADAR — anneau discret + pulsation douce (neutre) */
.khlassements .kh-ref-halo.style-radar {
  border:1px solid rgba(255,255,255,.45);
  box-shadow: 0 0 10px rgba(255,255,255,.35);
}
.khlassements .kh-ref-halo.style-radar::after{
  content:""; position:absolute; inset:-5px; border-radius:inherit;
  border:1px solid #4caf50; opacity:.7;
  animation: ref-radar-pulse 2.2s ease-out infinite;
}
@keyframes ref-radar-pulse {
  0% { transform: scale(.95); opacity:.6; }
  70%{ transform: scale(1.2); opacity:0; }
  100%{ transform: scale(1.2); opacity:0; }
}

.khorrupt{
  color: #f95151;
}

.khorrupt .kh-avatar-wrap{
  border-color: #f95151;
}

/* Progressbar "Tentatives" — segments empilés, pas superposés */
.khlassements .kh-progress.kh-tent { position: relative; height: 4px; border-radius: 999px; margin-top: 6px; }
.khlassements .kh-progress.kh-tent .kh-rail { position: absolute; inset: 0; border-radius: inherit; background: rgba(0,0,0,0.1); }
.khlassements .kh-progress.kh-tent .kh-stack { 
  display: flex; 
  height: 4px; 
  border-radius: 999px; 
  overflow: hidden; 
  position: relative; 
}
.khlassements .kh-progress.kh-tent .kh-stack .kh-bar {
  position: relative !important; /* override des bars classiques */
  left: auto; right: auto; top: auto; bottom: auto;
  flex: 0 0 auto;
  height: 4px;
}

/* Couleurs déjà passées inline côté PHP, mais on peut fixer en CSS si tu préfères :
.khlassements .kh-progress.kh-tent .kh-bar.kh-norm          { background:#ff9800; }
.khlassements .kh-progress.kh-tent .kh-bar.kh-khorrupt-don  { background:#0070ff; }
.khlassements .kh-progress.kh-tent .kh-bar.kh-khorrupt-vol  { background:#ff0039; }
.khlassements .kh-progress.kh-tent .kh-bar.kh-khorrupt-roue { background:#00ffa3; }
.khlassements .kh-progress.kh-tent .kh-bar.kh-destin        { background:#caff00; }
*/