/* Dark Coder Admin — dynamic animations & management panel */
:root {
  --admin-bg: #0d1117;
  --admin-card: #161b22;
  --admin-border: #30363d;
  --admin-text: #e6edf3;
  --admin-muted: #8b949e;
  --admin-accent: #58a6ff;
  --admin-success: #3fb950;
  --admin-warning: #d29922;
  --admin-danger: #f85149;
  --admin-sidebar-width: 260px;
  --admin-header-height: 60px;
  --admin-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.admin-panel {
  background: var(--admin-bg);
  color: var(--admin-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ----- Layout ----- */
.admin-wrap {
  display: flex;
  min-height: 100vh;
}
.admin-sidebar {
  width: var(--admin-sidebar-width);
  background: var(--admin-card);
  border-right: 1px solid var(--admin-border);
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--admin-transition), width var(--admin-transition);
  overflow-y: auto;
}
.admin-sidebar.collapsed {
  width: 72px;
}
.admin-sidebar.collapsed .nav-label,
.admin-sidebar.collapsed .admin-brand span { display: none; }
.admin-main {
  flex: 1;
  margin-left: var(--admin-sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--admin-transition);
}
.admin-sidebar.collapsed + .admin-main { margin-left: 72px; }
.admin-header {
  height: var(--admin-header-height);
  background: var(--admin-card);
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.admin-content {
  flex: 1;
  padding: 1.5rem;
}

/* ----- Brand ----- */
.admin-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--admin-border);
  color: var(--admin-text);
  font-weight: 700;
  font-size: 1.1rem;
}
.admin-brand i { color: var(--admin-accent); }

/* ----- Nav ----- */
.admin-nav { padding: 0.75rem 0; }
.admin-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  color: var(--admin-muted);
  text-decoration: none;
  transition: color var(--admin-transition), background var(--admin-transition);
  border-left: 3px solid transparent;
}
.admin-nav .nav-item:hover { color: var(--admin-text); background: rgba(255,255,255,0.05); }
.admin-nav .nav-item.active { color: var(--admin-accent); background: rgba(88,166,255,0.1); border-left-color: var(--admin-accent); }
.admin-nav .nav-item i { width: 20px; text-align: center; }

/* ----- Cards with stagger animation ----- */
.admin-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  opacity: 0;
  transform: translateY(20px);
  animation: adminFadeUp 0.5s ease forwards;
}
.admin-card:nth-child(1) { animation-delay: 0.05s; }
.admin-card:nth-child(2) { animation-delay: 0.1s; }
.admin-card:nth-child(3) { animation-delay: 0.15s; }
.admin-card:nth-child(4) { animation-delay: 0.2s; }
.admin-card:nth-child(5) { animation-delay: 0.25s; }
.admin-card:nth-child(6) { animation-delay: 0.3s; }
@keyframes adminFadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ----- Stat cards ----- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: linear-gradient(135deg, var(--admin-card) 0%, #1c2128 100%);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 1.25rem;
  transition: transform var(--admin-transition), box-shadow var(--admin-transition);
  opacity: 0;
  transform: translateY(15px) scale(0.98);
  animation: adminFadeUp 0.4s ease forwards;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.stat-card .stat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; margin-bottom: 0.75rem;
}
.stat-card .stat-icon.blue { background: rgba(88,166,255,0.2); color: var(--admin-accent); }
.stat-card .stat-icon.green { background: rgba(63,185,80,0.2); color: var(--admin-success); }
.stat-card .stat-icon.orange { background: rgba(210,153,34,0.2); color: var(--admin-warning); }
.stat-card .stat-icon.red { background: rgba(248,81,73,0.2); color: var(--admin-danger); }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
.stat-card .stat-label { color: var(--admin-muted); font-size: 0.875rem; margin-top: 0.25rem; }

