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

:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-light: #dbeafe;
  --sidebar-bg:    #0f172a;
  --sidebar-w:     260px;
  --topbar-h:      64px;
  --success:       #16a34a;
  --success-light: #dcfce7;
  --danger:        #dc2626;
  --danger-light:  #fee2e2;
  --warning:       #d97706;
  --warning-light: #fef3c7;
  --info:          #0891b2;
  --info-light:    #cffafe;
  --gray-50:       #f8fafc;
  --gray-100:      #f1f5f9;
  --gray-200:      #e2e8f0;
  --gray-300:      #cbd5e1;
  --gray-400:      #94a3b8;
  --gray-500:      #64748b;
  --gray-600:      #475569;
  --gray-700:      #334155;
  --gray-800:      #1e293b;
  --gray-900:      #0f172a;
  --white:         #ffffff;
  --font:          'Plus Jakarta Sans', sans-serif;
  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     16px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
  --shadow:        0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.15);
  --transition:    .22s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
}

/* ── LAYOUT ── */
.admin-wrapper { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: var(--transition);
  box-shadow: 4px 0 24px rgba(0,0,0,.3);
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand .brand-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.sidebar-brand .brand-text h2 {
  font-size: .85rem;
  font-weight: 800;
  color: var(--white);
  line-height: 1.1;
  letter-spacing: -.3px;
}
.sidebar-brand .brand-text p {
  font-size: .65rem;
  color: rgba(255,255,255,.45);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.nav-section-label {
  font-size: .6rem;
  font-weight: 700;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 16px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
  margin: 1px 0;
}
.nav-item .nav-icon { font-size: 1.1rem; width: 22px; text-align: center; }
.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: var(--white);
  border-left-color: rgba(255,255,255,.3);
}
.nav-item.active {
  background: rgba(37,99,235,.25);
  color: var(--white);
  border-left-color: var(--primary);
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user .user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  color: var(--white);
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user .user-info p {
  font-size: .78rem;
  font-weight: 600;
  color: var(--white);
  line-height: 1.2;
}
.sidebar-user .user-info span {
  font-size: .65rem;
  color: rgba(255,255,255,.4);
}
.sidebar-user .logout-btn {
  margin-left: auto;
  color: rgba(255,255,255,.4);
  text-decoration: none;
  font-size: 1rem;
  transition: var(--transition);
}
.sidebar-user .logout-btn:hover { color: var(--danger); }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title {
  flex: 1;
}
.topbar-title h1 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
}
.topbar-title p {
  font-size: .75rem;
  color: var(--gray-400);
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ── PAGE CONTENT ── */
.page-content {
  padding: 28px;
  flex: 1;
}

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-card .stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-card .stat-icon.blue   { background: var(--primary-light); }
.stat-card .stat-icon.green  { background: var(--success-light); }
.stat-card .stat-icon.red    { background: var(--danger-light); }
.stat-card .stat-icon.yellow { background: var(--warning-light); }
.stat-card .stat-icon.cyan   { background: var(--info-light); }
.stat-card .stat-info { min-width: 0; }
.stat-card .stat-info .val {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}
.stat-card .stat-info .lbl {
  font-size: .75rem;
  color: var(--gray-500);
  margin-top: 3px;
}

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

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .83rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: var(--white); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); transform: translateY(-1px); }
.btn-success { background: var(--success); color: var(--white); border-color: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-danger  { background: var(--danger); color: var(--white); border-color: var(--danger); }
.btn-danger:hover  { background: #b91c1c; }
.btn-warning { background: var(--warning); color: var(--white); border-color: var(--warning); }
.btn-outline {
  background: transparent;
  color: var(--gray-600);
  border-color: var(--gray-300);
}
.btn-outline:hover { background: var(--gray-50); color: var(--gray-800); }
.btn-sm { padding: 5px 12px; font-size: .78rem; }

/* ── TABLE ── */
.table-wrapper { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.table th {
  background: var(--gray-50);
  padding: 11px 14px;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger);  }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: var(--info-light);    color: var(--info);    }
.badge-gray    { background: var(--gray-100);      color: var(--gray-600);}

/* ── FORM ADMIN ── */
.form-admin .form-group { margin-bottom: 18px; }
.form-admin .form-label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.form-admin .form-label span.req { color: var(--danger); }
.form-admin .form-control {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font);
  font-size: .875rem;
  color: var(--gray-800);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  transition: var(--transition);
  outline: none;
}
.form-admin .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* ── LOGIN ── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  animation: slideUp .45s ease both;
}
@keyframes slideUp {
  from { opacity:0; transform:translateY(24px); }
  to   { opacity:1; transform:translateY(0); }
}
.login-card .login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-card .login-logo .icon {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 12px;
}
.login-card .login-logo h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--gray-900);
}
.login-card .login-logo p { font-size: .8rem; color: var(--gray-500); }

