/* Admin Dashboard Styles */
.admin-badge-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff !important;
  font-weight: 700;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.8rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
  transition: all 0.2s ease;
}
.admin-badge-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5);
  background: linear-gradient(135deg, #fbbf24, #d97706);
}

.admin-banner {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md, 10px);
  padding: 14px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.admin-banner-text {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: #fbbf24;
}
.admin-banner-text strong {
  color: #fef3c7;
}

.admin-dashboard-container {
  background: var(--surface, #111e33);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-lg, 16px);
  padding: 32px 28px;
  margin-bottom: 40px;
  box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.4);
  animation: fadeInAdmin 0.3s ease-out;
}

@keyframes fadeInAdmin {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.admin-dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
}
.admin-dash-title h2 {
  font-size: 1.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.02em;
}
.admin-dash-title p {
  color: var(--text-muted, #94a3b8);
  font-size: 0.9rem;
  margin-top: 4px;
}
.admin-dash-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-admin-action {
  padding: 8px 16px;
  border-radius: var(--radius-sm, 6px);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.15));
  background: rgba(255, 255, 255, 0.04);
  color: var(--text, #f1f5f9);
  transition: all 0.2s;
}
.btn-admin-action:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent, #38bdf8);
}
.btn-admin-action.primary {
  background: var(--primary, #0284c7);
  border-color: var(--primary, #0284c7);
  color: #fff;
}
.btn-admin-action.primary:hover {
  background: var(--primary-hover, #0369a1);
}

/* KPI Cards */
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.admin-kpi-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-md, 10px);
  padding: 20px 18px;
  position: relative;
  overflow: hidden;
}
[data-theme="light"] .admin-kpi-card {
  background: #f8fafc;
}
.kpi-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text, #f1f5f9);
  line-height: 1.2;
}
.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
  margin-top: 4px;
}

/* Controls Bar */
.admin-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}
.admin-search-wrap {
  position: relative;
  flex: 1 1 240px;
  max-width: 360px;
}
.admin-search-input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-sm, 6px);
  color: var(--text, #fff);
  font-size: 0.9rem;
  outline: none;
}
[data-theme="light"] .admin-search-input {
  background: #ffffff;
}
.admin-search-input:focus {
  border-color: var(--accent, #38bdf8);
}
.admin-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted, #94a3b8);
  pointer-events: none;
  font-size: 0.9rem;
}

.admin-filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
  background: transparent;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover {
  color: var(--text, #fff);
  border-color: var(--accent, #38bdf8);
}
.filter-btn.active {
  background: var(--accent-subtle, rgba(56, 189, 248, 0.15));
  border-color: var(--accent, #38bdf8);
  color: var(--accent, #38bdf8);
}

.sort-select {
  padding: 7px 12px;
  border-radius: var(--radius-sm, 6px);
  background: var(--surface, #111e33);
  color: var(--text, #fff);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.15));
  font-size: 0.85rem;
  outline: none;
}

/* 50-User Table */
.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-md, 10px);
  margin-bottom: 24px;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}
.admin-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 16px;
  font-weight: 700;
  color: var(--text-muted, #94a3b8);
  border-bottom: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
[data-theme="light"] .admin-table th {
  background: #f1f5f9;
}
.admin-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--card-border, rgba(255, 255, 255, 0.05));
  color: var(--text, #f1f5f9);
  vertical-align: middle;
}
.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
[data-theme="light"] .admin-table tr:hover td {
  background: #f8fafc;
}

.user-badge-cell strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text, #fff);
}
.user-badge-cell small {
  font-family: monospace;
  color: var(--text-muted, #94a3b8);
  font-size: 0.78rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-pill.active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.status-pill.inactive {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.status-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.score-badge {
  display: inline-block;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 0.85rem;
}
.score-badge.high { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.score-badge.med  { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.score-badge.low  { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.score-badge.none { color: var(--text-muted, #94a3b8); }

.btn-history-toggle {
  background: transparent;
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.15));
  color: var(--accent, #38bdf8);
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-history-toggle:hover {
  background: var(--accent-subtle, rgba(56, 189, 248, 0.15));
}

/* Accordion Drawer */
.history-drawer-row td {
  padding: 0 !important;
  background: rgba(0, 0, 0, 0.2) !important;
}
[data-theme="light"] .history-drawer-row td {
  background: #f1f5f9 !important;
}
.history-drawer-content {
  padding: 16px 20px;
  border-top: 1px dashed var(--card-border, rgba(255, 255, 255, 0.1));
}
.history-drawer-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 10px;
}
.session-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface, #111e33);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}
[data-theme="light"] .session-list-item {
  background: #ffffff;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Tabs Navigation */
.admin-nav-tabs {
  display: flex;
  gap: 10px;
  border-bottom: 2px solid var(--card-border, rgba(255, 255, 255, 0.08));
  margin-bottom: 24px;
}
.admin-nav-tab {
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted, #94a3b8);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: -2px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.admin-nav-tab:hover {
  color: var(--text, #fff);
}
.admin-nav-tab.active {
  color: var(--accent, #38bdf8);
  border-bottom-color: var(--accent, #38bdf8);
}

/* Add User Form Card */
.add-user-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-md, 10px);
  padding: 20px;
  margin-bottom: 24px;
  animation: fadeInAdmin 0.2s ease-out;
}
[data-theme="light"] .add-user-card {
  background: #f1f5f9;
}
.add-user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 9px 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.15));
  border-radius: var(--radius-sm, 6px);
  color: var(--text, #fff);
  font-size: 0.9rem;
  box-sizing: border-box;
}
[data-theme="light"] .form-input {
  background: #fff;
}
.input-with-action {
  display: flex;
  gap: 6px;
}
.btn-input-action {
  padding: 0 12px;
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-hover, #162640);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.15));
  color: var(--text, #fff);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Toast */
.admin-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0284c7;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  z-index: 9999;
  animation: toastIn 0.3s ease-out;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
