@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');
@import url('https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css');

:root {
  --primary: #2563EB;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #22C55E;
  --success-hover: #16a34a;
  --success-light: #dcfce7;
  --warning: #F59E0B;
  --warning-hover: #d97706;
  --warning-light: #fef3c7;
  --danger: #EF4444;
  --danger-hover: #dc2626;
  --danger-light: #fee2e2;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --sidebar: #111827;
  --sidebar-hover: #1e293b;
  --sidebar-active: #2563EB;
  --sidebar-width: 260px;
  --navbar-height: 64px;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --radius-form: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.03);
  --transition: all 0.2s ease;
  --font: 'Poppins', sans-serif;
}

* {
  font-family: var(--font);
}

body {
  background: var(--bg);
  color: #1e293b;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== SIDEBAR (tidak diubah) ===== */
.wrapper { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: var(--sidebar); position: fixed; top: 0; left: 0; bottom: 0; z-index: 1040; display: flex; flex-direction: column; transition: transform 0.3s ease; overflow-y: auto; }
.sidebar-brand { padding: 20px 20px 16px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sidebar-brand .brand-icon { width: 40px; height: 40px; background: var(--primary); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff; flex-shrink: 0; }
.sidebar-brand .brand-text { color: #fff; font-weight: 700; font-size: 18px; letter-spacing: -0.5px; }
.sidebar-menu { padding: 12px 12px; flex: 1; }
.sidebar-menu .nav-item { margin-bottom: 2px; }
.sidebar-menu .nav-link { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: rgba(255,255,255,0.55); text-decoration: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; transition: var(--transition); position: relative; }
.sidebar-menu .nav-link i { font-size: 20px; width: 22px; text-align: center; flex-shrink: 0; }
.sidebar-menu .nav-link:hover { color: rgba(255,255,255,0.9); background: var(--sidebar-hover); }
.sidebar-menu .nav-link.active { color: #fff; background: var(--sidebar-active); box-shadow: 0 4px 12px rgba(37,99,235,0.35); }
.sidebar-menu .nav-link.active::before { content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%); width: 4px; height: 24px; background: var(--primary); border-radius: 0 4px 4px 0; }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-footer .nav-link { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: rgba(255,255,255,0.5); text-decoration: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; transition: var(--transition); }
.sidebar-footer .nav-link:hover { color: var(--danger); background: rgba(239,68,68,0.1); }
.sidebar-footer .nav-link i { font-size: 20px; width: 22px; text-align: center; }

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

/* ===== NAVBAR (tidak diubah) ===== */
.navbar-top { height: var(--navbar-height); background: var(--card); border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 1030; }
.navbar-left { display: flex; align-items: center; gap: 16px; }
.navbar-left .sidebar-toggle { background: none; border: none; font-size: 24px; color: #64748b; cursor: pointer; padding: 4px; display: none; transition: var(--transition); }
.navbar-left .sidebar-toggle:hover { color: var(--primary); }
.navbar-search { position: relative; width: 320px; }
.navbar-search .form-control { height: 40px; padding-left: 40px; border-radius: var(--radius-sm); border: 1px solid #e2e8f0; background: var(--bg); font-size: 14px; transition: var(--transition); }
.navbar-search .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); background: var(--card); }
.navbar-search .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 16px; }
.navbar-right { display: flex; align-items: center; gap: 8px; }
.navbar-right .nav-icon-btn { width: 40px; height: 40px; border-radius: 50%; border: none; background: transparent; color: #64748b; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; position: relative; transition: var(--transition); }
.navbar-right .nav-icon-btn:hover { background: var(--bg); color: var(--primary); }
.navbar-right .nav-icon-btn .badge-dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid var(--card); }
.navbar-right .admin-profile { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition); text-decoration: none; color: inherit; }
.navbar-right .admin-profile:hover { background: var(--bg); }
.navbar-right .admin-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex-shrink: 0; }
.navbar-right .admin-info { line-height: 1.2; }
.navbar-right .admin-name { font-size: 14px; font-weight: 600; color: #1e293b; }
.navbar-right .admin-role { font-size: 11px; color: #94a3b8; font-weight: 500; }

/* ===== NOTIFICATION DROPDOWN ===== */
.notification-dropdown {
    width: 360px;
    min-width: 360px;
    max-width: 360px;
    right: 0;
    left: auto !important;
    overflow-x: hidden;
}
.notification-items-scroll {
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
}
.notification-item {
    display: block;
    padding: 10px 14px;
    border-bottom: 1px solid #e9ecef;
    text-decoration: none;
    color: inherit;
}
.notification-item:last-child {
    border-bottom: none;
}
.notification-item:hover {
    background: #f8f9fa;
    color: inherit;
}
.notification-item .notif-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.notification-item .notif-row-bottom {
    margin-top: 4px;
}
.notification-item .notif-order {
    font-weight: 600;
    font-size: 13px;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.notification-item .notif-amount {
    font-weight: 700;
    font-size: 13px;
    color: #0f172a;
}
.notification-item .notif-time {
    font-size: 12px;
    white-space: nowrap;
}
@media (max-width: 480px) {
    .notification-dropdown {
        width: calc(100vw - 24px);
        min-width: 0;
        max-width: 360px;
    }
}

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

.page-header {
  margin-bottom: 28px;
}

.page-header h4 {
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  font-size: 22px;
}

.page-header p {
  color: #64748b;
  font-size: 14px;
  margin: 4px 0 0;
}

/* ===== CARD ===== */
.card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
  background: var(--card);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-stats {
  padding: 22px 26px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-radius: var(--radius);
  cursor: default;
}

.card-stats .stats-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
  transition: var(--transition);
}

.card-stats:hover .stats-icon {
  transform: scale(1.05);
}

.card-stats .stats-icon.primary { background: var(--primary-light); color: var(--primary); }
.card-stats .stats-icon.success { background: var(--success-light); color: var(--success); }
.card-stats .stats-icon.warning { background: var(--warning-light); color: var(--warning); }
.card-stats .stats-icon.danger { background: var(--danger-light); color: var(--danger); }

.card-stats .stats-info { flex: 1; }
.card-stats .stats-label { font-size: 13px; color: #64748b; font-weight: 500; margin-bottom: 2px; }
.card-stats .stats-number { font-size: 26px; font-weight: 700; color: #0f172a; line-height: 1.2; }
.card-stats .stats-number .currency { font-size: 16px; font-weight: 600; color: #94a3b8; }
.card-stats .stats-trend { font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.card-stats .stats-trend.up { color: var(--success); }
.card-stats .stats-trend.down { color: var(--danger); }

.chart-container { position: relative; height: 280px; }
.chart-container-sm { position: relative; height: 220px; }

/* ===== TABLE ===== */
.table-modern {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: var(--radius);
}

.table-modern thead th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 14px 20px;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-modern tbody tr {
  transition: background 0.2s ease;
}

.table-modern tbody tr:nth-child(even) {
  background: #fafbfc;
}

.table-modern tbody tr:hover {
  background: #eef2ff;
}

.table-modern tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
  color: #334155;
  vertical-align: middle;
}

.table-modern tbody tr:last-child td {
  border-bottom: none;
}

/* ===== BADGE ===== */
.badge-modern {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  border: none;
}

.badge-modern i {
  font-size: 14px;
}

.badge-modern.bg-success { background: #dcfce7 !important; color: #166534; }
.badge-modern.bg-warning { background: #fef3c7 !important; color: #b45309; }
.badge-modern.bg-danger { background: #ffe4e6 !important; color: #be123c; }
.badge-modern.bg-secondary { background: #f1f5f9 !important; color: #475569; }
.badge-modern.bg-info { background: #dbeafe !important; color: #1e40af; }
.badge-modern.bg-primary { background: #dbeafe !important; color: #1e40af; }

/* ===== BUTTON ===== */
.btn-modern {
  border-radius: var(--radius-sm) !important;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 22px;
  transition: all 0.25s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
}

.btn-modern:hover {
  transform: translateY(-1px);
}

.btn-modern:active {
  transform: translateY(0);
}

.btn-modern.btn-sm {
  padding: 7px 16px;
  font-size: 12px;
  gap: 6px;
}

.btn-modern.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

/* Primary (Biru): Tambah, Simpan, Bayar */
.btn-modern.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}
.btn-modern.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 14px rgba(37,99,235,0.35);
}

/* Success (Hijau): Lunas, Aktif */
.btn-modern.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 2px 8px rgba(34,197,94,0.25);
}
.btn-modern.btn-success:hover {
  background: var(--success-hover);
  box-shadow: 0 4px 14px rgba(34,197,94,0.35);
}

/* Warning (Orange): Pending, Lanjutkan Pembayaran */
.btn-modern.btn-warning {
  background: var(--warning);
  color: #fff;
  box-shadow: 0 2px 8px rgba(245,158,11,0.25);
}
.btn-modern.btn-warning:hover {
  background: var(--warning-hover);
  box-shadow: 0 4px 14px rgba(245,158,11,0.35);
}

/* Danger (Merah): Hapus */
.btn-modern.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239,68,68,0.25);
}
.btn-modern.btn-danger:hover {
  background: var(--danger-hover);
  box-shadow: 0 4px 14px rgba(239,68,68,0.35);
}

/* Secondary / Outline: Detail, Tutup, Reset, Batal */
.btn-modern.btn-outline {
  background: transparent;
  border: 1.5px solid #e2e8f0;
  color: #475569;
  box-shadow: none;
}
.btn-modern.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
  box-shadow: none;
  transform: none;
}

.btn-icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm) !important;
}

/* ===== FORM ===== */
.form-floating-custom {
  position: relative;
  margin-bottom: 22px;
}

.form-floating-custom .form-control,
.form-floating-custom .form-select {
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-form);
  padding: 22px 14px 8px;
  height: auto;
  min-height: 54px;
  font-size: 14px;
  background: var(--bg);
  transition: var(--transition);
  line-height: 1.4;
}

.form-floating-custom .form-control::placeholder {
  color: transparent;
}

.form-floating-custom .form-control:focus,
.form-floating-custom .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.08);
  background: var(--card);
}

