/* ====== GLOBAL ====== */
body.app-body {
  background-color: #e5e7eb;
  margin: 0;
  overflow-x: hidden;
}

.app-shell {
  height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.app-shell.d-flex {
  display: grid !important;
  grid-template-columns: 260px minmax(0, 1fr);
}

.app-sidebar-backdrop {
  display: none;
}

/* ====== SIDEBAR ====== */
.app-sidebar {
  grid-column: 1;
  grid-row: 1;
  width: 260px;
  flex: 0 0 260px;
  min-width: 260px;
  max-width: 260px;
  min-height: 100vh;
  background: radial-gradient(circle at top, #0f172a, #020617 55%);
  color: #e5e7eb;
  border-right: 1px solid rgba(148, 163, 184, 0.4);
  display: flex;
  flex-direction: column;
}

.app-sidebar-header {
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
}

.app-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.app-sidebar-logo img {
  width: 62px; /* 🎯 ukuran proporsional */
  height: 62px;
  border-radius: 14px; /* sudut lebih lembut */
  object-fit: contain;
  background: #0b1120;
  padding: 0px; /* memberi ruang agar tidak “sumpek” */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); /* efek premium */
}

.app-logo-text {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
}

.app-logo-sub {
  font-size: 0.7rem;
  color: #9ca3af;
}

.app-sidebar-user {
  padding: 0.75rem 1.5rem 0.4rem;
}

.app-sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 500;
}

.app-sidebar-user-role {
  font-size: 0.7rem;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  color: #e5e7eb;
}

/* Menu */
.app-nav {
  padding: 0.5rem 0.75rem 1rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.app-nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  padding: 0.75rem 0.75rem 0.2rem;
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  padding: 0.45rem 0.9rem;
  border-radius: 0.6rem;
  color: #e5e7eb;
  text-decoration: none;
  transition: all 0.18s ease;
}

.app-nav-link i {
  font-size: 0.95rem;
}

.app-nav-link:hover {
  background: rgba(148, 163, 184, 0.18);
  color: #f9fafb;
}

.app-nav-link.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.55);
  color: #f9fafb;
}

.app-nav-parent {
  margin-top: 0.1rem;
  border: 1px solid transparent;
}

.app-nav-parent.open {
  background: rgba(15, 23, 42, 0.42);
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: none;
  color: #dbeafe;
}

.app-nav-parent.open .fa-chevron-down {
  color: #93c5fd;
}

.app-nav-submenu {
  position: relative;
  margin: 0.55rem 0 0.75rem 0;
  padding: 0.35rem 0.45rem 0.4rem 0.85rem;
}

.app-nav-submenu::before {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 0.45rem;
  bottom: 0.45rem;
  width: 1px;
  background: rgba(148, 163, 184, 0.32);
}

.app-nav-sub-link {
  position: relative;
  margin: 0.28rem 0 0.28rem 0.15rem;
  padding: 0.42rem 0.7rem 0.42rem 0.8rem;
  border-radius: 0.55rem;
  font-size: 0.8rem;
  color: #cbd5e1;
  background: transparent;
  box-shadow: none;
}

.app-nav-sub-link::before {
  content: "";
  position: absolute;
  left: -0.5rem;
  top: 50%;
  width: 0.35rem;
  height: 1px;
  background: rgba(148, 163, 184, 0.32);
}

.app-nav-sub-link i {
  width: 18px;
  text-align: center;
  color: #94a3b8;
}

.app-nav-sub-link.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.85), rgba(14, 165, 233, 0.5));
  box-shadow: 0 8px 18px rgba(14, 165, 233, 0.16);
  color: #ffffff;
}

.app-nav-sub-link.active::before {
  height: 18px;
  width: 3px;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 999px;
  background: #38bdf8;
}

.app-nav-sub-link.active i {
  color: #bfdbfe;
}

/* Logout */
.app-nav-logout {
  border-top: 1px solid rgba(148, 163, 184, 0.4);
  padding: 0.6rem 0.9rem 1rem;
}

.app-nav-logout .app-nav-link {
  color: #fecaca;
}

.app-nav-logout .app-nav-link:hover {
  background: rgba(248, 113, 113, 0.15);
}

/* ====== MAIN AREA ====== */
.app-main {
  grid-column: 2;
  grid-row: 1;
  background: #f3f4f6;
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.app-topbar {
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  flex: 0 0 56px;
  background: linear-gradient(90deg, #111827, #1f2937);
  color: #e5e7eb;
  padding: 0 1.25rem;
  border-bottom: 1px solid rgba(17, 24, 39, 0.9);
  min-width: 0;
  overflow: hidden;
}

.app-topbar > .d-flex {
  min-width: 0;
  max-height: 56px;
}

.app-topbar-title {
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-topbar-subtitle {
  font-size: 0.75rem;
  line-height: 1.2;
  color: #9ca3af;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-topbar-user {
  flex: 0 0 auto;
  font-size: 0.8rem;
  line-height: 1;
  color: #e5e7eb;
}

/* MAIN BODY */
.app-main-body {
  padding: 1.25rem 1.5rem 1.5rem;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  min-width: 0;
  overflow-x: hidden;
}

/* FOOTER */
.app-footer {
  flex: 0 0 auto;
  font-size: 0.75rem;
  color: #9ca3af;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

/* ====== DASHBOARD CARDS ====== */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.stat-card {
  border-radius: 1rem;
  border: none;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.stat-card-body {
  padding: 0.9rem 1rem;
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 600;
  color: #111827;
}

.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.stat-icon.blue {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.stat-icon.green {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.stat-icon.amber {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.stat-icon.purple {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 991.98px) {
  .app-shell.d-flex {
    display: block !important;
  }

  .app-main {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: visible;
  }

  .app-main-body {
    overflow-y: visible;
  }

  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    height: 100vh;
    min-height: 100vh;
    transform: translateX(-100%);
    z-index: 1040;
    transition: transform 0.22s ease-out;
  }

  .app-sidebar.show {
    transform: translateX(0);
  }

  .app-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    z-index: 1030;
    display: none;
  }

  .app-sidebar-backdrop.show {
    display: block;
  }
}

/* PAGINATION GLOBAL */
.app-pagination-container {
  width: 100%;
  display: flex;
  justify-content: center; 
  margin-top: .75rem;
}

.app-pagination {
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 0;
}

.app-pagination .page-link {
  border-radius: 999px !important;
  padding: 4px 10px;
  border: 1px solid #e5e7eb !important;
  font-size: 0.78rem;
  color: #4b5563;
  transition: .2s;
}

.app-pagination .page-item.active .page-link {
  background: linear-gradient(135deg, #2563eb, #4f46e5) !important;
  border-color: #2563eb !important;
  color: #fff !important;
}

.app-pagination .page-item.disabled .page-link {
  color: #9ca3af !important;
  background-color: #f3f4f6 !important;
}

.app-pagination .page-link:hover {
  background-color: #e5f0ff !important;
  border-color: #2563eb !important;
  color: #1f2937 !important;
}

/* Setiap 10 item turun baris (opsional) */
@media (min-width: 768px) {
  .app-pagination .page-item:nth-child(10n+1) {
    flex-basis: 100%;
  }
}

.app-sidebar-logo img {
  background: #ffffff;
  padding: 6px;
}

.app-sidebar-logo-mark {
  width: 62px;
  height: 62px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  flex: 0 0 62px;
  overflow: hidden;
}

.app-sidebar-logo-mark img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  background: transparent;
  padding: 0;
  box-shadow: none;
}
