/* ===== Admin Dashboard — Desktop-First Layout ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --admin-bg: #0f0f11;
  --admin-surface: #1a1a1f;
  --admin-surface-hover: #22222a;
  --admin-border: #2a2a35;
  --admin-text: #f0f0f5;
  --admin-text-secondary: #8888a0;
  --admin-accent: #0a84ff;
  --admin-accent-hover: #409cff;
  --admin-green: #30d158;
  --admin-red: #ff453a;
  --admin-orange: #ff9f0a;
  --admin-purple: #bf5af2;
  --admin-sidebar-w: 240px;
  --admin-header-h: 64px;
  --admin-radius: 12px;
  --admin-radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--admin-bg);
  color: var(--admin-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== Sidebar ===== */
.admin-sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--admin-sidebar-w);
  background: var(--admin-surface);
  border-right: 1px solid var(--admin-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--admin-border);
}

.sidebar-logo h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--admin-text);
}

.sidebar-logo span {
  font-size: 11px;
  color: var(--admin-accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--admin-radius-sm);
  color: var(--admin-text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
}

.sidebar-nav a:hover {
  background: var(--admin-surface-hover);
  color: var(--admin-text);
}

.sidebar-nav a.active {
  background: rgba(10, 132, 255, 0.12);
  color: var(--admin-accent);
  font-weight: 600;
}

.sidebar-nav a svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-nav .nav-spacer { flex: 1; }

.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--admin-accent), var(--admin-purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: white;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 11px;
  color: var(--admin-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Main Content ===== */
.admin-main {
  margin-left: var(--admin-sidebar-w);
  min-height: 100vh;
  padding: 28px 32px;
}

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

.admin-header h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.admin-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ===== Section (Tab Content) ===== */
.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
  animation: adminFadeIn 0.25s ease;
}

@keyframes adminFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== KPI Cards ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 20px;
  transition: border-color 0.2s;
}

.kpi-card:hover {
  border-color: var(--admin-accent);
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
}

.kpi-value.green { color: var(--admin-green); }
.kpi-value.blue  { color: var(--admin-accent); }
.kpi-value.orange { color: var(--admin-orange); }
.kpi-value.purple { color: var(--admin-purple); }

.kpi-sub {
  font-size: 12px;
  color: var(--admin-text-secondary);
  margin-top: 6px;
}

/* ===== Chart Grid ===== */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.chart-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 20px;
}

.chart-card h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--admin-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chart-card canvas {
  width: 100% !important;
  max-height: 280px;
}

/* ===== Data Tables ===== */
.table-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.table-search {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-sm);
  color: var(--admin-text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.table-search:focus {
  border-color: var(--admin-accent);
}

.table-search::placeholder {
  color: var(--admin-text-secondary);
}

.table-filter {
  padding: 10px 14px;
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-sm);
  color: var(--admin-text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.data-table-wrapper {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--admin-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  border-bottom: 1px solid var(--admin-border);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.data-table thead th:hover {
  color: var(--admin-text);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--admin-border);
  transition: background 0.1s;
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--admin-surface-hover);
}

.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table td.wrap {
  white-space: normal;
}

/* ===== Badges ===== */
.badge-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-high    { background: rgba(255, 69, 58, 0.15); color: var(--admin-red); }
.badge-medium  { background: rgba(255, 159, 10, 0.15); color: var(--admin-orange); }
.badge-low     { background: rgba(48, 209, 88, 0.15); color: var(--admin-green); }
.badge-admin   { background: rgba(10, 132, 255, 0.15); color: var(--admin-accent); }

.stage-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255,255,255,0.06);
  color: var(--admin-text-secondary);
  text-transform: capitalize;
}

/* ===== Buttons ===== */
.btn-admin {
  padding: 8px 16px;
  border-radius: var(--admin-radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-admin-primary {
  background: var(--admin-accent);
  color: white;
}

.btn-admin-primary:hover { background: var(--admin-accent-hover); }

.btn-admin-secondary {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  color: var(--admin-text);
}

.btn-admin-secondary:hover { background: var(--admin-surface-hover); }

.btn-admin-danger {
  background: rgba(255, 69, 58, 0.12);
  color: var(--admin-red);
}

.btn-admin-danger:hover { background: rgba(255, 69, 58, 0.25); }

.btn-admin-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* ===== Inline Select ===== */
.inline-select {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  color: var(--admin-text);
  padding: 4px 8px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

/* ===== Toast ===== */
.admin-toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--admin-green);
  color: #000;
  padding: 12px 24px;
  border-radius: var(--admin-radius-sm);
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.admin-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--admin-text-secondary);
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--admin-text);
}

/* ===== Loading Spinner ===== */
.admin-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px;
}

.admin-loading::after {
  content: '';
  width: 32px; height: 32px;
  border: 3px solid var(--admin-border);
  border-top-color: var(--admin-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Team Card Grid ===== */
.team-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.team-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 20px;
  transition: border-color 0.2s;
}

.team-card:hover { border-color: var(--admin-accent); }

.team-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.team-card-avatar {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: white;
  flex-shrink: 0;
}

.team-card-name { font-size: 15px; font-weight: 700; }
.team-card-email { font-size: 12px; color: var(--admin-text-secondary); }

.team-card-stats {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--admin-border);
  border-bottom: 1px solid var(--admin-border);
  margin-bottom: 14px;
}

.team-stat-item {
  flex: 1;
  text-align: center;
}

.team-stat-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--admin-accent);
}

.team-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--admin-text-secondary);
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.team-card-actions {
  display: flex;
  gap: 8px;
}

/* ===== Table count ===== */
.table-count {
  font-size: 13px;
  color: var(--admin-text-secondary);
  margin-bottom: 8px;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .chart-grid { grid-template-columns: 1fr; }
  .mobile-menu-btn { display: flex !important; }
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-sm);
  color: var(--admin-text);
  cursor: pointer;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--admin-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--admin-text-secondary); }
