.teal-modules-wrapper .module-button,
.teal-modules-tree .module-group-label {
  --bs-nav-link-padding-x: 0.5rem;
  --bs-nav-link-padding-y: 0.25rem;
}

.teal-modules-wrapper .module-button {
  margin: 2px;
  padding: var(--bs-nav-link-padding-y) var(--bs-nav-link-padding-x);
  border: 1px solid var(--bs-primary-border-subtle);
  border-radius: 5px;
  background: white;
  color: var(--bs-primary);
  display: inline-flex;
}

.teal-modules-wrapper .module-button:hover {
  background: var(--bs-primary-border-subtle);
}

.teal-modules-wrapper .module-button.active {
  color: var(--bs-btn-active-color);
  background: var(--bs-btn-active-bg);
  border-color: var(--bs-btn-active-border-color);
}

.teal-modules-wrapper .dropdown.nav-item-custom {
  padding: 0.25rem;
}

.dropdown.nav-item-custom:not(.dropdown-menu) {
  cursor: pointer;
}

.dropdown.nav-item-custom > .dropdown-menu {
  cursor: auto;
}

.dropdown.nav-item-custom:hover > .dropdown-menu {
  opacity: 1;
  transform: scaleY(1);
  pointer-events: auto;
}

.dropdown.nav-item-custom:hover .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown.nav-item-custom::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 5px;
  background: transparent;
  z-index: 1045;
}

.dropdown.nav-item-custom {
  position: relative;
}

.teal.dropdown-button {
  border: 2px solid transparent;
  margin: 0.25em;
  cursor: pointer;
}

.teal.dropdown-button .dropdown-arrow {
  transition: transform 0.3s ease;
}

.teal.dropdown-button:hover .dropdown-arrow {
  transform: rotate(180deg);
}

.teal.dropdown-button:hover {
  border-bottom: 2px solid var(--bs-primary-border-subtle);
}

.nav-item-custom > .dropdown-menu {
  opacity: 0;
  margin-top: 5px;
  transform: scale(0.8, 0.8);
  transform-origin: top left;
  transition: opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
  pointer-events: none;
}

.nav-item-custom.dropdown.show > .dropdown-menu {
  opacity: 1;
  transform: scaleY(1);
  pointer-events: auto;
}

.teal-modules-wrapper .dropdown-menu {
  z-index: 1046;
  max-width: calc(100vw - 2rem);
  max-height: 80vh;
  padding: 1rem;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid #dee2e6;
  border-radius: 8px;
}

.teal-modules-wrapper .dropdown-menu > .teal-modules-tree {
  width: 700px;
}

.teal-modules-wrapper .dropdown-menu > .reporter-menu {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  padding: 1rem;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0;
}

.teal-modules-wrapper .dropdown-menu > .reporter-menu .teal-reporter {
  white-space: nowrap;
}

.teal-modules-wrapper .dropdown-toggle {
  padding: 10px;
}

.teal-modules-tree,
.teal-modules-tree ul {
  list-style: none;
  margin: 0;
  padding-left: 1.25em;
  position: relative;
}

.teal-modules-tree > li {
  padding-left: 0;
}

.teal-modules-tree li {
  position: relative;
  margin: 0;
  padding: 0;
}

.teal-modules-tree li::before {
  content: "";
  position: absolute;
  top: -1em;
  left: -1.25em;
  width: 1.4em;
  height: 100%;
  border-left: 2px solid var(--bs-border-color, #bbb);
  border-bottom: 2px solid var(--bs-border-color, #bbb);
  pointer-events: none;
}

.teal-modules-tree li:has(ul)::before {
  border-left: 2px solid transparent;
  border-bottom: 2px solid transparent;
}

.teal-modules-tree > li > ul > li:has(> a) ~ li::before,
.teal-modules-tree > li > ul > li:has(> span) ~ li::before {
  border-left: 2px solid var(--bs-border-color, #bbb);
}

.teal-modules-tree > li > ul > li:last-child:has(> ul)::before {
  border-left: 2px solid transparent;
}

.teal-modules-tree li > a,
.teal-modules-tree li > span,
.teal-modules-tree li > ul {
  display: block;
  padding-left: 1.25em;
}

.teal-modules-tree .module-group-label {
  margin-left: 0 !important;
  font-weight: bold;
  color: var(--bs-secondary, #6c757d);
  border: 1px solid #dee2e6;
  border-radius: 12px;
  padding: var(--bs-nav-link-padding-y, 0.375rem)
    var(--bs-nav-link-padding-x, 0.75rem);
  display: inline-block;
  background: #fff;
  position: relative;
}
