/* =============================================
   NABAWI MULIA — ADMIN DASHBOARD CSS
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --purple-primary: #7C3AED;
  --purple-600: #6D28D9;
  --purple-800: #4C1D95;
  --purple-100: #EDE9FE;
  --purple-50: #F5F3FF;
  --purple-200: #DDD6FE;
  --purple-400: #A78BFA;
  --white: #FFFFFF;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --sidebar-width: 260px;
  --green: #10B981;
  --red: #EF4444;
  --gold: #F59E0B;
  --blue: #3B82F6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(124,58,237,0.10), 0 2px 8px rgba(0,0,0,0.06);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  display: flex;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
ul { list-style: none; }
img { max-width: 100%; }

/* ── Login Page ──────────────────────────────── */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--purple-800) 0%, var(--purple-primary) 100%);
  min-height: 100vh;
}
.login-card {
  background: white;
  border-radius: 24px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.2);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .brand { font-size: 1.8rem; font-weight: 800; color: var(--purple-primary); }
.login-logo .sub { font-size: 0.8rem; color: var(--gray-400); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.08em; }
.login-title { font-size: 1.3rem; font-weight: 700; color: var(--gray-800); margin-bottom: 6px; text-align: center; }
.login-sub { font-size: 0.85rem; color: var(--gray-400); text-align: center; margin-bottom: 28px; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-600); margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--gray-800);
  background: white;
  transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--purple-primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.12); }
.form-control::placeholder { color: var(--gray-300); }

.btn-login {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--purple-primary), var(--purple-600));
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 6px;
}
.btn-login:hover { opacity: 0.92; transform: translateY(-1px); }
.login-err { display: none; color: var(--red); font-size: 0.82rem; text-align: center; margin-top: 10px; background: #FEE2E2; padding: 10px; border-radius: 8px; }

/* ── Sidebar ─────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: linear-gradient(180deg, var(--purple-800) 0%, var(--purple-600) 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: var(--transition);
}
.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo .brand { font-size: 1.3rem; font-weight: 800; color: white; }
.sidebar-logo .sub { font-size: 0.65rem; color: rgba(255,255,255,0.55); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.4);
  padding: 8px 12px 6px;
  margin-top: 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 3px;
  cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-item.active { background: rgba(255,255,255,0.18); color: white; font-weight: 600; }
.nav-item .icon { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
}
.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: white; font-weight: 700;
}
.sidebar-username { font-size: 0.85rem; font-weight: 600; color: white; }
.sidebar-role { font-size: 0.7rem; color: rgba(255,255,255,0.5); }
.btn-logout {
  width: 100%;
  padding: 10px;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: var(--transition);
}
.btn-logout:hover { background: rgba(255,255,255,0.18); color: white; }

/* ── Main Content ────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: white;
  border-bottom: 1px solid var(--gray-100);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: 1.15rem; font-weight: 700; color: var(--gray-900); }
.topbar-title span { font-weight: 400; color: var(--gray-400); font-size: 0.9rem; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-time { font-size: 0.8rem; color: var(--gray-400); }

.page-content { padding: 28px; flex: 1; }

/* ── Stat Cards ──────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 28px; }
.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.purple::before { background: linear-gradient(90deg, var(--purple-primary), var(--purple-400)); }
.stat-card.green::before { background: linear-gradient(90deg, #10B981, #34D399); }
.stat-card.gold::before { background: linear-gradient(90deg, #F59E0B, #FCD34D); }
.stat-card.blue::before { background: linear-gradient(90deg, #3B82F6, #60A5FA); }

.stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 4px;
}
.stat-card.purple .stat-icon { background: var(--purple-100); }
.stat-card.green .stat-icon { background: #D1FAE5; }
.stat-card.gold .stat-icon { background: #FEF3C7; }
.stat-card.blue .stat-icon { background: #DBEAFE; }

.stat-value { font-size: 1.9rem; font-weight: 800; color: var(--gray-900); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--gray-400); font-weight: 500; }
.stat-trend { font-size: 0.75rem; font-weight: 600; color: var(--green); }

/* ── Tables ──────────────────────────────────── */
.table-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  overflow: hidden;
  margin-bottom: 24px;
}
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-100);
}
.table-header h2 { font-size: 1rem; font-weight: 700; color: var(--gray-900); }
.table-actions { display: flex; gap: 10px; }

