/* Submenu hide by default */
.navbar-nav .sub-menu {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 999;
  background: #fff;
  min-width: 300px;
  padding: 0;
  margin: 0;
  list-style: none;
  border: 1px solid #ddd;
}

/* Show submenu on hover (mouse) */
.navbar-nav li:hover > .sub-menu {
  display: block;
}

/* Show submenu on focus (keyboard tab) */
.navbar-nav li:focus-within > .sub-menu {
  display: block;
}

.navbar-nav .sub-menu li {
  position: relative;
}

.navbar-nav .sub-menu a {
  padding: 8px 15px;
  display: block;
  text-decoration: none;
  color: #333;
}

.navbar-nav .sub-menu a:hover,
.navbar-nav .sub-menu a:focus {
  background: #f8f9fa;
}

/* Dropdown arrow style */
.dropdown-toggle-icon {
  display: inline-block;
  margin-left: 2px;
  margin-right: 2px;
  border-top: 4px solid #000;
  border-left: 2px solid transparent;
  border-right: 4px solid transparent;
  vertical-align: middle;
}

.navbar .dropdown-menu {
  margin-top: 0; /* parent এর সাথে লাগানো থাকবে */
  border-radius: 0.5rem; /* সুন্দর corner */
  border: 1px solid #ddd;
}

/*---------*/
/* parent li কে relative করতে হবে */
.navbar-nav li {
  position: relative;
  padding-left: 8px;
}

/* সব submenu parent এর নিচে খুলবে */
.navbar-nav .sub-menu .sub-menu {
  top: 100%;
  left: 0;
}

/* Base submenu style */
.primary-menu ul.sub-menu {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 9999;
  background: #fff;
  min-width: 300px;
  padding: 0;
  margin: 0;
  list-style: none;
  border: 1px solid #ddd;
}

/* Show submenu on hover and focus */
.primary-menu li:hover > ul.sub-menu,
.primary-menu li:focus-within > ul.sub-menu {
  display: block;
}

/* Third-level submenu (submenu of submenu) */
.primary-menu ul.sub-menu ul.sub-menu {
  left: 100%;
  top: 0;
  border: 1px solid #ddd;
}

/* Accessibility fix: allow focus */
.primary-menu li a:focus + ul.sub-menu,
.primary-menu li a:active + ul.sub-menu {
  display: block;
}

/* Basic link style */
.primary-menu ul.sub-menu li a {
  display: block;
  padding: 8px 12px;
  color: #333;
  text-decoration: none;
}

.primary-menu ul.sub-menu li a:hover,
.primary-menu ul.sub-menu li a:focus {
  background: #f5f5f5;
}

/* সব parent menu item এর জন্য */
.primary-menu .menu-item-has-children > a {
  position: relative;   /* arrow এর জন্য parent কে relative করলাম */
  padding-right: 35px;  /* ডানে extra জায়গা */
  display: inline-block;
}

/* Arrow সবসময় ডান পাশে থাকবে */
.primary-menu .menu-item-has-children > a::after {
  content: "▾";              /* ▼ icon */
  position: absolute;
  right: 10px;                /* টেক্সটের একেবারে ডান পাশে */
  top: 50%;                  /* vertical center */
  transform: translateY(-50%);
  font-size: 12px;
}

/* 3rd level submenu হলে ডানে যাওয়ার arrow */
.primary-menu .sub-menu .menu-item-has-children > a::after {
  content: "▸";              /* ▶ icon */
}