/* ========================================
   Admin console — user management table
   ======================================== */

.admin-main {
  max-width: 1200px;
}

/* Stats row */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.admin-stat {
  text-align: center;
  padding: 20px 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
}

.admin-stat-num {
  font-size: 28px;
  font-weight: 600;
  color: var(--soft-white);
  background: linear-gradient(135deg, var(--soft-purple), var(--teal-glow));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.admin-stat-label {
  font-size: 11px;
  color: var(--subtle-gray);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.live-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
  animation: livePulse 2s ease-in-out infinite;
  -webkit-text-fill-color: initial;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Search + filter controls */
.admin-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.admin-search {
  flex: 1;
  min-width: 220px;
  padding: 12px 18px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 100px;
  color: var(--soft-white);
  font-family: inherit;
  font-size: 13px;
}

.admin-search:focus {
  outline: none;
  border-color: rgba(94, 234, 212, 0.4);
  box-shadow: 0 0 24px rgba(94, 234, 212, 0.12);
}

.admin-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-filter {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 100px;
  color: var(--subtle-gray);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: var(--transition-base);
}

.admin-filter:hover {
  background: rgba(94, 234, 212, 0.06);
  color: var(--soft-white);
}

.admin-filter.active {
  background: linear-gradient(135deg, rgba(184, 164, 216, 0.25), rgba(94, 234, 212, 0.25));
  border-color: rgba(94, 234, 212, 0.4);
  color: var(--soft-white);
}

/* Table */
.admin-table-wrap {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  overflow: hidden;
  overflow-x: auto;
}

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

.admin-table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--subtle-gray);
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--soft-white);
}

.admin-table tbody tr {
  transition: var(--transition-base);
}

.admin-table tbody tr:hover {
  background: rgba(94, 234, 212, 0.04);
}

.admin-loading-row {
  text-align: center;
  padding: 40px !important;
  color: var(--subtle-gray);
  font-style: italic;
}

/* Status dot */
.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #555;
}

.status-online {
  background: #34D399;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.7);
  animation: livePulse 2s ease-in-out infinite;
}

.status-recent {
  background: #FCD34D;
  box-shadow: 0 0 6px rgba(252, 211, 77, 0.4);
}

.status-today {
  background: #818CF8;
}

.status-offline {
  background: #4B5563;
}

/* User cell */
.user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--deep-navy);
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--soft-purple), var(--teal-glow));
}

.user-avatar.tester {
  background: linear-gradient(135deg, #FFD700, var(--teal-glow));
  box-shadow: 0 0 12px rgba(255, 215, 100, 0.4);
}

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

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--soft-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.user-email {
  font-size: 11px;
  color: var(--subtle-gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.tester-badge {
  display: inline-block;
  padding: 3px 10px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(94, 234, 212, 0.15));
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  color: #FFD700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* Signup-source pill — shows where each user registered from */
.signup-source-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.ssb-beta  { background: rgba(124, 58, 237, 0.14); color: #7c3aed; border: 1px solid rgba(124, 58, 237, 0.4); }
.ssb-admin { background: rgba(211, 0, 10, 0.12);   color: #d3000a; border: 1px solid rgba(211, 0, 10, 0.35); }
.ssb-web   { background: rgba(13, 148, 136, 0.10); color: #0d9488; border: 1px solid rgba(13, 148, 136, 0.30); }
body.theme-daylight .ssb-beta  { background: #f3e8ff; color: #6b21a8; }
body.theme-daylight .ssb-admin { background: #fee2e2; color: #991b1b; }
body.theme-daylight .ssb-web   { background: #ccfbf1; color: #115e59; }

/* ─── Row actions ─── */
.admin-row-actions {
  display: inline-flex;
  gap: 4px;
}
.admin-act-btn {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--soft-white, #f5f7fa);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.admin-act-btn:hover {
  background: rgba(124, 58, 237, 0.18);
  border-color: rgba(124, 58, 237, 0.5);
  transform: translateY(-1px);
}
.admin-act-btn.ban-btn:hover     { background: rgba(239,68,68,0.18); border-color:#ef4444; }
.admin-act-btn.premium-btn:hover { background: rgba(245,158,11,0.18); border-color:#f59e0b; }
.admin-act-btn.credits-btn:hover { background: rgba(94,234,212,0.18); border-color:#5eead4; }
body.theme-daylight .admin-act-btn {
  background: #fff; border-color: #e5e5e5; color: #1a1a1a;
}

/* ─── Audit log ─── */
.audit-log {
  max-height: 460px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
}
body.theme-daylight .audit-log {
  background: #fff; border-color: #e5e5e5;
}
.audit-row {
  display: grid;
  grid-template-columns: 160px 130px 140px 1fr;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 12.5px;
  align-items: center;
}
.audit-row:last-child { border-bottom: none; }
body.theme-daylight .audit-row { border-bottom-color: #f1f5f9; }
.audit-when    { color: var(--subtle-gray, #888); font-variant-numeric: tabular-nums; }
.audit-action  {
  font-weight: 700; font-size: 11px; letter-spacing: 0.8px;
  padding: 3px 8px; border-radius: 6px; text-align: center;
}
.audit-ban           { background: rgba(239,68,68,0.18);  color: #ef4444; }
.audit-unban         { background: rgba(34,197,94,0.18);  color: #22c55e; }
.audit-promote_dev   { background: rgba(245,158,11,0.18); color: #f59e0b; }
.audit-demote        { background: rgba(148,163,184,0.18);color: #94a3b8; }
.audit-grant_premium { background: rgba(124,58,237,0.18); color: #a78bfa; }
.audit-delete_post,
.audit-delete_reply,
.audit-delete_dm     { background: rgba(239,68,68,0.10);  color: #ef4444; }
.audit-target { color: var(--subtle-gray, #888); font-family: ui-monospace, monospace; font-size: 11px; }
.audit-reason { color: var(--soft-white, #f5f7fa); }
body.theme-daylight .audit-reason { color: #0F172A; }
body.theme-daylight .audit-when,
body.theme-daylight .audit-target { color: #64748b; }

@media (max-width: 720px) {
  .audit-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* Error state */
.admin-error {
  margin-top: 24px;
  padding: 24px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 14px;
  text-align: center;
}

.admin-error h3 {
  color: #F87171;
  font-size: 16px;
  margin-bottom: 8px;
}

.admin-error p {
  font-size: 13px;
  color: var(--soft-white);
  line-height: 1.5;
}

@media (max-width: 768px) {
  .admin-stats { grid-template-columns: 1fr 1fr; }
  .admin-table { font-size: 12px; }
  .admin-table th, .admin-table td { padding: 10px 8px; }
  .user-name, .user-email { max-width: 140px; }
}
