/* BetZap — Painel administrativo v2
   Tela de Usuários no padrão da referência: KPIs, abas segmentadas,
   tabela densa e ficha do jogador.
   Escopo: .adm-* exclusivos da v2 (carregar após betzap-admin-v1.css). */

/* ---------- estrutura da página ---------- */
.adm-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 10px;
}

.adm-crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1;
}

.adm-crumbs a { color: var(--muted); flex: none; }
.adm-crumbs a:hover { color: var(--accent); }
.adm-crumbs .sep { opacity: .45; flex: none; }
.adm-crumbs > span:last-child { color: var(--text); }
.adm-crumbs > span:not(.sep) {
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adm-titlebar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.adm-titlebar h1 {
  margin: 0;
  font-family: 'Montserrat', 'Outfit', sans-serif;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -.5px;
}

.adm-titlebar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.adm-titlebar .actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.adm-titlebar .actions .btn { margin: 0; }

/* ---------- KPIs ---------- */
.adm-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.adm-kpi {
  position: relative;
  padding: 16px 18px 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.adm-kpi::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), transparent);
  opacity: .65;
}

.adm-kpi span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.adm-kpi strong {
  display: block;
  margin-top: 8px;
  font-family: 'Montserrat', 'Outfit', sans-serif;
  font-size: 27px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -.6px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ---------- abas segmentadas ---------- */
.adm-seg {
  display: inline-flex;
  align-self: flex-start;
  gap: 3px;
  max-width: 100%;
  padding: 4px;
  background: #0c151c;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
}

.adm-seg button {
  padding: 9px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}

.adm-seg button:hover { color: var(--text); }

.adm-seg button.active {
  background: rgba(0, 221, 160, .13);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(0, 221, 160, .22);
}

/* ---------- painéis ---------- */
.adm-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.adm-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.adm-panel-head h2 {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -.1px;
}

/* ---------- barra de busca ---------- */
.adm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.adm-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 420px;
  height: 38px;
  padding: 0 11px;
  background: #0c161e;
  border: 1px solid var(--line);
  border-radius: 9px;
  transition: border-color .15s ease;
}

.adm-search:focus-within { border-color: rgba(0, 221, 160, .55); }
.adm-search .icon, .adm-search svg { color: var(--muted); flex: none; width: 15px; height: 15px; }

.adm-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  outline: 0;
}

.adm-search input::placeholder { color: #6d818d; }

.adm-count {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

/* ---------- tabela densa ---------- */
.adm-tablewrap { overflow-x: auto; }

.adm-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  white-space: nowrap;
  font-size: 12.5px;
}

.adm-table th {
  padding: 11px 14px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .11em;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, .14);
}

.adm-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.adm-table tbody tr:last-child td { border-bottom: 0; }
.adm-table tbody tr:hover td { background: rgba(255, 255, 255, .022); }

.adm-table .adm-empty {
  padding: 30px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- células ---------- */
.adm-id {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border: 1px solid rgba(0, 221, 160, .3);
  border-radius: 6px;
  background: rgba(0, 221, 160, .08);
  color: #7ff0c8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  letter-spacing: .3px;
  white-space: nowrap;
}

.adm-usercell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.adm-av {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, rgba(0, 221, 160, .32), rgba(0, 221, 160, .08));
  border: 1px solid rgba(0, 221, 160, .28);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.adm-userinfo {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.adm-userinfo strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}

.adm-userinfo small {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.3;
}

.adm-email {
  display: inline-flex;
  align-items: center;
  max-width: 240px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 6px;
  background: rgba(255, 255, 255, .04);
  color: #bcd3c8;
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-bal {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.adm-bal.out { color: #ff9b9b; }

.adm-date {
  color: var(--muted);
  font-size: 11px;
}

.adm-when { display: none; }

.adm-tag {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .08);
  color: #cfe0d8;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-style: normal;
}

.adm-tag.warn {
  background: rgba(255, 176, 32, .15);
  color: #ffcf70;
}

.adm-tag.ok {
  background: rgba(0, 221, 160, .14);
  color: #6ef0c4;
}

/* ---------- ações de linha ---------- */
.adm-row-act {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.adm-link {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 0;
  white-space: nowrap;
}

.adm-link:hover { text-decoration: underline; }

.adm-mini {
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.adm-mini.danger {
  color: #ff9b9b;
  background: rgba(255, 92, 92, .09);
  border-color: rgba(255, 92, 92, .25);
}

.adm-mini.danger:hover { background: rgba(255, 92, 92, .16); }

.adm-mini.ok {
  color: #6ef0c4;
  background: rgba(0, 221, 160, .1);
  border-color: rgba(0, 221, 160, .26);
}

.adm-mini.ok:hover { background: rgba(0, 221, 160, .17); }

/* ---------- ficha: grade ---------- */
.adm-user-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: start;
}

.adm-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.adm-side .adm-panel { overflow: visible; }
.adm-side .adm-panel-head { border-radius: 12px 12px 0 0; }

.adm-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  padding: 16px;
}

.adm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.adm-field span {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.adm-field input {
  width: 100%;
  height: 38px;
  min-height: 38px;
  padding: 0 11px;
  background: #0c161e;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 12.5px;
  opacity: 1;
  -webkit-text-fill-color: var(--text);
}

.adm-field input:disabled { cursor: default; }

.adm-field input:focus { outline: 0; }

/* ---------- toggle de status ---------- */
.adm-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.adm-toggle > div { min-width: 0; }

.adm-toggle strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
}

.adm-toggle small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.adm-switch {
  flex: none;
  position: relative;
  width: 46px;
  height: 26px;
  padding: 0;
  border-radius: 99px;
  background: #36434b;
  transition: background .18s ease;
}

.adm-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: left .18s ease;
}

.adm-switch.on { background: var(--accent); }
.adm-switch.on::after { left: 23px; }
.adm-switch:disabled { opacity: .55; cursor: default; }

.adm-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 16px 16px;
}

.adm-actions-row .btn { margin: 0; }
.adm-actions-row .adm-muted { font-size: 11px; line-height: 1.4; }

.adm-muted { color: var(--muted); }

/* ---------- chave/valor ---------- */
.adm-kv {
  display: flex;
  flex-direction: column;
  padding: 4px 16px 10px;
}

.adm-kv > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, .07);
}