.form-floating-custom .form-control.is-invalid,
.form-floating-custom .form-select.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(239,68,68,0.08);
}

.form-floating-custom label {
  position: absolute;
  top: 50%;
  left: 15px;
  transform: translateY(-50%);
  font-size: 14px;
  color: #94a3b8;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  padding: 0 2px;
  transform-origin: left center;
  line-height: 1.2;
}

.form-floating-custom .form-control:focus ~ label,
.form-floating-custom .form-control:not(:placeholder-shown) ~ label,
.form-floating-custom .form-control.has-value ~ label,
.form-floating-custom .form-select:focus ~ label,
.form-floating-custom .form-select.has-value ~ label {
  top: 7px;
  transform: translateY(0) scale(0.82);
  font-size: 14px;
  color: var(--primary);
  font-weight: 600;
}

.form-floating-custom textarea ~ label {
  top: 16px;
  transform: none;
}

.form-floating-custom textarea:focus ~ label,
.form-floating-custom textarea:not(:placeholder-shown) ~ label {
  top: 7px;
  transform: scale(0.82);
  transform-origin: left center;
}

.form-floating-custom .is-invalid ~ label {
  color: var(--danger);
}

.form-floating-custom .invalid-feedback {
  font-size: 12px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== SEARCH BOX ===== */
.search-box {
  position: relative;
}

.search-box .form-control {
  height: 44px;
  padding-left: 42px;
  border-radius: var(--radius-form);
  border: 1.5px solid #e2e8f0;
  background: var(--card);
  font-size: 14px;
  transition: var(--transition);
}

.search-box .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.08);
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 18px;
  pointer-events: none;
}

