/* ==========================================================
   RUSTY NAIL — STATS
   Страница статистики: панель, метрики, таблица, пагинация
   ========================================================== */

/* ==========================================================
   HEAD
   ========================================================== */
.page-head {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  background: var(--accent-08);
  border: 1px solid var(--accent-30);
  border-radius: var(--r);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.3px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.page-eyebrow i { font-size: 11px; }

.page-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.025em;
  margin: 0 0 8px;
  line-height: 1.1;
}

.page-sub {
  font-size: 14px;
  color: var(--text-2);
  margin: 0;
  font-weight: 500;
}

.page-sub span { color: var(--accent); font-weight: 600; }

/* ==========================================================
   ПАНЕЛЬ УПРАВЛЕНИЯ
   ========================================================== */
.stats-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 16px;
}

/* ===== МЕТРИКИ (сверху) ===== */
.stats-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.stats-metric {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: all .2s;
}

.stats-metric:hover {
  background: var(--bg-3);
  transform: translateY(-1px);
}

.stats-metric-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.stats-metric-icon.i-orange { background: var(--accent-08); color: var(--accent); }
.stats-metric-icon.i-red    { background: rgba(224, 52, 44, 0.12); color: var(--accent-2); }
.stats-metric-icon.i-green  { background: rgba(123, 201, 111, 0.12); color: var(--green); }
.stats-metric-icon.i-blue   { background: rgba(103, 232, 249, 0.1); color: #67e8f9; }

.stats-metric-body { min-width: 0; flex: 1; }

.stats-metric-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stats-metric-label {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  margin-top: 3px;
}

@media (max-width: 900px) {
  .stats-metrics { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .stats-metrics { grid-template-columns: 1fr; }
}

/* ===== СЕРВЕРЫ (снизу) ===== */
.stats-servers {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  align-self: flex-start;
  flex-wrap: wrap;
}

.stats-server-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border: none;
  background: transparent;
  border-radius: var(--r);
  color: var(--text-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}

.stats-server-btn:hover {
  color: var(--text);
  background: var(--bg-1);
}

.stats-server-btn.is-active {
  color: #fff;
  background: var(--accent-grad);
  box-shadow: 0 4px 12px rgba(224, 52, 44, 0.3);
}

/* ===== ТУЛБАР (поиск) ===== */
.stats-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ==========================================================
   ТАБЛИЦА
   ========================================================== */
.stats-table-wrap {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 16px;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.stats-table thead th {
  background: var(--bg);
  color: var(--text-3);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.8px;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

.stats-table thead th.text-center { text-align: center; }
.stats-table thead th.text-right  { text-align: right; }

.stats-table thead th.sortable {
  cursor: pointer;
  transition: color .15s, background .15s;
}

.stats-table thead th.sortable:hover {
  color: var(--text);
  background: var(--bg-1);
}

.stats-table thead th .sort-ico {
  margin-left: 5px;
  opacity: 0.35;
  font-size: 10px;
  transition: opacity .15s, color .15s;
}

.stats-table thead th.sortable:hover .sort-ico {
  opacity: 0.7;
}

.stats-table thead th.sort-desc .sort-ico,
.stats-table thead th.sort-asc .sort-ico {
  opacity: 1;
  color: var(--accent);
}

.stats-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}

.stats-table tbody tr:last-child { border-bottom: none; }
.stats-table tbody tr:hover { background: var(--bg-2); }

.stats-table tbody td {
  padding: 10px 14px;
  vertical-align: middle;
}

.stats-table tbody td.text-center { text-align: center; }
.stats-table tbody td.text-right  { text-align: right; }

/* ==========================================================
   ЯЧЕЙКА РАНГА
   ========================================================== */
.stats-cell-rank {
  padding-left: 18px !important;
  padding-right: 0 !important;
}

.stats-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 800;
  background: var(--bg-3);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.stats-rank.gold {
  background: linear-gradient(135deg, #ffd700, #d4a017);
  color: #1a1716;
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.35);
}

.stats-rank.silver {
  background: linear-gradient(135deg, #e0e0e0, #a0a0a8);
  color: #1a1716;
}

.stats-rank.bronze {
  background: linear-gradient(135deg, #cd7f32, #8b4513);
  color: #fff;
}

/* ==========================================================
   ЯЧЕЙКА ИГРОКА
   ========================================================== */
.stats-cell-user {
  padding-left: 0 !important;
  padding-right: 14px !important;
}

.stats-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.stats-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-3);
  border: 2px solid var(--bg-3);
  flex-shrink: 0;
  transition: border-color .15s;
}

.stats-table tbody tr:hover .stats-avatar {
  border-color: var(--accent);
}

.stats-user-info {
  min-width: 0;
  flex: 1;
}

.stats-user-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.stats-user-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================
   ЧИСЛА
   ========================================================== */
.stats-kd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 4px 10px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: var(--bg-3);
}

.stats-kd.high { color: var(--green); background: rgba(123, 201, 111, 0.12); }
.stats-kd.mid  { color: var(--accent); background: var(--accent-08); }
.stats-kd.low  { color: var(--text-2); }

.stats-num {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stats-num-muted {
  color: var(--text-3);
  font-weight: 600;
}

.stats-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================
   ПАГИНАЦИЯ
   ========================================================== */
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}

.page-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border-2);
  background: var(--bg-2);
}

