/* ============================================
   ADMIN PANEL CSS
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }

:root {
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --primary-soft: #eff6ff;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #1e40af;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --green: #10b981;
  --red: #ef4444;
  --gold: #f59e0b;
  --radius: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

body { background: var(--gray-50); color: var(--gray-800); font-size: 14px; line-height: 1.6; }
a { text-decoration: none; color: inherit; }

/* ============ LOGIN PAGE ============ */
.login-body {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.login-header { text-align: center; margin-bottom: 30px; }

.login-logo {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #1e40af, #2563eb);
  color: white;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 20px rgba(30,64,175,0.35);
}

.login-header h1 { font-size: 24px; font-weight: 800; color: var(--gray-800); }
.login-header p { color: var(--gray-500); font-size: 13px; margin-top: 4px; }

.login-card .form-group { margin-bottom: 18px; }

.login-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.15s;
}

.login-card input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,64,175,0.1);
}

.btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #1e40af, #2563eb);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(30,64,175,0.4);
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
}
.login-footer a { color: var(--primary); font-weight: 600; }

/* ============ ADMIN LAYOUT ============ */
.admin-wrapper { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: white;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-brand {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
}
.sidebar-brand i { color: #60a5fa; font-size: 24px; }
.sidebar-brand small {
  font-size: 9px;
  background: #1e40af;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 1px;
  margin-left: auto;
}

.sidebar-nav { padding: 16px 12px; }

.sidebar-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
  padding: 14px 12px 6px;
  font-weight: 700;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.sidebar-link i { width: 20px; text-align: center; font-size: 15px; }

.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: white;
  transform: translateX(3px);
}

.sidebar-link.active {
  background: linear-gradient(135deg, #1e40af, #2563eb);
  color: white;
  box-shadow: 0 4px 12px rgba(30,64,175,0.4);
}

.sidebar-link.danger:hover { background: var(--red); color: white; }

.admin-main {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.btn-toggle {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--gray-600);
  cursor: pointer;
  display: none;
  padding: 8px;
  border-radius: 8px;
}
.btn-toggle:hover { background: var(--gray-100); }

.topbar-title h1 { font-size: 18px; font-weight: 700; color: var(--gray-800); }

.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-info { text-align: right; }
.user-name { display: block; font-size: 13px; font-weight: 700; color: var(--gray-800); }
.user-role { font-size: 11px; color: var(--gray-500); }
.user-avatar {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #1e40af, #2563eb);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(30,64,175,0.25);
}

.admin-content { padding: 24px; flex: 1; }

/* ============ ALERTS ============ */
.alert {
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.3s;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.alert button { margin-left: auto; background: none; border: none; color: inherit; cursor: pointer; opacity: 0.7; }
.alert-success { background: #ecfdf5; color: #047857; border-left: 4px solid var(--green); }
.alert-error { background: #fef2f2; color: #b91c1c; border-left: 4px solid var(--red); }

/* ============ PAGE HEADER ============ */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 { font-size: 20px; font-weight: 800; color: var(--gray-800); }
.page-header p { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, #1e40af, #2563eb);
  color: white;
  box-shadow: 0 4px 12px rgba(30,64,175,0.25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(30,64,175,0.35); }
.btn-outline { background: white; border: 1.5px solid var(--gray-200); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  border: none;
  cursor: pointer;
  font-size: 13px;
}
.btn-icon:hover { background: var(--primary); color: white; transform: translateY(-1px); }
.btn-icon.danger { background: #fee2e2; color: #b91c1c; }
.btn-icon.danger:hover { background: var(--red); color: white; }

.action-btns { display: flex; gap: 6px; }

/* ============ CARDS ============ */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--gray-100);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
}
.card-title i { color: var(--primary); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
}
.card-header h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-header h3 i { color: var(--primary); }
.card-header a { font-size: 12.5px; color: var(--primary); font-weight: 600; display: flex; align-items: center; gap: 4px; }

/* ============ STATS ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid var(--gray-100);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  flex-shrink: 0;
}
.stat-card.blue .stat-icon { background: linear-gradient(135deg, #3b82f6, #1e40af); }
.stat-card.purple .stat-icon { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.stat-card.green .stat-icon { background: linear-gradient(135deg, #10b981, #047857); }
.stat-card.gold .stat-icon { background: linear-gradient(135deg, #f59e0b, #b45309); }

.stat-info { flex: 1; }
.stat-label { display: block; font-size: 12px; color: var(--gray-500); font-weight: 500; }
.stat-value { display: block; font-size: 22px; font-weight: 800; color: var(--gray-800); margin-top: 2px; }

/* ============ ALERT CARDS ============ */
.alert-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }

.alert-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  transition: transform 0.15s;
  border: 1px solid;
}
.alert-card:hover { transform: translateX(4px); }
.alert-card.warning { background: #fffbeb; color: #92400e; border-color: #fcd34d; }
.alert-card.danger { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }
.alert-card > i:first-child { font-size: 24px; }
.alert-card > i:last-child { margin-left: auto; }
.alert-card strong { display: block; font-size: 14px; }
.alert-card span { font-size: 12.5px; font-weight: 500; opacity: 0.85; }

/* ============ DASHBOARD GRID ============ */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dashboard-grid .card.full { grid-column: 1 / -1; padding: 0; }

/* ============ TABLE ============ */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table thead {
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
}
.admin-table th {
  padding: 12px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.admin-table tbody tr:hover { background: var(--gray-50); }
.admin-table tfoot td { border-top: 2px solid var(--gray-200); font-size: 13.5px; padding: 12px 14px; }

.text-right { text-align: right; }
.text-center { text-align: center; }

.table-product {
  display: flex;
  align-items: center;
  gap: 12px;
}
.table-product img, .table-thumb {
  width: 44px; height: 44px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--gray-100);
}
.table-thumb { width: 50px; height: 50px; }

.cat-icon {
  font-size: 20px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 8px;
  border-radius: 8px;
  width: 36px;
  text-align: center;
}

.strike { color: var(--gray-400); text-decoration: line-through; font-size: 11.5px; }

/* ============ BADGES ============ */
.badge-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-status.success, .badge-status.aktif, .badge-status.selesai, .badge-status.dibayar {
  background: #d1fae5; color: #065f46;
}
.badge-status.pending { background: #fef3c7; color: #92400e; }
.badge-status.dikirim { background: #dbeafe; color: #1e40af; }
.badge-status.batal { background: #fee2e2; color: #991b1b; }
.badge-status.secondary, .badge-status.nonaktif { background: var(--gray-100); color: var(--gray-600); }

.badge-stock {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}
.badge-stock.ok { background: #d1fae5; color: #065f46; }
.badge-stock.low { background: #fee2e2; color: #991b1b; }

.tag-flash, .tag-rekom {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-left: 4px;
}
.tag-flash { background: #fef3c7; color: #92400e; }
.tag-rekom { background: #dbeafe; color: #1e40af; }

/* ============ STOK INPUT ============ */
.stok-input {
  width: 70px;
  padding: 6px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  font-family: inherit;
}
.stok-input.low { border-color: #fca5a5; background: #fef2f2; color: #b91c1c; }
.stok-input:focus { outline: none; border-color: var(--primary); }

/* ============ FORM ============ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 9px;
  font-size: 13.5px;
  font-family: inherit;
  transition: all 0.15s;
  background: white;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,64,175,0.08);
}
.form-group textarea { resize: vertical; min-height: 90px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.required { color: var(--red); }
.hint { font-size: 11.5px; color: var(--gray-500); margin-top: 4px; display: block; }
.hint a { color: var(--primary); font-weight: 600; }
.error { color: var(--red); font-size: 12px; margin-top: 4px; display: block; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 9px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 8px;
  transition: all 0.15s;
}
.checkbox-label:hover { border-color: var(--primary); background: var(--primary-soft); }
.checkbox-label input { width: auto; }

.form-actions {
  display: flex;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-100);
  margin-top: 16px;
}

.form-actions-sticky {
  position: sticky;
  bottom: 0;
  background: white;
  padding: 16px 0;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.04);
}

.current-image {
  margin-bottom: 12px;
  border-radius: 9px;
  overflow: hidden;
  border: 1.5px solid var(--gray-200);
}
.current-image img { width: 100%; display: block; max-height: 300px; object-fit: cover; }

#imagePreview { margin-top: 12px; }
#imagePreview img { width: 100%; border-radius: 9px; border: 1.5px solid var(--primary); }

/* ============ FILTER FORM ============ */
.filter-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-form input[type="text"] { flex: 1; min-width: 200px; padding: 10px 14px; border: 1.5px solid var(--gray-200); border-radius: 9px; font-size: 13.5px; font-family: inherit; }
.filter-form select { padding: 10px 14px; border: 1.5px solid var(--gray-200); border-radius: 9px; font-size: 13.5px; font-family: inherit; background: white; }

/* ============ DETAIL ============ */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.info-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--gray-200);
  font-size: 13.5px;
}
.info-list > div:last-child { border-bottom: none; }
.info-list > div span { color: var(--gray-500); flex-shrink: 0; }
.info-list > div strong { color: var(--gray-800); text-align: right; }

.list-stock { list-style: none; padding: 12px; }
.list-stock li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 9px;
  transition: background 0.15s;
}
.list-stock li:hover { background: var(--gray-50); }
.list-stock img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.list-stock-info { flex: 1; }
.list-stock-info strong { display: block; font-size: 13px; margin-bottom: 2px; }

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--gray-500);
  font-size: 13.5px;
}
.empty-state i { font-size: 40px; color: var(--green); display: block; margin-bottom: 10px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid, .form-grid, .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .btn-toggle { display: block; }
  .stats-grid, .alert-grid { grid-template-columns: 1fr; }
  .admin-content { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .topbar-title h1 { font-size: 15px; }
  .user-info { display: none; }
  .admin-table { font-size: 12px; }
  .admin-table th, .admin-table td { padding: 10px 8px; }
}
.sidebar-badge {
    margin-left: auto;
    background: #f97316;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
}
/* Status badge warna tambahan */
.badge-status.warning { background: #fef3c7; color: #92400e; }
.badge-status.info { background: #dbeafe; color: #1e40af; }
.badge-status.primary { background: #e0f2fe; color: #0369a1; }
.badge-status.success { background: #d1fae5; color: #065f46; }
.badge-status.secondary { background: #e5e7eb; color: #374151; }

.status-action-btn:hover:not(.active) {
    border-color: #f97316 !important;
    color: #f97316 !important;
    transform: translateY(-1px);
}

.status-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
/* Status badge warna */
.badge-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}