.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-bar .search-box {
  flex: 1;
  min-width: 200px;
}

.filter-bar .filter-btn-group {
  display: flex;
  gap: 6px;
}

.filter-bar .filter-btn {
  padding: 9px 20px;
  border-radius: 100px;
  border: 1.5px solid #e2e8f0;
  background: var(--card);
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter-bar .filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-bar .filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ===== PAGINATION ===== */
.pagination-modern {
  gap: 4px;
}

.pagination-modern .page-link {
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #475569;
  transition: var(--transition);
  background: transparent;
}

.pagination-modern .page-link:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.pagination-modern .page-item.active .page-link {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.pagination-modern .page-item.disabled .page-link {
  color: #cbd5e1;
  background: transparent;
}

/* ===== MODAL ===== */
.modal-modern .modal-content {
  border: none;
  border-radius: 18px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.modal-modern .modal-header {
  border-bottom: 1px solid #f1f5f9;
  padding: 22px 28px;
}

.modal-modern .modal-header .modal-title {
  font-weight: 700;
  font-size: 18px;
  color: #0f172a;
}

.modal-modern .modal-header .btn-close {
  background: transparent;
  font-size: 22px;
  opacity: 0.4;
  transition: var(--transition);
}

.modal-modern .modal-header .btn-close:hover {
  opacity: 0.8;
}

.modal-modern .modal-body {
  padding: 28px;
}

.modal-modern .modal-footer {
  border-top: 1px solid #f1f5f9;
  padding: 20px 28px;
}

/* ===== DROPDOWN ===== */
.dropdown-modern .dropdown-menu {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  padding: 8px;
}

.dropdown-modern .dropdown-item {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
}

.dropdown-modern .dropdown-item i {
  font-size: 18px;
  width: 20px;
  text-align: center;
  color: #64748b;
}

.dropdown-modern .dropdown-item:hover {
  background: var(--bg);
  color: var(--primary);
}

.dropdown-modern .dropdown-item:hover i {
  color: var(--primary);
}

.dropdown-modern .dropdown-divider {
  margin: 4px 0;
}

/* ===== SKELETON ===== */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-line:last-child { width: 60%; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state i {
  font-size: 56px;
  color: #cbd5e1;
  margin-bottom: 16px;
}

.empty-state h5 {
  font-weight: 600;
  color: #475569;
  margin-bottom: 8px;
}

.empty-state p {
  color: #94a3b8;
  font-size: 14px;
  margin-bottom: 20px;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast-modern {
  border: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 320px;
}

.toast-modern .toast-header {
  border: none;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 14px;
}

.toast-modern .toast-body {
  padding: 12px 16px;
  font-size: 13px;
  color: #475569;
}

/* ===== LOADING ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.loading-overlay .spinner-border {
  width: 48px;
  height: 48px;
  border-width: 4px;
  color: var(--primary);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1039; backdrop-filter: blur(4px); }
  .main-content { margin-left: 0; }
  .navbar-left .sidebar-toggle { display: flex; }
  .navbar-search { width: 200px; }
  .navbar-right .admin-info { display: none; }
  .page-content { padding: 16px; }
}

@media (max-width: 575.98px) {
  .navbar-search { display: none; }
  .page-content { padding: 12px; }
}
