/* =========================================================
   ADMIN DASHBOARD — STYLESHEET (Professional Responsive)
   ========================================================= */
:root {
  --bg-body: #f3f4f6;
  --bg-surface: #ffffff;
  --sidebar-width: 260px;
  --primary: #c8102e;
  --primary-hover: #a00d25;
  --text-main: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --success: #10b981;
  --warning: #f59e0b;
  --font: "Poppins", sans-serif;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --radius: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  overflow-x: hidden;
}
body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-main);
  overflow-x: hidden;
}
a {
  text-decoration: none;
  color: inherit;
}
ul {
  list-style: none;
}
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* LAYOUT & SIDEBAR */
.dashboard-container {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}
.sidebar-brand {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand i {
  font-size: 24px;
  color: var(--primary);
}
.sidebar-brand h1 {
  font-size: 20px;
  font-weight: 700;
}
.sidebar-menu {
  padding: 24px 16px;
  flex: 1;
  overflow-y: auto;
}
.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 8px;
  transition: all 0.2s;
}
.sidebar-menu a:hover {
  background: var(--bg-body);
  color: var(--text-main);
}
.sidebar-menu a.active {
  background: #fef2f2;
  color: var(--primary);
  font-weight: 600;
}
.sidebar-menu a i {
  width: 20px;
  text-align: center;
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px;
  width: calc(100% - var(--sidebar-width));
  transition: all 0.3s ease;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  gap: 16px;
}
.topbar-left h1 {
  font-size: 24px;
  font-weight: 700;
}
.topbar-left p {
  color: var(--text-muted);
  font-size: 14px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.admin-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  padding: 8px 16px;
  border-radius: 50px;
  border: 1px solid var(--border);
}

/* TOMBOL HAMBURGER ADMIN */
.mobile-toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 20px;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(200, 16, 46, 0.4);
  align-items: center;
  justify-content: center;
}

/* STATS & CHARTS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-surface);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
}
.stat-label {
  color: var(--text-muted);
  font-size: 13px;
}
.chart-section {
  background: var(--bg-surface);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 32px;
  overflow: hidden;
}
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

/* TABLES (Kunci Utama Anti-Hancur) */
.table-section {
  background: var(--bg-surface);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 700px; /* Lebar minimal agar tidak gepeng */
}
th {
  padding: 16px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
}
td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.status {
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
}
.status.success {
  background: #dcfce7;
  color: #15803d;
}
.status.pending {
  background: #fef3c7;
  color: #b45309;
}
.status.danger {
  background: #fee2e2;
  color: #b91c1c;
}

/* LOGIN PAGE (Admin) */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #111827;
  padding: 20px;
}
.login-container {
  width: 100%;
  max-width: 400px;
}
.login-card {
  background: var(--bg-surface);
  padding: 40px 32px;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}
.form-group {
  margin-bottom: 20px;
}
.form-group input {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
}
.btn-login {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  font-weight: 600;
  border-radius: 8px;
  font-size: 15px;
}

/* =========================================================
   MEDIA QUERIES (TABLET & MOBILE)
   ========================================================= */

/* TABLET (max-width: 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
  }

  .sidebar-brand {
    padding: 20px;
  }
  .sidebar-menu {
    padding: 20px 12px;
  }
  .sidebar-menu a {
    padding: 12px;
  }

  .main-content {
    padding: 24px;
  }
  .topbar-left h1 {
    font-size: 22px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px;
  }
  .stat-card {
    padding: 20px;
  }
  .stat-value {
    font-size: clamp(22px, 2.8vw, 28px);
  }

  .chart-section,
  .chart-card,
  .table-section {
    padding: 20px;
  }

  th,
  td {
    padding: 12px;
  }
}

@media (max-width: 1024px) {
  .chart-section canvas,
  .chart-card canvas {
    max-width: 100%;
  }
}

/* MOBILE (max-width: 768px) */
@media (max-width: 768px) {
  /* Sidebar Drawer dari Kiri */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }
  .sidebar.active {
    transform: translateX(0);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
  }

  /* Main Content Full */
  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 20px 16px;
  }

  /* Topbar Numpuk */
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .admin-profile {
    width: 100%;
    justify-content: center;
  }

  /* Tampilkan Tombol Hamburger */
  .mobile-toggle {
    display: flex;
  }

  /* Statistik 1 Kolom */
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  /* Table Padding Adjustment */
  th,
  td {
    padding: 12px;
    font-size: 13px;
  }
}

/* SMALL MOBILE (max-width: 480px) */
@media (max-width: 480px) {
  .topbar-left h1 {
    font-size: 20px;
  }
  .stat-value {
    font-size: 24px;
  }
  .chart-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .login-card {
    padding: 24px 16px;
  }
}
