html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-Regular.woff2") format("woff2"),
    url("/fonts/Inter-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-Bold.woff2") format("woff2"),
    url("/fonts/Inter-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

body,
#sidebar {
  font-family: "Inter", sans-serif;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

html {
  overflow-y: scroll;
  /* Force scrollbar to always be visible */
}

body {
  margin-bottom: 60px;
}

.form-floating>.form-control-plaintext::placeholder,
.form-floating>.form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating>.form-control-plaintext:focus::placeholder,
.form-floating>.form-control:focus::placeholder {
  text-align: start;
}

/* Sidebar and Dashboard styles */
.kpi-card .display-5 {
  line-height: 1;
}

.doc-row {
  padding-top: .75rem;
  padding-bottom: .75rem;
  border: 0;
}

.text-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== MODERN SIDEBAR STYLES - FIXED FOR BOOTSTRAP COLLAPSE ===== */
#sidebar {
  width: 270px;
  transition: none;
}

.sidebar {
  --gutter: 12px;
  padding-inline: var(--gutter);
  overflow: hidden;
  height: 100vh;
  position: sticky;
  top: 0;
}

/* Reset Bootstrap nav defaults */
.sidebar .nav {
  --bs-nav-link-padding-x: 0;
  --bs-nav-link-padding-y: 0;
}

/* Nav item wrapper */
.sidebar .nav-item {
  position: relative;
  margin-bottom: 3px;
}

/* Base link styles */
.sidebar .nav-link.sidebar-link,
.sidebar .sidebar-group {
  display: flex;
  align-items: center;
  gap: .625rem;
  width: 100%;
  text-align: left;
  padding: .625rem .875rem;
  border-radius: .625rem;
  color: #374151;
  background: transparent;
  border: none;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: none;
}

/* Icon styling */
.sidebar .nav-link i,
.sidebar .sidebar-group i {
  color: inherit;
  font-size: 1.125rem;
  transition: none;
  flex-shrink: 0;
}

/* Hover effects */
.sidebar .nav-link:not(.active):hover,
.sidebar .sidebar-group:not(.active):hover {
  background: #f3f4f6;
  color: #1f2937;
  transform: none;
}

/* Active states */
.sidebar .nav-link.sidebar-link.active {
  background: #e5efff;
  color: #1e40af;
  font-weight: 600;
}

.sidebar .sidebar-group.active {
  background: #eef3ff;
  color: #1e40af;
  font-weight: 600;
}

/* Dropdown chevron */
.sidebar .sidebar-group .chevron {
  margin-left: auto;
  transition: transform 0.2s ease;
}

