/* =============================================================
   STATS MODAL — vue globale des stats de visite du joueur
   ============================================================= */

.stats-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  padding: 20px;
}
.stats-overlay:not(.active) { display: none; }

.stats-modal {
  background: #1a1f2e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  width: 100%;
  max-width: 920px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  overflow: hidden;
}

.stats-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.stats-modal__header h2 {
  margin: 0;
  font-size: 22px;
  color: #fff;
  font-weight: 700;
}
.stats-modal__close {
  background: rgba(255,255,255,0.08);
  border: none;
  color: #fff;
  font-size: 22px;
  width: 34px; height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.stats-modal__close:hover { background: rgba(255,255,255,0.18); }

.stats-modal__body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px 28px;
}

.stats-loading,
.stats-error {
  text-align: center;
  color: rgba(255,255,255,0.55);
  padding: 60px 0;
  font-size: 15px;
}
.stats-error { color: #f0a070; }

/* ── Banner du haut ─────────────────────────────────────────── */
.stats-banner {
  display: grid;
  grid-template-columns: 1.2fr 2fr;
  gap: 18px;
  background: linear-gradient(135deg, rgba(201,149,42,0.12), rgba(27,67,50,0.12));
  border: 1px solid rgba(201,149,42,0.25);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 22px;
}
@media (max-width: 700px) {
  .stats-banner { grid-template-columns: 1fr; }
}
.stats-banner__coins-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.6);
}
.stats-banner__coins-value {
  font-size: 36px;
  font-weight: 800;
  color: #c9952a;
  margin: 4px 0;
  line-height: 1.1;
}
.stats-banner__coins-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
}
.stats-banner__coins-value--today {
  color: #4CAF7D;
}
.stats-banner__coins-divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 10px 0;
}
.stats-banner__counts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  align-items: center;
}
.stats-banner__count {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
}
.stats-banner__count-icon { font-size: 22px; }
.stats-banner__count-value {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
  line-height: 1.1;
}
.stats-banner__count-label {
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 2px;
}

/* Eclatement maisons / personnages dans la banniere */
.stats-banner__split {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  margin: 2px 0;
  font-variant-numeric: tabular-nums;
}
.stats-banner__split--coins { justify-content: flex-start; gap: 14px; }
.stats-banner__split span { white-space: nowrap; }

/* ── Sections ────────────────────────────────────────────────── */
.stats-section { margin-bottom: 22px; }
.stats-section__title {
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 0 0 10px;
}

.stats-empty {
  text-align: center;
  color: rgba(255,255,255,0.45);
  padding: 22px 0;
  font-style: italic;
  font-size: 13px;
}

/* ── Tableau des periodes ───────────────────────────────────── */
.stats-periods {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.stats-periods th,
.stats-periods td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  text-align: center;
  color: #fff;
}
.stats-periods th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: rgba(255,255,255,0.5);
}
.stats-periods__label { text-align: left !important; font-weight: 600; padding-left: 22px !important; }
.stats-periods__total {
  font-weight: 700;
  color: #c9952a;
  background: rgba(201,149,42,0.05);
}
.stats-periods__group td {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #c9952a;
  padding-top: 12px !important;
  padding-bottom: 6px !important;
  border-bottom: 1px solid rgba(201,149,42,0.25) !important;
  background: rgba(255,255,255,0.02);
}
.stats-periods__group:first-child td { padding-top: 4px !important; }

/* ── Top maisons / personnages ──────────────────────────────── */
.stats-tops {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
}
@media (max-width: 700px) {
  .stats-tops { grid-template-columns: 1fr; }
}
.stats-top__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.stats-top__table th {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.3px;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.stats-top__table td {
  padding: 7px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: #fff;
  text-align: center;
}
.stats-top__name {
  text-align: left !important;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.stats-top__coins { color: #c9952a; font-weight: 600; }

/* ── Activite recente ───────────────────────────────────────── */
.stats-recent {
  list-style: none;
  margin: 0;
  padding: 0;
}
.stats-recent__row {
  display: grid;
  grid-template-columns: minmax(110px,150px) auto 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  margin-bottom: 4px;
  font-size: 13px;
}
.stats-recent__pseudo { font-weight: 700; color: #fff; }
.stats-recent__action { color: rgba(255,255,255,0.6); }
.stats-recent__subject {
  color: #fff;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.stats-recent__type-icon {
  font-size: 14px;
  flex-shrink: 0;
  opacity: 0.85;
}

/* Liens cliquables dans l'activite recente (pseudo + sujet) */
.stats-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #fff;                /* force la couleur claire (sinon le <button> repasse en noir UA) */
  cursor: pointer;
  text-align: left;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
button.stats-recent__pseudo.stats-link { font-weight: 700; }
.stats-link:hover {
  color: #c9952a;
  background: rgba(201,149,42,0.1);
  text-decoration: underline;
}
button.stats-recent__pseudo.stats-link { display: inline; }
button.stats-recent__subject.stats-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.stats-recent__coin {
  background: rgba(201,149,42,0.2);
  color: #c9952a;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
}
.stats-recent__date {
  color: rgba(255,255,255,0.4);
  font-size: 11px;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .stats-recent__row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "pseudo coin"
      "action action"
      "subject subject"
      "date date";
  }
  .stats-recent__pseudo { grid-area: pseudo; }
  .stats-recent__action { grid-area: action; }
  .stats-recent__subject { grid-area: subject; }
  .stats-recent__coin { grid-area: coin; justify-self: end; }
  .stats-recent__date { grid-area: date; }
}