.page-btn.is-active {
  color: #fff;
  background: var(--accent-grad);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(224, 52, 44, 0.3);
}

.page-btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.page-btn-sep {
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  color: var(--text-3);
  font-size: 13px;
}

/* ==========================================================
   ПРАВАЯ КОЛОНКА — ТОП-3
   ========================================================== */
.top3-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.top3-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: all .18s;
}

.top3-item:hover {
  background: var(--bg-3);
  transform: translateX(2px);
}

.top3-rank {
  width: 28px;
  height: 28px;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  background: var(--bg-3);
  color: var(--text-2);
  flex-shrink: 0;
}

.top3-rank.gold {
  background: linear-gradient(135deg, #ffd700, #d4a017);
  color: #1a1716;
}

.top3-rank.silver {
  background: linear-gradient(135deg, #e0e0e0, #a0a0a8);
  color: #1a1716;
}

.top3-rank.bronze {
  background: linear-gradient(135deg, #cd7f32, #8b4513);
  color: #fff;
}

.top3-body { min-width: 0; flex: 1; }

.top3-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
  margin-bottom: 2px;
}

.top3-stats {
  font-size: 10px;
  color: var(--text-3);
  font-weight: 600;
}

/* ==========================================================
   ИНФО-БЛОК «Как читать»
   ========================================================== */
.stats-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stats-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-2);
  border-radius: var(--r);
  font-size: 12px;
}

.stats-info-row span { color: var(--text-3); font-weight: 600; }
.stats-info-row b { color: var(--text); font-weight: 800; }

.stats-info-text {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.5;
  padding: 10px 12px;
  background: var(--bg-2);
  border-radius: var(--r);
  border-left: 2px solid var(--accent);
}

/* ==========================================================
   АДАПТИВ
   ========================================================== */
@media (max-width: 768px) {
  .stats-table thead th:nth-child(5),
  .stats-table tbody td:nth-child(5) {
    display: none;
  }
}

@media (max-width: 480px) {
  .stats-table thead th:nth-child(4),
  .stats-table tbody td:nth-child(4) {
    display: none;
  }
}

/* ==========================================================
   LAYOUT FULL (без сайдбара)
   ========================================================== */
.layout-full {
  grid-template-columns: 1fr;
  max-width: 1200px;
}

/* ==========================================================
   ПЛАВНАЯ АНИМАЦИЯ ПОЯВЛЕНИЯ СТРОК ТАБЛИЦЫ
   ========================================================== */
@keyframes statsRowIn {
  0% {
    opacity: 0;
    transform: translateY(-6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.stats-table tbody tr.stats-row-anim {
  animation: statsRowIn 0.55s cubic-bezier(.22, 1, .36, 1) both;
}

/* ==========================================================
   ТАБЫ (Игроки / Баны)
   ========================================================== */
.stats-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.stats-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 18px;
  border: none;
  background: transparent;
  border-radius: var(--r);
  color: var(--text-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}

.stats-tab i { font-size: 15px; }

.stats-tab:hover {
  color: var(--text);
  background: var(--bg-2);
}

.stats-tab.is-active {
  color: #fff;
  background: var(--accent-grad);
  box-shadow: 0 4px 12px rgba(224, 52, 44, 0.3);
}

.stats-tab.is-active:hover {
  color: #fff;
  background: var(--accent-grad);
}

.stats-panel-wrap {
  display: block;
}

/* ==========================================================
   ТАБЛИЦА БАНОВ
   ========================================================== */
.bans-table thead th {
  /* ничего специфичного */
}

.bans-avatar {
  filter: grayscale(0.4);
  opacity: 0.85;
}

.ban-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.ban-icon-perm {
  background: rgba(224, 52, 44, 0.15);
  color: var(--accent);
  border: 1px solid rgba(224, 52, 44, 0.35);
}

.ban-icon-temp {
  background: rgba(253, 186, 116, 0.12);
  color: #fdba74;
  border: 1px solid rgba(253, 186, 116, 0.3);
}

.ban-reason {
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  vertical-align: middle;
}

.ban-admin {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.ban-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.ban-duration {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--r);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.ban-duration-perm {
  background: rgba(224, 52, 44, 0.12);
  color: var(--accent);
  border: 1px solid rgba(224, 52, 44, 0.3);
}

.ban-duration-temp {
  background: rgba(123, 201, 111, 0.1);
  color: var(--green);
  border: 1px solid rgba(123, 201, 111, 0.3);
}

/* ==========================================================
   АДАПТИВ ТАБОВ
   ========================================================== */
@media (max-width: 600px) {
  .stats-tabs { width: 100%; }
  .stats-tab { flex: 1; justify-content: center; padding: 0 12px; }
  .stats-tab span { display: none; }
  .stats-tab i { font-size: 16px; }

  .stats-table thead th:nth-child(3),
  .stats-table tbody td:nth-child(3) { display: none; }
}