/* Base button group styling */
.nx-btn-group {
  position: relative;
  display: inline-flex;
}

.nx-btn-group > .nx-btn {
  position: relative;
  flex: 1 1 auto;
  margin-left: -1px;
}

.nx-btn-group > .nx-btn:first-child {
  margin-left: 0;
}

/* Border radius untuk button yang berdekatan */
.nx-btn-group > .nx-btn:not(:last-child):not(.dropdown-toggle) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.nx-btn-group > .nx-btn:not(:first-child) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.nx-btn-group-vertical {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  vertical-align: middle;
}

.nx-btn-group-vertical > .nx-btn {
  width: 100%;
}

.nx-btn-group-vertical > .nx-btn:not(:first-child) {
  margin-top: -1px;
}

.nx-btn-group-vertical > .nx-btn:not(:last-child) {
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.nx-btn-group-vertical > .nx-btn:not(:first-child) {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* Sizing */
.nx-btn-group-lg > .nx-btn {
  padding: 0.5rem 1rem;
  font-size: 1.25rem;
}

.nx-btn-group-sm > .nx-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

/* Toolbar */
.nx-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.nx-toolbar .nx-btn-group:last-child {
  margin-right: 0;
}

.nx-toolbar .nx-btn-group {
  display: inline-flex;
}

.nx-toolbar .nx-btn-group > .nx-btn {
  position: relative;
  margin-left: -1px;
}

.nx-toolbar .nx-btn-group > .nx-btn:first-child {
  margin-left: 0;
}

/* Color variations */
.nx-btn-group > .nx-btn-primary {
  background-color: #00d1b2;
  color: white;
  border-color: #00d1b2;
}

.nx-btn-group > .nx-btn-secondary {
  background-color: #475569;
  color: white;
  border-color: #475569;
}

/* Tambahkan style untuk dropdown */
.nx-dropdown {
  position: relative;
  display: inline-flex;
}

.nx-dropdown-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-right: 2.5rem !important;
  white-space: nowrap;
}

.nx-dropdown-toggle i {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.2s;
  pointer-events: none; /* Penting: mencegah ikon mengganggu klik */
}

.nx-dropdown-toggle.active i {
  transform: translateY(-50%) rotate(180deg);
}

.nx-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 9999;
  display: none;
  min-width: 200px; /* Sedikit lebih lebar */
  padding: 0.5rem 0;
  margin-top: 2px;
  background-color: #fff;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 0.25rem;
  box-shadow: 0 3px 10px rgba(0,0,0,.15);
}

.nx-dropdown-menu.show {
  display: block;
}

.nx-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.75rem 1.25rem;
  color: #212529;
  text-decoration: none;
  white-space: nowrap;
  background: none;
  border: 0;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.nx-dropdown-item:hover {
  background-color: #f8f9fa;
  color: #16181b;
  text-decoration: none;
}

/* Button group dengan dropdown */
.nx-btn-group .nx-dropdown {
  position: relative;
  display: inline-flex;
  margin-left: -1px;
}

.nx-btn-group .nx-dropdown .nx-btn {
  border-radius: 0;
  margin-left: 0;
  flex: 1 1 auto;
}

.nx-btn-group .nx-dropdown:last-child .nx-btn {
  border-top-right-radius: 0.25rem;
  border-bottom-right-radius: 0.25rem;
}

.nx-btn-group .nx-dropdown .nx-dropdown-menu {
  border-radius: 0.25rem;
  margin-top: 2px;
}

.nx-btn-group > .nx-btn:not(:last-child):not(.nx-dropdown-toggle),
.nx-btn-group > .nx-dropdown:not(:last-child) .nx-btn {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.nx-btn-group > .nx-btn:not(:first-child),
.nx-btn-group > .nx-dropdown:not(:first-child) .nx-btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.nx-btn-group .nx-dropdown .nx-btn {
  border-color: #dee2e6;
}

.nx-btn-group .nx-dropdown .nx-btn:hover {
  z-index: 1;
}

.nx-btn-group .nx-dropdown .nx-btn.active {
  z-index: 2;
}

/* Pastikan container tidak memotong dropdown */

.nx-btn-group,
.nx-dropdown {
  overflow: visible !important;
}

/* Tambahan untuk memastikan posisi dropdown benar */
.nx-btn-group > .nx-dropdown:last-child .nx-dropdown-menu {
  right: 0;
  left: auto;
}

