/* ================= CUSTOM TEMA EMERALD GREEN ================= */
:root {
  --bs-primary: #059669;
  --bs-primary-rgb: 5, 150, 105;
  --sidebar-bg: #ffffff;
  --body-bg: #f8f9fc;
  --text-muted: #858796;
  --text-dark: #5a5c69;
}

body {
  background-color: var(--body-bg);
}

/* Background, Teks, & Border Primary */
.bg-primary {
  background-color: var(--bs-primary) !important;
}
.text-primary {
  color: var(--bs-primary) !important;
}
.border-primary {
  border-color: var(--bs-primary) !important;
}

/* ================= MENGHILANGKAN FOCUS RING BIRU BAWAAN BOOTSTRAP ================= */
.nav-link:focus,
.btn:focus,
.form-control:focus,
.form-select:focus,
.page-link:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* Khusus untuk input form agar saat diklik garisnya jadi Emerald Green, bukan Biru */
.form-control:focus,
.form-select:focus {
  border-color: var(--bs-primary) !important;
  box-shadow: 0 0 0 0.25rem rgba(5, 150, 105, 0.25) !important;
}

/* ================= ENTERPRISE SIDEBAR ================= */
.sidebar {
  min-height: 100vh;
  border-right: 1px solid #e3e6f0;
  background-color: var(--sidebar-bg);
  z-index: 1000;
}

/* Styling Menu Utama */
.nav-link {
  color: var(--text-dark);
  font-weight: 600;
  transition: all 0.2s ease-in-out;
  border: none;
  background: transparent;
}

.nav-link:hover {
  background-color: #ecfdf5; /* Hijau pudar */
  color: var(--bs-primary);
}

.nav-link.active {
  background-color: var(--bs-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2); /* Bayangan hijau */
}

/* Styling Sub-Menu */
.submenu {
  background-color: var(--body-bg);
  border-radius: 8px;
  margin-top: 4px;
  border-left: 3px solid var(--bs-primary); /* Garis tepi Emerald Green */
}

.submenu .nav-link {
  font-size: 0.85rem;
  padding-left: 2.5rem;
  font-weight: 500;
  color: var(--text-muted);
}

.submenu .nav-link:hover {
  background-color: #e2e8f0;
  color: #3a3b45;
}

.submenu .nav-link.active {
  background-color: #ecfdf5 !important;
  color: var(--bs-primary) !important; /* Teks aktif Emerald Green */
  font-weight: 700;
  box-shadow: none;
  border-radius: 0;
}

/* Panah Dropdown Bergerak */
.dropdown-toggle-icon {
  transition: transform 0.3s;
}

.nav-link[aria-expanded="true"] .dropdown-toggle-icon {
  transform: rotate(180deg);
}

/* ================= TOMBOL UTAMA & OUTLINE ================= */
.btn-primary {
  background-color: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
  color: #ffffff !important;
  transition: all 0.2s ease-in-out;
}

.btn-primary:hover {
  background-color: #047857 !important;
  border-color: #047857 !important;
  color: #ffffff !important;
}

/* Tombol Outline */
.btn-outline-primary {
  color: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
  background-color: transparent !important;
  transition: all 0.2s ease-in-out;
}

.btn-outline-primary:hover,
.btn-outline-primary.active {
  background-color: var(--bs-primary) !important;
  color: #ffffff !important;
  border-color: var(--bs-primary) !important;
}

/* Transparant Button Hover */
.btn.bg-transparent:hover {
  color: var(--bs-primary) !important;
  background-color: #ecfdf5 !important;
}

/* ================= RESPONSIVE MOBILE ================= */
@media (max-width: 767.98px) {
  /* Sembunyikan sidebar ke kiri */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    width: 280px !important;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1050;
  }

  /* Class untuk memunculkan sidebar */
  .sidebar.show {
    transform: translateX(0);
  }

  /* Latar belakang gelap saat sidebar terbuka */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    backdrop-filter: blur(2px);
  }

  .sidebar-overlay.show {
    display: block;
  }

  /* Sesuaikan jarak konten utama di HP */
  .main-wrapper {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}

/* ================= TOPBAR STICKY (MEMBENTANG PENUH) ================= */
.topbar-sticky {
  top: 0;
  z-index: 1020;
  margin-top: -0.5rem; /* Menarik ke atas menutupi padding py-2 di tag main */
  padding-top: 0.8rem;
  padding-bottom: 0.8rem !important;

  /* DESKTOP: Menetralkan class px-md-5 (3rem) bawaan Bootstrap */
  margin-left: -3rem;
  margin-right: -3rem;
  padding-left: 3rem;
  padding-right: 3rem;
}

@media (max-width: 767.98px) {
  .topbar-sticky {
    /* MOBILE: Menetralkan class .main-wrapper (1rem) buatanmu sendiri */
    margin-left: -1rem !important;
    margin-right: -1rem !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}
