/* Admin Dashboard Styles */
.admin-container {
  max-width: 1680px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 24px;
  box-sizing: border-box;
}

@media (max-width: 1400px) {
  .admin-container {
    padding: 20px 18px;
  }
}

@media (max-width: 768px) {
  .admin-container {
    padding: 14px 12px;
  }
}

.admin-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.admin-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-badge {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fb7185;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-purple);
}

.stat-card.emerald::after { background: var(--accent-emerald); }
.stat-card.cyan::after { background: var(--accent-cyan); }
.stat-card.amber::after { background: var(--accent-amber); }

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Action Bar */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.action-bar h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

/* Peer & Users Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) rgba(15, 23, 42, 0.6);
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}

.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.84rem;
  letter-spacing: -0.01em;
}

.admin-table th {
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  padding: 10px 12px;
  font-weight: 600;
  font-size: 0.76rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.admin-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-active {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-disabled {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-revoked {
  background: rgba(244, 63, 94, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon.danger:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: rgba(244, 63, 94, 0.4);
  color: #fca5a5;
}

.ip-badge {
  display: inline-flex;
  align-items: center;
  max-width: 135px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.25);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: all;
  direction: ltr;
}

.ip-badge:hover {
  background: rgba(34, 211, 238, 0.18);
  border-color: rgba(34, 211, 238, 0.5);
  color: #fff;
  transform: translateY(-1px);
}

/* User Groups Accordion */
.user-group-header {
  background: linear-gradient(90deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%) !important;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
  border-top: 2px solid rgba(56, 189, 248, 0.25) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.user-group-header:hover {
  background: linear-gradient(90deg, rgba(51, 65, 85, 0.95) 0%, rgba(30, 41, 59, 0.98) 100%) !important;
}

.user-group-header td {
  padding: 10px 14px !important;
}

.user-group-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.user-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-group-arrow {
  font-size: 0.72rem;
  color: var(--accent-cyan);
  display: inline-block;
  transition: transform 0.2s ease;
  width: 14px;
  text-align: center;
}

.user-group-header.collapsed .user-group-arrow {
  transform: rotate(-90deg);
}

.user-group-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: #f8fafc;
}

.user-group-tag {
  font-size: 0.76rem;
  color: var(--accent-cyan);
  font-weight: 500;
}

.user-group-id {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.user-group-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
}

.user-group-badge {
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: #67e8f9;
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.74rem;
}

.user-group-traffic {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.76rem;
}

.user-group-row td:first-child {
  padding-left: 26px !important;
  position: relative;
}

.user-group-row td:first-child::before {
  content: '↳';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.82rem;
}

.pubkey-pill {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.76rem;
  transition: all 0.15s ease;
}

.pubkey-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  padding: 28px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  animation: fadeIn 0.25s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.close-btn:hover {
  color: var(--text-main);
}