/* ── ALERTS ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-danger  { background: var(--danger-light);  color: #991b1b; }
.alert-success { background: var(--success-light); color: #166534; }
.alert-info    { background: var(--info-light);    color: #155e75; }

/* ── UPLOAD PREVIEW ── */
.upload-group { display: flex; align-items: center; gap: 14px; }
.upload-preview {
  width: 80px; height: 80px;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--gray-300);
  object-fit: contain;
  background: var(--gray-50);
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-400);
  font-size: 1.5rem;
  overflow: hidden;
}
.upload-preview img { width: 100%; height: 100%; object-fit: contain; }

/* ── FILTER BAR ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.filter-bar .form-control {
  padding: 8px 12px;
  font-family: var(--font);
  font-size: .85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition);
  min-width: 180px;
}
.filter-bar .form-control:focus { border-color: var(--primary); }

/* ── PROGRESS BAR ── */
.progress-wrap { margin: 4px 0 2px; }
.progress-bar-bg {
  height: 6px;
  background: var(--gray-200);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), #7c3aed);
  transition: width .6s ease;
}

/* ── PAGINATION ── */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 16px;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid var(--gray-200);
  color: var(--gray-600);
  transition: var(--transition);
}
.pagination a:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); border-color: var(--primary); color: var(--white); }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: .875rem; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  animation: scaleIn .2s ease both;
}
@keyframes scaleIn {
  from { opacity:0; transform:scale(.95); }
  to   { opacity:1; transform:scale(1); }
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: .95rem; font-weight: 700; }
.modal-body { padding: 22px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--gray-400);
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--gray-700); }

/* ── PRINT ── */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ════════════════════════════
   RESPONSIVE - TABLET & HP
════════════════════════════ */

/* ── TABLET (≤ 1024px) ── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 240px; }
}

/* ── MOBILE (≤ 768px) ── */
@media (max-width: 768px) {
  /* Sidebar - slide in/out */
  .sidebar {
    transform: translateX(-100%);
    z-index: 300;
    transition: transform .28s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.open { transform: translateX(0); }

  /* Show toggle button */
  #sidebarToggle { display: flex !important; }

  /* Overlay */
  #sidebarOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 299;
    backdrop-filter: blur(2px);
    display: none;
  }
  #sidebarOverlay.active { display: block; }

  /* Main content full width */
  .main-content { margin-left: 0; }

  /* Page padding */
  .page-content { padding: 16px 14px; }

  /* Topbar */
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar-title h1 { font-size: .9rem; }
  .topbar-title p  { font-size: .7rem; }
  .topbar-actions .btn { padding: 7px 12px; font-size: .78rem; }

  /* Stats grid */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  .stat-card { padding: 10px 12px; gap: 10px; }
  .stat-card .stat-icon { width: 36px; height: 36px; font-size: 1.1rem; }
  .stat-card .stat-info .val { font-size: 1.25rem; }
  .stat-card .stat-info .lbl { font-size: .7rem; }

  /* Card */
  .card-header { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .card-body   { padding: 12px; }
  .card { margin-bottom: 12px; }

  /* Table - horizontal scroll */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { font-size: .75rem; min-width: 500px; }
  .table th, .table td { padding: 7px 8px; }

  /* Filter bar wrap */
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .form-control { min-width: unset; width: 100%; }

  /* Form row - stack */
  .form-row { grid-template-columns: 1fr; }

  /* Upload group */
  .upload-group { flex-direction: column; align-items: flex-start; }

  /* Buttons */
  .btn-sm { padding: 6px 10px; }

  /* Login card */
  .login-card { padding: 32px 24px; }

  /* Pagination */
  .pagination { justify-content: center; flex-wrap: wrap; }

  /* Utilities */
  .d-none-mobile { display: none !important; }
}

/* ── SMALL MOBILE (≤ 480px) ── */
@media (max-width: 480px) {
  :root { --topbar-h: 58px; }

  .page-content { padding: 12px 10px; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
  .stat-card { gap: 8px; padding: 8px; }
  .stat-card .stat-icon { width: 32px; height: 32px; font-size: 1rem; }
  .stat-card .stat-info .val { font-size: 1.1rem; }
  .stat-card .stat-info .lbl { font-size: .65rem; }

  .card-header h2 { font-size: .85rem; }

  .login-card { padding: 24px 18px; margin: 0 8px; }
  .login-card .login-logo .icon { width: 50px; height: 50px; font-size: 1.3rem; }
  .login-card .login-logo h2 { font-size: 1rem; }

  .btn { padding: 8px 14px; font-size: .8rem; }
  .btn-sm { padding: 5px 9px; font-size: .74rem; }

  .sidebar-brand { padding: 14px 14px 12px; }
  .sidebar-brand .brand-text h2 { font-size: .78rem; }
  .sidebar-footer { padding: 12px 14px; }
  .nav-item { padding: 10px 14px; font-size: .82rem; }
}

/* ── VERY SMALL (≤ 360px) ── */
@media (max-width: 360px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-content { padding: 10px 8px; }
}

/* Safe area (notch phones) */
@supports (padding: env(safe-area-inset-bottom)) {
  .sidebar { padding-bottom: env(safe-area-inset-bottom); }
}