/* ----- Tables ----- */
.admin-table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--admin-border); }
.admin-table {
  width: 100%; border-collapse: collapse; background: var(--admin-card);
}
.admin-table th, .admin-table td { padding: 0.85rem 1rem; text-align: left; border-bottom: 1px solid var(--admin-border); }
.admin-table th { color: var(--admin-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr { transition: background var(--admin-transition); }
.admin-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.admin-table tbody tr.animate-in {
  animation: adminRowIn 0.35s ease forwards;
}
@keyframes adminRowIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ----- Badges ----- */
.badge-pill { padding: 0.35em 0.75em; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: rgba(63,185,80,0.2); color: var(--admin-success); }
.badge-warning { background: rgba(210,153,34,0.2); color: var(--admin-warning); }
.badge-danger { background: rgba(248,81,73,0.2); color: var(--admin-danger); }
.badge-muted { background: rgba(139,148,158,0.2); color: var(--admin-muted); }

/* ----- Buttons ----- */
.btn-admin {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 1rem; border-radius: 8px; font-weight: 500;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  border: none; cursor: pointer;
}
.btn-admin:active { transform: scale(0.98); }
.btn-admin-primary { background: var(--admin-accent); color: #fff; }
.btn-admin-primary:hover { background: #79b8ff; box-shadow: 0 4px 12px rgba(88,166,255,0.3); }
.btn-admin-ghost { background: transparent; color: var(--admin-muted); border: 1px solid var(--admin-border); }
.btn-admin-ghost:hover { color: var(--admin-text); border-color: var(--admin-muted); }
.btn-admin-danger { background: rgba(248,81,73,0.2); color: var(--admin-danger); }
.btn-admin-danger:hover { background: rgba(248,81,73,0.3); }

/* ----- Forms ----- */
.admin-form .form-label { color: var(--admin-muted); font-size: 0.875rem; margin-bottom: 0.35rem; }
.admin-form .form-control {
  background: var(--admin-bg); border: 1px solid var(--admin-border);
  color: var(--admin-text); border-radius: 8px; padding: 0.6rem 0.85rem;
  transition: border-color var(--admin-transition), box-shadow var(--admin-transition);
}
.admin-form .form-control:focus {
  border-color: var(--admin-accent); box-shadow: 0 0 0 3px rgba(88,166,255,0.2); outline: none;
}

/* ----- Page title ----- */
.admin-page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.admin-page-subtitle { color: var(--admin-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

/* ----- Chart placeholder / activity ----- */
.chart-placeholder {
  height: 220px; background: linear-gradient(180deg, rgba(88,166,255,0.08) 0%, transparent 100%);
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  color: var(--admin-muted); font-size: 0.9rem; border: 1px dashed var(--admin-border);
}
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li {
  display: flex; gap: 1rem; padding: 0.75rem 0;
  border-bottom: 1px solid var(--admin-border);
  animation: adminFadeUp 0.4s ease backwards;
}
.activity-list li:last-child { border-bottom: none; }
.activity-list li:nth-child(1) { animation-delay: 0.1s; }
.activity-list li:nth-child(2) { animation-delay: 0.15s; }
.activity-list li:nth-child(3) { animation-delay: 0.2s; }
.activity-list li:nth-child(4) { animation-delay: 0.25s; }
.activity-list li:nth-child(5) { animation-delay: 0.3s; }
.activity-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: rgba(88,166,255,0.15); color: var(--admin-accent); }
.activity-body .time { color: var(--admin-muted); font-size: 0.8rem; }

/* ----- Toggle sidebar button ----- */
.admin-toggle-sidebar {
  width: 36px; height: 36px; border-radius: 8px;
  background: transparent; border: 1px solid var(--admin-border);
  color: var(--admin-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color var(--admin-transition), border-color var(--admin-transition);
}
.admin-toggle-sidebar:hover { color: var(--admin-accent); border-color: var(--admin-accent); }

/* ----- Login page ----- */
.admin-login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #0d1117 100%);
  padding: 1rem;
}
.admin-login-card {
  width: 100%; max-width: 400px;
  background: var(--admin-card); border: 1px solid var(--admin-border);
  border-radius: 16px; padding: 2rem;
  box-shadow: 0 24px 48px rgba(0,0,0,0.4);
  opacity: 0; transform: translateY(20px) scale(0.98);
  animation: adminFadeUp 0.5s ease 0.1s forwards;
}
.admin-login-card .brand { text-align: center; margin-bottom: 1.5rem; font-size: 1.5rem; font-weight: 700; color: var(--admin-accent); }
.admin-login-card .form-control { margin-bottom: 1rem; }

/* ----- Pricing editor ----- */
.price-plan-card {
  border: 1px solid var(--admin-border); border-radius: 12px; padding: 1.25rem;
  margin-bottom: 1rem; transition: border-color var(--admin-transition), box-shadow var(--admin-transition);
}
.price-plan-card:hover { border-color: var(--admin-accent); box-shadow: 0 0 0 1px rgba(88,166,255,0.2); }
.price-plan-card.featured { border-color: var(--admin-accent); background: rgba(88,166,255,0.05); }

/* ----- Empty state ----- */
.admin-empty {
  text-align: center; padding: 3rem 1rem; color: var(--admin-muted);
}
.admin-empty i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }

/* ----- Pulse animation for live indicator ----- */
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--admin-success);
  animation: adminPulse 2s ease-in-out infinite;
}
@keyframes adminPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.1); }
}

/* ----- Responsive ----- */
@media (max-width: 992px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.mobile-open { transform: translateX(0); }
  .admin-main { margin-left: 0 !important; }
}