.sidebar .sidebar-group[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

/* ===== DROPDOWN FIX - INI YANG PENTING ===== */
/* Container submenu yang nested di dalam nav-item */
.sidebar .nav-item>.nav {
  display: block;
  /* gunakan layout blok biasa agar tidak ‘ngangkang’ saat animasi */
  padding-left: 0;
  margin-left: 0;
  padding-top: 0.25rem;
  overflow: hidden;
  /* cegah konten keluar saat tinggi berubah */
}

.sidebar .submenu {
  padding-left: 2rem;
  padding-right: 2rem;
  margin-left: 0;
  padding-top: 0.25rem;
  overflow: hidden;
}

/* Li wrapper di dalam submenu */
.sidebar .nav-item>.nav>li {
  list-style: none;
  padding-left: 0;
  margin-bottom: 2px;
  /* spasi antar item stabil */
  display: block;
  /* pastikan tiap item berada di baris sendiri */
}

.sidebar .submenu>li {
  list-style: none;
  padding-left: 0;
  margin-bottom: 2px;
  display: block;
}

/* Sublink styling */
.sidebar .nav-link.sidebar-sublink {
  display: flex;
  align-items: center;
  padding: .5rem .75rem;
  padding-left: 2rem;
  /* indent sederhana */
  border-radius: .5rem;
  color: #374151;
  font-size: 0.875rem;
  font-weight: 500;
  background: transparent;
  text-decoration: none;
  position: relative;
  transition: none;
  margin: 0;
}

/* Dot indicator inside link area */
.sidebar .nav-link.sidebar-sublink::before {
  content: "";
  position: absolute;
  left: .75rem;
  /* jangan terlalu kiri, tetap di dalam highlight */
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .45;
}

/* Sublink hover */
.sidebar .nav-link.sidebar-sublink:not(.active):hover {
  background: #f3f4f6;
  color: #1f2937;
  transform: none;
}

/* Sublink active */
.sidebar .nav-link.sidebar-sublink.active {
  background: #e5efff;
  color: #1e40af;
  font-weight: 600;
}

.sidebar .nav-link.sidebar-sublink.active::before {
  opacity: 1;
  background: #3b82f6;
  /* selaras dengan highlight */
}

/* ===== BOOTSTRAP COLLAPSE OVERRIDE ===== */
.sidebar .collapse {
  transition: height 0.35s ease;
  /* aktifkan animasi standar */
  overflow: hidden;
  /* cegah tumpang tindih selama animasi */
}

.sidebar .collapsing {
  transition: height 0.35s ease;
  /* animasi halus */
  overflow: hidden;
  /* tetap sembunyikan overflow */
}

/* Collapsed sidebar */
.sidebar.collapsed {
  width: 70px;
}

.sidebar.collapsed .label {
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed .nav-link,
.sidebar.collapsed .sidebar-group {
  justify-content: center;
  padding-inline: 0.5rem;
}

.sidebar.collapsed .bi-chevron-down {
  display: none;
}

/* Focus styles */
.sidebar .nav-link:focus-visible,
.sidebar .sidebar-group:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-radius: .625rem;
}

/* Custom scrollbar */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
  transition: background 0.2s;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* ===== Global small, professional typography (keep headings/titles unchanged) ===== */
/* Fully hideable sidebar */
#sidebar.is-hidden {
  display: none;
}

/* Fixed sidebar variant (below sticky topbar) */
#sidebar.is-fixed {
  position: fixed;
  top: var(--topbar-h, 0px);
  left: 0;
  height: calc(100vh - var(--topbar-h, 0px));
  z-index: 1020;
  /* under Bootstrap .sticky-top navbar (default 1030), above content */
}

/* Shift main app content when fixed sidebar is visible (Desktop only) */
@media (min-width: 768px) {
  #app.with-fixed-sidebar {
    margin-left: 270px;
    /* match #sidebar width */
  }
}

/* Add top padding so content isn't covered by fixed topbar */
body.has-fixed-topbar {
  padding-top: var(--topbar-h, 56px);
}

body {
  font-size: 14px;
  /* Small, readable base size */
  color: #374151;
  /* Neutral professional color */
  letter-spacing: -0.003em;
  /* Subtle tightening */
}

/* Make common components inherit body size (headings/titles not included) */
.table,
.table th,
.table td,
.form-control,
.form-select,
.form-check-label,
.form-label,
.form-text,
.btn,
.dropdown-item,
.nav-link,
.list-group-item,
.pagination,
.card,
.card-body,
.card-text,
.modal,
.modal-body,
.accordion-body {
  font-size: inherit;
}

.breadcrumb-link {
  color: #0d6efd;
  /* Bootstrap primary blue */
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb-link:hover {
  color: #0a58ca;
  text-decoration: none;
}

/* ========================================= */
/* MOBILE LAYOUT & SIDEBAR OVERLAY           */
/* ========================================= */
@media (max-width: 767.98px) {

  /* Hide sidebar by default on mobile (off-canvas) */
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1050;
    /* Above backdrop (1040) and navbar (1030) */
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    /* Premium shadow */
    width: 280px;
    /* Slightly wider for better touch targets */
    display: block !important;
    /* Override display:none from desktop logic if set */
  }

  /* When open */
  #sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Backdrop overlay - DISABLED */
  .sidebar-backdrop {
    display: none !important;
  }


  /* Reset main content margins on mobile */
  #app.with-fixed-sidebar {
    margin-left: 0 !important;
  }

  /* Prevent scroll when sidebar is open */
  body.sidebar-open {
    overflow: hidden;
  }

  /* Fix notification dropdown position on mobile */
  #notifDropdown~.dropdown-menu {
    position: fixed !important;
    right: 0.5rem !important;
    left: auto !important;
    top: 3.5rem !important;
    transform: none !important;
    width: min(320px, calc(100vw - 1rem)) !important;
  }
}