:root {
  --sidebar-width: 54px;
  /* Kasturi HRMS Primary Green */
  --green: #1b8755;
  --green-hover: #157347;
  --active-bg: #e8f5e9;
  --border: #e2e8f0;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: #ffffff;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
  z-index: 100;
  position: relative;
  box-shadow: rgba(0, 0, 0, 0.05) 0px 0px 0px 1px;
}

.sidebar-backdrop {
  display: none;
}

/* Header Area */
.sidebar-header {
  width: 100%;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}

.hamburger-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #334155;
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.hamburger-btn:hover {
  background-color: #f1f5f9;
}

/* Sidebar Menu List */
.sidebar-menu {
  list-style: none;
  width: 100%;
  padding: 0;
  margin: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.menu-item {
  width: 100%;
}

/* Menu Links & Buttons (No scale, fixed size) */
.menu-link {
  width: 100%;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  box-sizing: border-box;
  outline: none;
  transition: background-color 0.15s ease;
}

.menu-link i,
.menu-link svg {
  font-size: 20px;
  stroke: var(--green);
  /* លុបចោល Animation មិនឱ្យរីករួម */
  transform: none !important;
}

.menu-link:hover {
  background-color: #f0fdf4;
}

/* Active State */
.menu-item.active .menu-link {
  background-color: var(--active-bg);
}

.menu-item.active .menu-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3.5px;
  background-color: var(--green);
}

/* ជំនួសសញ្ញាជ្រុងស្តាំក្រោម ដោយរូប point.svg របស់អ្នក */
.has-submenu .menu-link::after { content: none; display: none; }

/* រូបភាព SVG Icon ក្នុង Menu */
.sidebar-svg-icon {
  width: 22px;
  height: 22px;
  display: block;
  object-fit: contain;
  /* បម្លែងរូបភាព SVG ទៅជាពណ៌បៃតង Kasturi Green (#1b8755) */
  filter: invert(39%) sepia(74%) saturate(456%) hue-rotate(101deg) brightness(92%) contrast(92%);
}

/* ================= POPUP CARD / MODAL ================= */
.sidebar-popover {
  position: fixed;
  left: calc(var(--sidebar-width) + 8px);
  width: 250px;
  background-color: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08),
              0 8px 10px -6px rgba(0, 0, 0, 0.04);
  z-index: 10000;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.sidebar-popover.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
}

.popover-header {
  padding: 14px 16px 10px;
}

.popover-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.popover-sub {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

.popover-divider {
  height: 1px;
  background-color: #f1f5f9;
  width: 100%;
}

.popover-list {
  list-style: none;
  padding: 6px 8px;
  margin: 0;
}

.popover-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  color: #334155;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.15s ease;
}

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

.popover-item:hover {
  background-color: var(--active-bg);
  color: var(--green);
}

.popover-item:hover i {
  color: var(--green);
}
/* ================= RESPONSIVE STYLES ================= */
@media (max-width: 767px) {
    .sidebar {
    position: fixed;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    height: auto;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 300;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: var(--topbar-height) 0 0;
    background: rgba(15, 23, 42, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 290;
  }

  .sidebar-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-is-open {
    overflow: hidden;
    }
}
