/* Fix for dropdown-menu-right visibility issue */

/* Ensure dropdown menus are properly hidden when not active */
.dropdown-menu:not(.show) {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* Show dropdown when it has .show class */
.dropdown-menu.show {
    display: block !important;
    pointer-events: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Ensure right-aligned dropdowns don't overflow */
.dropdown-menu-right {
    right: 0;
    left: auto;
}

/* Prevent dropdown from being clickable when hidden */
.dropdown-menu:not(.show) {
    pointer-events: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Fix for dropdowns that might be using data-toggle */
[data-toggle="dropdown"] + .dropdown-menu:not(.show) {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* Ensure dropdown items are not clickable when menu is hidden */
.dropdown-menu:not(.show) .dropdown-item {
    pointer-events: none !important;
}

/* Fix z-index stacking issues */
.dropdown-menu {
    z-index: 1050 !important; /* Above other elements but below modals */
}

/* Responsive fix for mobile */
@media (max-width: 768px) {
    .dropdown-menu-right {
        right: 0;
        left: auto;
        max-width: 100%;
    }
}

/* Fix for RTL layouts */
[dir="rtl"] .dropdown-menu-right {
    right: auto;
    left: 0;
}

/* Ensure backdrop/overlay doesn't interfere */
.dropdown-backdrop {
    display: none !important;
}

/* Additional safeguard for hidden state */
.dropdown:not(.show) .dropdown-menu,
.btn-group:not(.show) .dropdown-menu {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(-10px);
}

/* Smooth transition when showing */
.dropdown.show .dropdown-menu,
.btn-group.show .dropdown-menu {
    transform: translateY(0);
}