.adm-kv > div:last-child { border-bottom: 0; }

.adm-kv span {
  color: var(--muted);
  font-size: 11.5px;
}

.adm-kv strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.adm-green { color: var(--accent) !important; }

/* ---------- rollover ---------- */
.adm-progress {
  height: 7px;
  margin: 2px 16px 8px;
  border-radius: 99px;
  background: #0c161e;
  border: 1px solid var(--line);
  overflow: hidden;
}

.adm-progress i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #00b887, var(--accent));
}

.adm-progress-label {
  padding: 0 16px 14px;
  color: var(--muted);
  font-size: 11px;
}

/* ---------- estados ---------- */
.adm-loading {
  padding: 44px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}

.adm-tx { margin-bottom: 4px; }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) {
  .adm-user-grid { grid-template-columns: minmax(0, 1fr); }
  .adm-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-side .adm-panel:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .adm-email { max-width: 150px; }
}

@media (max-width: 760px) {
  .adm-titlebar h1 { font-size: 22px; }
  .adm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-kpi strong { font-size: 23px; }

  .adm-users-table th:nth-child(3),
  .adm-users-table td:nth-child(3) { display: none; }

  .adm-toolbar { flex-wrap: wrap; }
  .adm-search { max-width: none; flex-basis: 100%; }
  .adm-count { order: 2; }
}

@media (max-width: 620px) {
  .adm-side { grid-template-columns: minmax(0, 1fr); }
  .adm-field-grid { grid-template-columns: minmax(0, 1fr); }

  .adm-users-table th:nth-child(1),
  .adm-users-table td:nth-child(1),
  .adm-users-table th:nth-child(3),
  .adm-users-table td:nth-child(3),
  .adm-users-table th:nth-child(5),
  .adm-users-table td:nth-child(5),
  .adm-users-table th:nth-child(6),
  .adm-users-table td:nth-child(6) { display: none; }

  .adm-tx .adm-table th:nth-child(1),
  .adm-tx .adm-table td:nth-child(1),
  .adm-tx .adm-table th:nth-child(5),
  .adm-tx .adm-table td:nth-child(5) { display: none; }

  .adm-userinfo { max-width: 112px; }
  .adm-userinfo strong,
  .adm-userinfo small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .adm-table th,
  .adm-table td { padding: 11px 10px; }

  .adm-link { font-size: 11.5px; }
  .adm-row-act { gap: 8px; }
  .adm-row-act .adm-mini { display: none; }
  .adm-actions-row .btn { width: 100%; justify-content: center; }

  .adm-when {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.3;
  }
}

@media (min-width: 390px) and (max-width: 620px) {
  .adm-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-side .adm-panel:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .adm-side .adm-panel-head { padding: 12px 14px; }
  .adm-side .adm-kv { padding: 4px 14px 8px; }
  .adm-side .adm-kv span { font-size: 11px; }
  .adm-side .adm-kv strong { font-size: 12px; }
}

@media (max-width: 460px) {
  .adm-kpis { grid-template-columns: minmax(0, 1fr); }
  .adm-seg { display: flex; width: 100%; }
  .adm-seg button { flex: 1 0 auto; }
  .adm-titlebar .actions { width: 100%; }
  .adm-titlebar .actions .btn { flex: 1; justify-content: center; }
}
