/* KreepCore - Admin Stats dashboard */

#admin-panel-stats .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 12px 0 20px;
}

#admin-panel-stats .stats-kpi {
  background: rgba(10, 20, 32, 0.65);
  border: 1px solid rgba(90, 200, 255, 0.18);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#admin-panel-stats .stats-kpi .kpi-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7fa3c9;
}

#admin-panel-stats .stats-kpi .kpi-value {
  font-size: 26px;
  font-weight: 600;
  color: #d3f0ff;
}

#admin-panel-stats .stats-kpi .kpi-sub {
  font-size: 11px;
  color: #8faab7;
}

#admin-panel-stats .stats-section {
  margin: 24px 0;
}

#admin-panel-stats .stats-section h3 {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7fa3c9;
  margin: 0 0 10px;
  font-weight: 600;
}

#admin-panel-stats .stats-bar-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  line-height: 1.8;
}

#admin-panel-stats .stats-bar-row .bar-date { color: #8faab7; font-variant-numeric: tabular-nums; }
#admin-panel-stats .stats-bar-row .bar-count { color: #d3f0ff; font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }

#admin-panel-stats .stats-bar-track {
  height: 14px;
  background: rgba(30, 50, 70, 0.45);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

#admin-panel-stats .stats-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(80, 220, 255, 0.55), rgba(60, 160, 220, 0.9));
  border-radius: 3px;
  transition: width 0.4s ease;
}

#admin-panel-stats .stats-bar-fill.visits { background: linear-gradient(90deg, rgba(170, 120, 255, 0.55), rgba(130, 80, 220, 0.9)); }
#admin-panel-stats .stats-bar-fill.regs   { background: linear-gradient(90deg, rgba(120, 255, 170, 0.55), rgba(60, 200, 120, 0.9)); }
#admin-panel-stats .stats-bar-fill.logins { background: linear-gradient(90deg, rgba(80, 220, 255, 0.55), rgba(60, 160, 220, 0.9)); }

#admin-panel-stats .stats-series-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

#admin-panel-stats .stats-series-tab {
  background: rgba(20, 30, 45, 0.6);
  border: 1px solid rgba(100, 160, 200, 0.2);
  color: #a0bccb;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.05em;
}

#admin-panel-stats .stats-series-tab.active {
  background: rgba(60, 140, 200, 0.3);
  color: #d3f0ff;
  border-color: rgba(120, 200, 255, 0.5);
}

#admin-panel-stats .stats-geo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#admin-panel-stats .stats-geo-table th,
#admin-panel-stats .stats-geo-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(80, 130, 170, 0.12);
}

#admin-panel-stats .stats-geo-table th {
  color: #7fa3c9;
  font-weight: 500;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
}

#admin-panel-stats .stats-geo-table td.c-flag { font-size: 18px; }
#admin-panel-stats .stats-geo-table td.c-code { color: #a0bccb; font-family: var(--font-mono); }
#admin-panel-stats .stats-geo-table td.c-num  { text-align: right; color: #d3f0ff; font-variant-numeric: tabular-nums; }

#admin-panel-stats .stats-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
}
#admin-panel-stats .stats-pill.ok  { background: rgba(60, 200, 120, 0.15); color: #6fd89b; border: 1px solid rgba(80, 220, 140, 0.3); }
#admin-panel-stats .stats-pill.warn { background: rgba(255, 200, 60, 0.15); color: #ffd36b; border: 1px solid rgba(255, 210, 90, 0.3); }
#admin-panel-stats .stats-pill.bad  { background: rgba(255, 90, 90, 0.15); color: #ff9a9a; border: 1px solid rgba(255, 120, 120, 0.3); }

#admin-panel-stats .stats-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

#admin-panel-stats .stats-health-card {
  background: rgba(10, 20, 32, 0.65);
  border: 1px solid rgba(90, 200, 255, 0.12);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
#admin-panel-stats .stats-health-card .label { color: #8faab7; }

#admin-panel-stats .stats-health-card--click {
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
#admin-panel-stats .stats-health-card--click:hover {
  background: rgba(20, 40, 60, 0.75);
  border-color: rgba(120, 200, 255, 0.35);
}

.stats-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 5, 15, 0.82);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.stats-modal {
  background: #0a1520;
  border: 1px solid rgba(90, 200, 255, 0.3);
  border-radius: 8px;
  width: 100%;
  max-width: 1100px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.stats-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(90, 200, 255, 0.18);
}
.stats-modal-header h3 {
  margin: 0;
  color: #d3f0ff;
  font-size: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
}

.stats-modal-body {
  overflow: auto;
  padding: 0;
}

.stats-error-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.stats-error-table th,
.stats-error-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(80, 130, 170, 0.1);
  vertical-align: top;
}
.stats-error-table th {
  position: sticky;
  top: 0;
  background: #0a1520;
  color: #7fa3c9;
  font-weight: 500;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.08em;
  z-index: 1;
}
.stats-error-table td { color: #c4d8e4; }
.stats-error-table td.font-mono { font-family: var(--font-mono); font-size: 11px; color: #a0bccb; }
.stats-error-table td.err-msg { color: #ff9a9a; max-width: 420px; word-break: break-word; }
.stats-error-table td.err-file { color: #8faab7; max-width: 240px; word-break: break-all; }
.stats-error-table tr.stats-error-row { cursor: pointer; }
.stats-error-table tr.stats-error-row:hover td { background: rgba(30, 50, 70, 0.35); }
.stats-error-table tr.stats-error-row.open td { background: rgba(40, 70, 100, 0.4); }
.stats-error-table td.expand-chev {
  color: #7fa3c9;
  text-align: center;
  user-select: none;
  font-size: 10px;
}
.stats-error-table tr.stats-error-row.open td.expand-chev { color: #d3f0ff; }

.stats-error-table tr.stats-error-detail td {
  padding: 0;
  background: rgba(6, 12, 20, 0.9);
  border-bottom: 1px solid rgba(90, 200, 255, 0.12);
}

.err-detail {
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.err-field {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  align-items: start;
}
.err-lab {
  color: #7fa3c9;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-top: 2px;
}
.err-val {
  color: #d3f0ff;
  font-size: 12px;
  word-break: break-word;
}
.err-pre {
  margin: 0;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(80, 130, 170, 0.18);
  border-radius: 4px;
  color: #c4d8e4;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.err-pair {
  margin-top: 8px;
  padding: 10px 12px 4px;
  border: 1px solid rgba(255, 170, 90, 0.25);
  border-radius: 4px;
  background: rgba(40, 30, 15, 0.25);
}
.err-pair-h {
  color: #ffc97a;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  font-weight: 600;
}
.err-pair-miss {
  color: #8faab7;
  font-size: 12px;
  font-style: italic;
  padding: 8px 0;
}