.search-input {
  padding: 8px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--gray-700);
  background: white;
  transition: var(--transition);
  min-width: 220px;
}
.search-input:focus { outline: none; border-color: var(--purple-primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.08); }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
  white-space: nowrap;
}
.admin-table td {
  padding: 13px 16px;
  font-size: 0.88rem;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-50);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--purple-50); }

.pkg-name-cell { font-weight: 600; color: var(--gray-900); }
.pkg-name-cell small { font-weight: 400; color: var(--gray-400); font-size: 0.78rem; display: block; }

/* ── Badges / Pills ──────────────────────────── */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.pill-hemat { background: #D1FAE5; color: #065F46; }
.pill-reguler { background: #DBEAFE; color: #1E40AF; }
.pill-premium { background: var(--purple-100); color: var(--purple-800); }
.pill-vip { background: #FEF3C7; color: #78350F; }
.pill-green { background: #D1FAE5; color: #065F46; }
.pill-red { background: #FEE2E2; color: #991B1B; }

/* ── Action Buttons ──────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  font-family: inherit;
}
.btn-primary { background: linear-gradient(135deg, var(--purple-primary), var(--purple-600)); color: white; box-shadow: 0 2px 10px rgba(124,58,237,0.25); }
.btn-primary:hover { opacity: 0.92; transform: translateY(-1px); }
.btn-edit { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }
.btn-edit:hover { background: #DBEAFE; }
.btn-delete { background: #FEF2F2; color: #DC2626; border: 1px solid #FECACA; }
.btn-delete:hover { background: #FEE2E2; }
.btn-view { background: #F0FDF4; color: #15803D; border: 1px solid #BBF7D0; }
.btn-view:hover { background: #DCFCE7; }
.btn-secondary { background: white; color: var(--gray-600); border: 1.5px solid var(--gray-200); }
.btn-secondary:hover { border-color: var(--purple-200); color: var(--purple-primary); background: var(--purple-50); }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }

/* ── Modal ───────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  border-radius: 20px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.2);
  animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid var(--gray-100);
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; color: var(--gray-900); }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--gray-100);
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  color: var(--gray-500);
}
.modal-close:hover { background: var(--gray-200); color: var(--gray-800); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-100); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Form Rows in Modal ──────────────────────── */
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500); margin-bottom: 6px; }
.fc { width: 100%; padding: 10px 14px; border: 1.5px solid var(--gray-200); border-radius: 8px; font-family: inherit; font-size: 0.9rem; color: var(--gray-800); background: white; transition: var(--transition); }
.fc:focus { outline: none; border-color: var(--purple-primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.1); }
.fc::placeholder { color: var(--gray-300); }

/* ── Recent Activity ─────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.recent-list { display: flex; flex-direction: column; }
.recent-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-50);
}
.recent-item:last-child { border-bottom: none; }
.recent-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; }
.recent-icon.purple { background: var(--purple-100); }
.recent-icon.green { background: #D1FAE5; }
.recent-icon.gold { background: #FEF3C7; }
.recent-text .title { font-size: 0.88rem; font-weight: 600; color: var(--gray-800); }
.recent-text .sub { font-size: 0.78rem; color: var(--gray-400); margin-top: 2px; }
.recent-time { font-size: 0.72rem; color: var(--gray-300); margin-left: auto; white-space: nowrap; }

/* ── Quick Stats list ────────────────────────── */
.quick-stat-list { display: flex; flex-direction: column; gap: 12px; }
.quick-stat-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--gray-50); border-radius: 10px; }
.quick-stat-row .label { font-size: 0.82rem; color: var(--gray-500); font-weight: 500; }
.quick-stat-row .val { font-size: 0.95rem; font-weight: 700; color: var(--gray-900); }

/* ── Toast ───────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
#toast.error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }

/* ── Empty state ─────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--gray-400); }
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--gray-500); margin-bottom: 6px; }

/* ── Scrollbar ───────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--purple-300); border-radius: 6px; }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
}
