/* --- RESET & GOOGLE FONTS --- */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  background-color: #f1f5f9;
  color: #1e293b;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================== */
/* 1. LAYOUT UTAMA (DESKTOP)                                      */
/* ============================================================== */
.admin-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

/* --- SIDEBAR DESKTOP --- */
#admin-sidebar {
  background-color: #111827;
  color: #f8fafc;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

#admin-sidebar header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
}

#admin-sidebar header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.025em;
  margin: 0;
}

#admin-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#admin-sidebar nav a {
  color: #9ca3af;
  text-decoration: none;
  padding: 0.875rem 1rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

#admin-sidebar nav a:hover {
  background-color: #1f2937;
  color: #f8fafc;
}

#admin-sidebar nav a.active {
  background-color: #4f46e5;
  color: #ffffff;
  font-weight: 600;
}

/* --- AREA KONTEN UTAMA --- */
.admin-main {
  padding: 2.5rem;
  width: 100%;
  overflow-x: hidden;
}

/* ============================================================== */
/* 2. ELEMEN UI UMUM (KARTU, TOMBOL, FORM, TABEL)                 */
/* ============================================================== */

/* --- KARTU --- */
.admin-card {
  background-color: #ffffff;
  border-radius: 12px;
  padding: 2rem;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.05),
    0 2px 4px -1px rgba(0, 0, 0, 0.03);
  margin-bottom: 1.5rem;
  border: 1px solid #e2e8f0;
}

h2 {
  margin-top: 0;
  color: #1e293b;
  font-weight: 800;
  margin-bottom: 0.5rem;
}
h3 {
  margin-top: 0;
  color: #334155;
  font-weight: 700;
  margin-bottom: 1rem;
}
.text-muted {
  color: #64748b;
  font-size: 0.95rem;
}

/* --- FORM --- */
.form-group {
  margin-bottom: 1.25rem;
}
.form-group label {
  display: block;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: "Inter", sans-serif;
  transition: border-color 0.2s;
  background-color: #f8fafc;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #4f46e5;
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* --- TOMBOL --- */
.btn {
  background-color: #4f46e5;
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  display: inline-block;
}
.btn:hover {
  background-color: #4338ca;
}
.btn-secondary {
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-secondary:hover {
  background-color: #e2e8f0;
}

/* --- TABEL DASAR --- */
.table-container {
  width: 100%;
  overflow-x: auto;
  margin-top: 1.5rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.table {
  width: 100%;
  border-collapse: collapse;
  background-color: #ffffff;
}
.table th,
.table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}
.table th {
  background-color: #f8fafc;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

/* --- ALERT/NOTIFIKASI --- */
.message {
  padding: 1rem;
  border-radius: 8px;
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.message.success {
  background-color: #d1fae5;
  color: #065f46;
  border-left: 4px solid #10b981;
}
.message.error {
  background-color: #fee2e2;
  color: #991b1b;
  border-left: 4px solid #ef4444;
}

/* ============================================================== */
/* 3. RESPONSIVE SIDEBAR DRAWER (MOBILE FIX)                      */
/* ============================================================== */

/* 1. SEMBUNYIKAN ELEMEN MOBILE DI DESKTOP SECARA PAKSA */
.mobile-topbar,
.mobile-overlay,
.close-sidebar-btn {
  display: none !important;
}

/* 2. ATURAN KHUSUS LAYAR HP (Maksimal lebar 768px) */
@media (max-width: 768px) {
  /* Matikan grid desktop agar tidak bertabrakan */
  .admin-layout {
    display: block !important;
  }

  /* Munculkan Topbar Navigasi HP secara paksa */
  .mobile-topbar {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 998;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border-bottom: 2px solid #e5e7eb;
  }

  .mobile-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e1b4b;
  }

  .mobile-menu-btn {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: #4f46e5;
    cursor: pointer;
    padding: 0;
    line-height: 1;
  }

  /* Munculkan Overlay Gelap */
  .mobile-overlay {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }
  .mobile-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  /* Sidebar Menjadi Menu Geser */
  #admin-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: -320px !important; /* Sembunyikan di luar layar */
    width: 280px !important;
    height: 100vh !important;
    z-index: 1000 !important;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow-y: auto !important;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2) !important;
    background-color: #111827 !important;
  }

  #admin-sidebar.active {
    left: 0 !important;
  }

  /* Munculkan Tombol X untuk Tutup */
  .close-sidebar-btn {
    display: block !important;
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    margin-right: -10px;
  }
  .close-sidebar-btn:hover {
    color: #ffffff;
  }

  /* Sesuaikan Area Utama */
  .admin-main {
    padding: 1.25rem !important;
    width: 100% !important;
    box-sizing: border-box;
  }
}
